Update a purchase
Change the document details, metadata or external_reference of a purchase.
Updates a purchase you made earlier. You can change confirmation_document, certificate_document, metadata and external_reference.
Keys you omit keep their current values. To remove optional data, set it to null explicitly.
Request
PATCH /v2/purchases/{id}
idstringrequiredThe purchase ID, or the external_reference of the purchase.
confirmation_documentobjectThe details of the compensation confirmation. See Document fields.
certificate_documentobjectThe details of the compensation certificate. See Document fields.
metadataobjectYour own key-value pairs. Never shown to users.
external_referencestringYour own unique reference for the purchase.
expandarray["files"] to receive the documents as file objects instead of IDs.
PATCH /v2/purchases/{id} in the API referenceThis request sets the purchase's metadata:
curl --request PATCH "https://api.sandbox.squake.earth/v2/purchases/purchase_sd234asdfl23" \
--header "Authorization: Bearer $SQUAKE_API_KEY" \
--header "Content-Type: application/json" \
--data '{ "metadata": { "booking_id": "BK-2026-0042", "cost_center": "Sales" } }'Response
The response is the updated purchase, in the same shape as Create a purchase.
Errors
| Status | Meaning |
|---|---|
400 | The request is malformed. |
401 | The API key is missing or invalid. |
403 | The request is forbidden for your account. |
404 | No purchase has this ID or external_reference. |
Related
- Retrieve a purchase
- Update a Purchase in the API reference