Bulk-accept received documents (full acceptance only)
const url = 'https://api.emite.cr/v1/documents/received/acceptance/bulk';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"ids":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"mensaje":1,"detalleMensaje":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
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.
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.
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.
Responses
Section titled “Responses”object
Documents queued for acceptance (repeated ids count once). Each is sent in the background; read its outcome on the document.
The ids left out, each with its reason; empty when every id was queued.
object
Id sent in the request.
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.
Id of this batch, for correlation when reporting a problem.
Example
{ "skipped": [ { "reason": "RECEIVED_DOCUMENT_NOT_FOUND" } ]}