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}

idstringrequired

The purchase ID, or the external_reference of the purchase.

confirmation_documentobject

The details of the compensation confirmation. See Document fields.

certificate_documentobject

The details of the compensation certificate. See Document fields.

metadataobject

Your own key-value pairs. Never shown to users.

external_referencestring

Your own unique reference for the purchase.

expandarray

["files"] to receive the documents as file objects instead of IDs.

See every field of PATCH /v2/purchases/{id} in the API reference

This 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

StatusMeaning
400The request is malformed.
401The API key is missing or invalid.
403The request is forbidden for your account.
404No purchase has this ID or external_reference.

On this page

PATCH/v2/purchases/{id}

Run this request against the sandbox with your test key.

Open in API reference