Skip to content

Bulk-accept received documents (full acceptance only)

POST
/v1/documents/received/acceptance/bulk
curl --request POST \
--url https://api.emite.cr/v1/documents/received/acceptance/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "ids": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "mensaje": 1, "detalleMensaje": "example" }'

Accepts several received documents at once with mensaje 1 (full acceptance); a partial acceptance or a rejection is sent one document at a time. The whole list is checked first, then one acceptance per valid document is queued and the answer is 202 right away: each message is sent to Hacienda in the background, and its outcome is read on the document. Ids that cannot be accepted come back in skipped with their reason. More than 200 ids is 400 ACCEPTANCE_BULK_TOO_LARGE; a demo, 400 ACCEPTANCE_NOT_AVAILABLE_IN_DEMO.

Media typeapplication/json
object
ids
required

Ids (uuid) of the received documents to accept: at least one and at most 200 per call (400 ACCEPTANCE_BULK_TOO_LARGE above). A repeated id counts once.

Array<string>
>= 1 items <= 200 items
mensaje
required

The MensajeReceptor code: only 1 (full acceptance) in bulk. A partial acceptance (2) or a rejection (3) is emitted one document at a time with POST /v1/documents/received/{id}/acceptance.

number
Allowed values: 1
detalleMensaje

Accepted but not used today: every message of a batch goes out with <Mensaje> 1 only, without DetalleMensaje, CondicionImpuesto or credit amounts. Use the one-document endpoint to send them.

string
<= 160 characters
Media typeapplication/json
object
accepted
required

Documents queued for acceptance (repeated ids count once). Each is sent in the background; read its outcome on the document.

number
skipped
required

The ids left out, each with its reason; empty when every id was queued.

Array<object>
object
id
required

Id sent in the request.

string format: uuid
reason
required

Why it was left out, an error code: RECEIVED_DOCUMENT_NOT_FOUND — no such document in this company and environment; ACCEPTANCE_NOT_ALLOWED_FOR_DOCTYPE — a ticket (04), which has no identified receiver; ACCEPTANCE_IN_PROGRESS — a message for it is still in progress; RECEIVED_DOCUMENT_ALREADY_RESPONDED — Hacienda already accepted a message for it; ACCEPTANCE_DEADLINE_PASSED — its deadline passed and it is presumed fully accepted.

string
Allowed values: RECEIVED_DOCUMENT_NOT_FOUND ACCEPTANCE_NOT_ALLOWED_FOR_DOCTYPE ACCEPTANCE_IN_PROGRESS RECEIVED_DOCUMENT_ALREADY_RESPONDED ACCEPTANCE_DEADLINE_PASSED
batchId
required

Id of this batch, for correlation when reporting a problem.

string format: uuid
Example
{
"skipped": [
{
"reason": "RECEIVED_DOCUMENT_NOT_FOUND"
}
]
}