Accept, partially accept or reject a received document
const url = 'https://api.emite.cr/v1/documents/received/example/acceptance';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"mensaje":1,"detalleMensaje":"example","condicionImpuesto":"01","montoTotalImpuestoAcreditar":1,"montoTotalDeGastoAplicable":1,"codigoActividad":"6201.0"}'};
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/example/acceptance \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "mensaje": 1, "detalleMensaje": "example", "condicionImpuesto": "01", "montoTotalImpuestoAcreditar": 1, "montoTotalDeGastoAplicable": 1, "codigoActividad": "6201.0" }'The company's answer to a supplier's document: mensaje 1 accepts it (message type 05), 2 accepts it partially (06) and 3 rejects it (07, with a detalleMensaje). The message gets its own receptor consecutive number, is signed with the company's certificate and sent to Hacienda; the document's acceptanceStatus changes at once, and goes back to none if Hacienda rejects the message. Hacienda's verdict arrives later, in the status of the message on the document. 400 ACCEPTANCE_NOT_ALLOWED_FOR_DOCTYPE for a ticket (04); 409 ACCEPTANCE_IN_PROGRESS or RECEIVED_DOCUMENT_ALREADY_RESPONDED while a message is in progress or once one was accepted. In production, the company needs a plan in good standing (402 SUBSCRIPTION_INACTIVE). When Hacienda does not answer, the message is kept signed with its number and sent automatically later: 502 ACCEPTANCE_PENDING_DELIVERY — do not send another. Not available in a demo (400 ACCEPTANCE_NOT_AVAILABLE_IN_DEMO).
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
The company's response, the <Mensaje> code of the MensajeReceptor: 1 — accept (message type 05); 2 — accept partially (06); 3 — reject (07).
The reason (DetalleMensaje), up to 160 characters. The API requires it to reject; Hacienda's Anexo asks for it, 5 to 160 characters, for a rejection and for a partial acceptance too.
How the company will use the IVA of the document (CondicionImpuesto, Anexo note 18):
01— it generates IVA credit.02— it generates partial IVA credit.03— capital goods.04— current expense, no credit.05— proportionality.
Omitted, the message carries none.
The IVA the company will take as credit (MontoTotalImpuestoAcreditar), up to 5 decimals. Per the Anexo, for when not all the tax paid is creditable; not needed with condicionImpuesto 05 nor in a rejection.
The amount the company will apply as an expense (MontoTotalDeGastoAplicable), up to 5 decimals. Per the Anexo, for when the total is not entirely an expense, or part of the IVA paid becomes one; not needed with condicionImpuesto 05 nor in a rejection.
The company's activity to which it applies the IVA credit (CodigoActividad), one of its activities in EmiteCR, in dotted form. Omitted: the one the supplier declared for the company in the document, when the company has it; otherwise the company's default (defaultAcceptanceActivityCode of the document). Never sent with condicionImpuesto 05, where the Anexo says the field must not be used; a value is ignored then.
Example
6201.0Responses
Section titled “Responses”object
Id of the message, as it appears in acceptances of the document.
The document's acceptanceStatus now, set from the message sent. It goes back to none if Hacienda rejects the message.
Hacienda's answer to the submission, normally recibido; the verdict on the message arrives later, in its status on the document.
Example
{ "acceptanceStatus": "accepted", "indEstado": "recibido"}