Integrations

API and webhooks

Create declarations from your own system and get notified when they are ready.

API access is part of the Business plan. On other plans the Developers page explains this instead of showing keys.

  1. 1Open Developers and create an API key. Use a test key (cs_test_) first. Test calls read invoices as fixed sample data and never touch your live declarations.
  2. 2Send the key as Authorization: Bearer cs_live_... on every call.
  3. 3POST /v1/declarations with the invoice files or with structured items. Send an Idempotency-Key header so a retry does not create a second declaration.
  4. 4Poll GET /v1/declarations/{id}, or add a webhook to be told when it is ready.
  5. 5Fetch the file with GET /v1/declarations/{id}/xml or /package.

Errors you may meet

CodeMeaning
plan_requiredThe company's plan has no API access.
plan_inactiveThe pilot ended or the account is overdue. Reads still work. Creating does not.
insufficient_scopeThe key lacks the scope for this call.
declaration_filedA registration number is set, so the declaration can no longer be changed.
rate_limitedToo many calls. Wait for the seconds in the Retry-After header.

Every response carries an x-request-id header. Quote it when you contact support. The Developers page lists every endpoint and webhook event, and /v1/openapi serves the specification.