create_invoice
Issue a Colombia electronic invoice (factura de venta / factura electrónica, DIAN UBL 2.1) through Matias API, which digitally signs it and transmits it straight to the DIAN (no Proveedor Tecnológico middleman) from YOUR OWN Matias account — this server only forwards the call and never holds your certificate. It wraps POST /invoice. Amounts are in Colombian pesos (COP, integer convention) and unit prices are TAX-EXCLUSIVE (valor neto, before IVA). IVA (VAT) rate per line: 19 (standard), 5 (reduced), or 0 (exento/excluido); the server liquidates the IVA locally (line net * rate/100) and builds the UBL totals. You must pass your DIAN resolution_number (from the resolución de facturación DIAN issued to your account) and the buyer. On success you get back the DIAN cufe (Código Único de Facturación Electrónica) and the acceptance state. Set x-matias-env=sandbox (default) to build/transmit in the pruebas environment with NO fiscal effect. Required credential header (set once in your MCP client, per-request, never stored): x-matias-token (your Matias bearer token — a JWT access_token from POST /auth/login, or a long-lived Personal Access Token from POST /auth/token). Optional x-matias-env: sandbox (default = pruebas, no fiscal effect) | production (real DIAN fiscal effect). Optional x-matias-base overrides the production base URL Matias assigns on contract. Optional owner-policy headers x-agentpay-max-amount / x-agentpay-approval-above / x-agentpay-allowed-tools.
Parameters9
| resolution_number | string | required | Your DIAN invoicing resolution number (número de resolución de facturación, issued by the DIAN to your account/prefix). REQUIRED — DIAN rejects an invoice whose number is outside an authorized resolución. |
| prefix | string | optional | Invoice prefix authorized in your resolución, e.g. "SETP" or "FE". Optional if your resolución has no prefix. |
| number | number | optional | Sequential invoice number within the resolución range, e.g. 990000001. Optional — omit to let Matias auto-increment (it exposes POST /auto-increment/invoices for that). |
| notes | string | optional | Optional free-text note printed on the invoice. |
| send_email | boolean | optional | true = Matias emails the buyer the invoice. Default false. |
| type_document_id | number | optional | DIAN document type id in Matias. Default 1 (Factura de Venta Nacional). Override only to match a different type in your Matias document catalog. |
| operation_type_id | number | optional | DIAN operation type id (tipo de operación). Default 10 (Estándar). |
| customer | object | required | Buyer / adquiriente. For a business use its NIT; for a final consumer you may use the DIAN generic consumer NIT 222222222222 with identity_document_id=6. |
| items | array | required | Line items. Each: { descripcion, cantidad, precioUnitario (COP integer, TAX-EXCLUSIVE / valor neto), iva? (19|5|0, default 19), codigo?, unidadMedida? (default 70=Unidad) }. |
Raw schema
{
"type": "object",
"properties": {
"resolution_number": {
"type": "string",
"description": "Your DIAN invoicing resolution number (número de resolución de facturación, issued by the DIAN to your account/prefix). REQUIRED — DIAN rejects an invoice whose number is outside an authorized resolución."
},
"prefix": {
"type": "string",
"description": "Invoice prefix authorized in your resolución, e.g. \"SETP\" or \"FE\". Optional if your resolución has no prefix."
},
"number": {
"type": "number",
"description": "Sequential invoice number within the resolución range, e.g. 990000001. Optional — omit to let Matias auto-increment (it exposes POST /auto-increment/invoices for that)."
},
"notes": {
"type": "string",
"description": "Optional free-text note printed on the invoice."
},
"send_email": {
"type": "boolean",
"description": "true = Matias emails the buyer the invoice. Default false."
},
"type_document_id": {
"type": "number",
"description": "DIAN document type id in Matias. Default 1 (Factura de Venta Nacional). Override only to match a different type in your Matias document catalog."
},
"operation_type_id": {
"type": "number",
"description": "DIAN operation type id (tipo de operación). Default 10 (Estándar)."
},
"customer": {
"type": "object",
"description": "Buyer / adquiriente. For a business use its NIT; for a final consumer you may use the DIAN generic consumer NIT 222222222222 with identity_document_id=6.",
"properties": {
"dni": {
"type": "string",
"description": "Buyer identification number (NIT without the check digit, or Cédula). e.g. 900123456. REQUIRED."
},
"company_name": {
"type": "string",
"description": "Buyer legal/full name (razón social or nombre). REQUIRED."
},
"identity_document_id": {
"type": "number",
"description": "DIAN identity-document type id: 6=NIT (business, default), 3=Cédula de ciudadanía, 5=Cédula de extranjería, 7=Pasaporte."
},
"email": {
"type": "string",
"description": "Optional buyer email (used when send_email=true)."
},
"merchant_registration": {
"type": "string",
"description": "Optional matrícula mercantil / responsabilidad tributaria code."
}
},
"required": [
"dni",
"company_name"
]
},
"items": {
"type": "array",
"minItems": 1,
"description": "Line items. Each: { descripcion, cantidad, precioUnitario (COP integer, TAX-EXCLUSIVE / valor neto), iva? (19|5|0, default 19), codigo?, unidadMedida? (default 70=Unidad) }.",
"items": {
"type": "object",
"properties": {
"descripcion": {
"type": "string",
"description": "Item description."
},
"cantidad": {
"type": "number",
"description": "Quantity (>0)."
},
"precioUnitario": {
"type": "number",
"description": "Unit price in COP (integer), TAX-EXCLUSIVE (before IVA / valor neto)."
},
"iva": {
"type": "number",
"enum": [
0,
5,
19
],
"description": "IVA rate: 19 standard, 5 reduced, 0 exento/excluido. Default 19."
},
"codigo": {
"type": "string",
"description": "Optional product code; defaults to a line index like \"IT-1\"."
},
"unidadMedida": {
"type": "number",
"description": "DIAN unit-of-measure code. Default 70 (Unidad)."
}
},
"required": [
"descripcion",
"cantidad",
"precioUnitario"
]
}
}
},
"required": [
"resolution_number",
"customer",
"items"
]
}