submit_invoice
Submit an ALREADY-SIGNED Costa Rica electronic invoice (comprobante electronico v4.4) to the Ministerio de Hacienda reception gateway — the /recepcion call. You build the v4.4 XML (FacturaElectronica / TiqueteElectronico / NotaCredito etc.), sign it with YOUR Hacienda certificate (llave criptografica), and pass { clave, fecha, emisor, receptor?, comprobante_xml(base64 signed XML) }. This server does NOT sign and does NOT hold your certificate — it exchanges your ATV API user/password for an OAuth token and forwards the bytes untouched. Hacienda accepts the document for ASYNCHRONOUS processing: a successful call returns HTTP 202 with ind_estado "recibido"/"procesando" — you then poll query_invoice to get the final ind_estado "aceptado" (accepted) or "rechazado" (rejected). Required credential headers (set once in your MCP client, per-request, never stored): x-hacienda-username (your ATV API user) + x-hacienda-password (its password) — exchanged for a short-lived OAuth token at the Hacienda IdP. Optional header x-hacienda-mode: stag (default, sandbox, no fiscal effect) | prod (production, real fiscal effect). Optional owner-policy headers x-agentpay-max-amount / x-agentpay-approval-above / x-agentpay-allowed-tools.
Parameters6
| clave | string | required | The 50-digit clave numerica of the comprobante (same clave embedded in the signed XML). Use build_clave to assemble it if needed. |
| fecha | string | required | Emission timestamp in ISO 8601 with Costa Rica offset, e.g. 2026-07-10T09:30:00-06:00 (must match the FechaEmision in the signed XML). |
| emisor | object | required | The issuer identification { tipoIdentificacion, numeroIdentificacion }. |
| receptor | object | optional | The receiver identification { tipoIdentificacion, numeroIdentificacion }. Optional — omit for tiquete electronico / consumidor final. |
| comprobante_xml | string | required | The FULL signed v4.4 comprobante XML, base64-encoded. You sign it with your Hacienda certificate merchant-side; this server forwards the bytes untouched. |
| callback_url | string | optional | Optional URL Hacienda will POST the final estado to (async). Omit to poll with query_invoice instead. |
Raw schema
{
"type": "object",
"properties": {
"clave": {
"type": "string",
"description": "The 50-digit clave numerica of the comprobante (same clave embedded in the signed XML). Use build_clave to assemble it if needed."
},
"fecha": {
"type": "string",
"description": "Emission timestamp in ISO 8601 with Costa Rica offset, e.g. 2026-07-10T09:30:00-06:00 (must match the FechaEmision in the signed XML)."
},
"emisor": {
"type": "object",
"description": "The issuer identification { tipoIdentificacion, numeroIdentificacion }.",
"properties": {
"tipoIdentificacion": {
"type": "string",
"description": "Identification type: 01 = fisica (cedula fisica), 02 = juridica, 03 = DIMEX, 04 = NITE."
},
"numeroIdentificacion": {
"type": "string",
"description": "The identification number digits (cedula / DIMEX / NITE), no dashes."
}
},
"required": [
"tipoIdentificacion",
"numeroIdentificacion"
]
},
"receptor": {
"type": "object",
"description": "The receiver identification { tipoIdentificacion, numeroIdentificacion }. Optional — omit for tiquete electronico / consumidor final.",
"properties": {
"tipoIdentificacion": {
"type": "string",
"description": "Identification type: 01 = fisica (cedula fisica), 02 = juridica, 03 = DIMEX, 04 = NITE."
},
"numeroIdentificacion": {
"type": "string",
"description": "The identification number digits (cedula / DIMEX / NITE), no dashes."
}
}
},
"comprobante_xml": {
"type": "string",
"description": "The FULL signed v4.4 comprobante XML, base64-encoded. You sign it with your Hacienda certificate merchant-side; this server forwards the bytes untouched."
},
"callback_url": {
"type": "string",
"description": "Optional URL Hacienda will POST the final estado to (async). Omit to poll with query_invoice instead."
}
},
"required": [
"clave",
"fecha",
"emisor",
"comprobante_xml"
]
}