Errors and usage rules
Status codes, error shape, paging, date and money formats, limits, and how to repeat calls without creating duplicates.
Ova stranica još nije prevedena na Vaš jezik. Prikazana je na jeziku koji je dostupan.
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 inerrors. - 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
| Status | When it happens |
|---|---|
| 200 | The call worked. On a create with externalReference, it also means that reference already existed with the same data and nothing was written. |
| 201 | A new document or payment was created. |
| 204 | It worked and there is no body (ticket comment, revoking a key or a subscription). |
| 400 | The request is invalid: a missing field, a missing X-Client-Uid, an invalid RUT, a line without a name. |
| 401 | The token or key is missing or not valid. |
| 403 | The access does not allow the operation. On a state change, also when the service user lacks permission for that transition. |
| 404 | What you asked for does not exist in your company. |
| 409 | Conflict. 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). |
| 422 | On customer payments: the payment cannot be applied. Nothing was written. |
| 429 | Too many requests (only on the ticket routes). |
| 503 | On 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 creates | How the duplicate is avoided |
|---|---|
| Document | externalReference on POST /documents. Same reference and same data: answers 200 with the original document. Same reference and other data: 409. |
| Payment | externalReference on POST /receivables/customer-payments. Same rules; a reversed reference cannot be used for another payment either. |
| Ticket | externalReference on POST /integration/tickets. Same reference: answers 200 with the original ticket. |
| Customer | POST /clients/upsert-by-rut with matchOnRutAlone: true. It looks up by RUT before creating. |
| Contact | POST /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:
| Field | Meaning |
|---|---|
page | The page returned. |
pageSize | The page size used. |
totalCount | Total rows that match the filter. |
totalPages | Total number of pages. |
hasPrevious, hasNext | Whether 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
fromDateandtoDatefilters both ends are included. Many documents carry a time, so for a whole day send the end asyyyy-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
busyif 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.