Retrieve a purchase

Check the state and documents of a purchase by its ID or your own external_reference.

Returns a purchase you made earlier. Use it to check the purchase's state and to read its documents. To avoid polling, register a webhook instead.

Request

GET /v2/purchases/{id}

idstringrequired

The purchase ID, or the external_reference you sent when you created the purchase.

expand[]string

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

See every field of GET /v2/purchases/{id} in the API reference
curl -G "https://api.sandbox.squake.earth/v2/purchases/purchase_sd234asdfl23" \
  --header "Authorization: Bearer $SQUAKE_API_KEY" \
  --data-urlencode "expand[]=files"

Because the endpoint also accepts your own reference, you can read a purchase without storing SQUAKE's ID:

curl "https://api.sandbox.squake.earth/v2/purchases/1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed" \
  --header "Authorization: Bearer $SQUAKE_API_KEY"

Response

The purchase from Create a purchase, after the cancellation period, with its files expanded:

200 OKapplication/json
{
  "id": "purchase_sd234asdfl23",
  "files": [
    {
      "id": "file_34sdfgJH9df4g35",
      "filename": "SQUAKE-CompensationConfirmation-euc1XXX.pdf",
      "purpose": "confirmation_document",
      "size": 48211,
      "type": "pdf",
      "download_url": "https://squake.s3.eu-central-1.amazonaws.com/..."
    },
    {
      "id": "file_7hkLm2Qp9xZt4",
      "filename": "SQUAKE-CompensationCertificate-project_XXX-euc1XXX.pdf",
      "purpose": "certificate_document",
      "size": 95120,
      "type": "pdf",
      "download_url": "https://squake.s3.eu-central-1.amazonaws.com/..."
    }
  ],
  "payment_method": "batch_settlement",
  "state": "confirmed",
  "metadata": { "booking_id": "BK-2026-0042" },
  "carbon_quantity": 0.123,
  "carbon_unit": "tonne",
  "total": 1845,
  "currency": "EUR",
  "external_reference": "1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed",
  "cancellable_until": "2026-11-24T10:15:00+00:00"
}

For every field, see Create a purchase. For what each state means, see Purchase states.

Errors

StatusMeaning
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

GET/v2/purchases/{id}

Run this request against the sandbox with your test key.

Open in API reference