create_invoice
Issue an Ecuador electronic invoice (factura electrónica) through Datil, stamped against the SRI with the merchant's own signing certificate. Bring your own Datil credentials via headers x-datil-key (API key) and x-datil-password (your .p12 certificate password). IMPORTANT: defaults to the SRI TEST environment (ambiente 1, no fiscal effect). To emit a REAL invoice you MUST pass environment:"production" (or the owner may set header x-datil-mode:production). Amounts are in US dollars (2 decimals). Each item price is NET; IVA (15% by default, or 0%) is added on top. The emisor (your company RUC, razón social, address, establecimiento/punto de emisión, secuencial) is passed by you — Datil signs and transmits to the SRI. Returns id, clave_acceso and estado.
Parameters18
| environment | string | optional | SRI environment. "test" (default) = ambiente 1, a sandbox invoice with NO fiscal/legal effect. "production" = ambiente 2, a REAL invoice transmitted to the SRI. You must set this to "production" explicitly to bill a real customer. |
| emisor_ruc | string | required | Your company RUC — exactly 13 digits (cédula + 001). REQUIRED. This is the issuing taxpayer registered in your Datil account. |
| emisor_razon_social | string | required | Your company legal name (razón social). REQUIRED. |
| emisor_direccion | string | required | Your establishment (matriz) street address. REQUIRED by the SRI. |
| emisor_nombre_comercial | string | optional | Your trade name (nombre comercial). Optional; defaults to the razón social. |
| establecimiento | string | optional | Establishment code, 3 digits (e.g. "001"). Default "001". |
| punto_emision | string | optional | Emission point code, 3 digits (e.g. "001"). Default "001". |
| secuencial | string | required | Sequential invoice number (1–999999999) for this establecimiento/punto_emision. REQUIRED and must be unique/monotonic — you manage it (the SRI rejects duplicates). |
| obligado_contabilidad | string | optional | Whether you are required to keep accounting records. Default "NO". |
| customer_identification | string | optional | Buyer ID number. For a RUC use 13 digits, cédula 10 digits, passport free text. Optional — defaults to the generic final consumer 9999999999999. |
| customer_identification_type | string | optional | Buyer ID type (SRI codes: cedula=05, ruc=04, pasaporte=06, consumidor_final=07). Default consumidor_final. |
| customer_name | string | optional | Buyer name / razón social. Default "CONSUMIDOR FINAL". |
| customer_email | string | optional | Buyer email (Datil emails them the invoice if provided). Optional. |
| customer_address | string | optional | Buyer address. Optional. |
| customer_phone | string | optional | Buyer phone. Optional. |
| currency | string | optional | Currency label sent to the SRI. Default "DOLAR" (Ecuador uses USD). |
| payment_method | string | optional | SRI forma de pago code (tabla 24), e.g. "01" cash, "16" debit card, "19" credit card, "20" other via financial system. Default "01". |
| items | array | required | Line items. Each: description, price (NET unit price in USD), optional quantity (default 1), optional tax_rate (15 or 0; default 15). |
Raw schema
{
"type": "object",
"properties": {
"environment": {
"type": "string",
"enum": [
"test",
"production"
],
"description": "SRI environment. \"test\" (default) = ambiente 1, a sandbox invoice with NO fiscal/legal effect. \"production\" = ambiente 2, a REAL invoice transmitted to the SRI. You must set this to \"production\" explicitly to bill a real customer."
},
"emisor_ruc": {
"type": "string",
"description": "Your company RUC — exactly 13 digits (cédula + 001). REQUIRED. This is the issuing taxpayer registered in your Datil account."
},
"emisor_razon_social": {
"type": "string",
"description": "Your company legal name (razón social). REQUIRED."
},
"emisor_direccion": {
"type": "string",
"description": "Your establishment (matriz) street address. REQUIRED by the SRI."
},
"emisor_nombre_comercial": {
"type": "string",
"description": "Your trade name (nombre comercial). Optional; defaults to the razón social."
},
"establecimiento": {
"type": "string",
"description": "Establishment code, 3 digits (e.g. \"001\"). Default \"001\"."
},
"punto_emision": {
"type": "string",
"description": "Emission point code, 3 digits (e.g. \"001\"). Default \"001\"."
},
"secuencial": {
"type": "string",
"description": "Sequential invoice number (1–999999999) for this establecimiento/punto_emision. REQUIRED and must be unique/monotonic — you manage it (the SRI rejects duplicates)."
},
"obligado_contabilidad": {
"type": "string",
"enum": [
"SI",
"NO"
],
"description": "Whether you are required to keep accounting records. Default \"NO\"."
},
"customer_identification": {
"type": "string",
"description": "Buyer ID number. For a RUC use 13 digits, cédula 10 digits, passport free text. Optional — defaults to the generic final consumer 9999999999999."
},
"customer_identification_type": {
"type": "string",
"enum": [
"cedula",
"ruc",
"pasaporte",
"consumidor_final"
],
"description": "Buyer ID type (SRI codes: cedula=05, ruc=04, pasaporte=06, consumidor_final=07). Default consumidor_final."
},
"customer_name": {
"type": "string",
"description": "Buyer name / razón social. Default \"CONSUMIDOR FINAL\"."
},
"customer_email": {
"type": "string",
"description": "Buyer email (Datil emails them the invoice if provided). Optional."
},
"customer_address": {
"type": "string",
"description": "Buyer address. Optional."
},
"customer_phone": {
"type": "string",
"description": "Buyer phone. Optional."
},
"currency": {
"type": "string",
"description": "Currency label sent to the SRI. Default \"DOLAR\" (Ecuador uses USD)."
},
"payment_method": {
"type": "string",
"description": "SRI forma de pago code (tabla 24), e.g. \"01\" cash, \"16\" debit card, \"19\" credit card, \"20\" other via financial system. Default \"01\"."
},
"items": {
"type": "array",
"minItems": 1,
"description": "Line items. Each: description, price (NET unit price in USD), optional quantity (default 1), optional tax_rate (15 or 0; default 15).",
"items": {
"type": "object",
"properties": {
"description": {
"type": "string",
"description": "Item description (descripcion)."
},
"price": {
"type": "number",
"description": "NET unit price in USD (2 decimals). IVA is added on top."
},
"quantity": {
"type": "number",
"description": "Default 1."
},
"tax_rate": {
"type": "number",
"enum": [
0,
15
],
"description": "IVA rate for this item: 15 (default) or 0 (exempt/zero-rated)."
}
},
"required": [
"description",
"price"
]
}
}
},
"required": [
"emisor_ruc",
"emisor_razon_social",
"emisor_direccion",
"secuencial",
"items"
]
}