Skip to content
Documentation topics

Errors and usage rules

Status codes, error shape, paging, date and money formats, limits, and how to repeat calls without creating duplicates.

Response shape

Most routes answer with this envelope:

{
  "success": true,
  "data": { },
  "message": "Document created successfully",
  "errors": []
}

When something fails, success is false and errors carries the reason as a list of strings. Some messages are in Spanish and some in English.

{
  "success": false,
  "data": null,
  "message": null,
  "errors": ["Missing or invalid X-Client-Uid header: this endpoint is workspace-scoped."]
}

There are three exceptions:

  • The customer payment routes put a stable code in message (reference_conflict, invalid_request, not_found, busy, and the 422 codes) and the reason for people in errors.
  • The ticket routes that use an integration key answer { "error": "..." } and do not use the envelope.
  • Application access refusals answer { "error": "service_caller_..." }. See Authentication.

Status codes

StatusWhen it happens
200The call worked. On a create with externalReference, it also means that reference already existed with the same data and nothing was written.
201A new document or payment was created.
204It worked and there is no body (ticket comment, revoking a key or a subscription).
400The request is invalid: a missing field, a missing X-Client-Uid, an invalid RUT, a line without a name.
401The token or key is missing or not valid.
403The access does not allow the operation. On a state change, also when the service user lacks permission for that transition.
404What you asked for does not exist in your company.
409Conflict. On documents: the reference already has a document with other data, or the company is in the middle of its invoicing batch (try again later). On a state change: the system asks you to confirm and repeat (state 104).
422On customer payments: the payment cannot be applied. Nothing was written.
429Too many requests (only on the ticket routes).
503On customer payments: busy, another payment of the company was being applied. Retry in a few seconds.

If a state change answers 500, the message asks you to check the document's state before retrying, because the change may have been saved.

Repeating a call without duplicating

A call cut off by the network can be sent again. So that it does not create the same thing twice, send an identifier of your own:

What it createsHow the duplicate is avoided
DocumentexternalReference on POST /documents. Same reference and same data: answers 200 with the original document. Same reference and other data: 409.
PaymentexternalReference on POST /receivables/customer-payments. Same rules; a reversed reference cannot be used for another payment either.
TicketexternalReference on POST /integration/tickets. Same reference: answers 200 with the original ticket.
CustomerPOST /clients/upsert-by-rut with matchOnRutAlone: true. It looks up by RUT before creating.
ContactPOST /crm/contacts/upsert looks up by email or phone before creating.

POST /clients (not upsert-by-rut) creates a second customer if repeated, which is why it is not available to an application access.

Paging

Lists take page (from 1) and pageSize (20 by default) as parameters. The response adds these fields next to data:

FieldMeaning
pageThe page returned.
pageSizeThe page size used.
totalCountTotal rows that match the filter.
totalPagesTotal number of pages.
hasPrevious, hasNextWhether there is a previous or next page.

On GET /documents, includeTotal=false skips counting the whole set: totalCount becomes a lower bound, and hasNext stays correct for a reader that walks the pages until hasNext is false.

Dates, amounts and names

  • Dates use ISO 8601: a date alone (2026-10-15) or with time and zone (2026-10-15T14:03:11+00:00).
  • In the fromDate and toDate filters both ends are included. Many documents carry a time, so for a whole day send the end as yyyy-MM-ddT23:59:59.
  • Amounts are JSON numbers. Payments are sent in whole Chilean pesos; an amount with decimals is refused with 400.
  • Field names are camelCase.
  • Identifiers are GUIDs.

Usage limits

  • The ticket routes (/integration/tickets) accept up to 60 requests per minute from one IP address and answer 429 after that.
  • The API code configures no other request limit for the remaining routes. Still, avoid bursts: a payment can answer 503 busy if another payment of the same company is being applied.
  • Each webhook message must be answered in under 10 seconds. See Webhooks.

Versions

The current version is v1 and it goes in the route (/api/v1/...). Responses list the available versions in the api-supported-versions header.