Skip to main content

Invoice (01)

The Invoice (type 01) is issued to final consumers — individuals without NRC, or customers that do not require tax credit. It is the most common DTE type in retail, restaurants, and public services.

Technical details

MethodPOST
URLhttps://ocote.io/api/connect/invoice
Content-Typeapplication/json
AuthenticationHeader Authorization: Bearer odt_...

Request

Main fields

FieldTypeRequiredDescription
doc_typestringNo (default "01")DTE type. For Invoice: "01".
linesarrayYesDocument lines. At least one. See LineIn.
customerobjectNoCustomer data. Optional for Invoice 01. See CustomerIn.
customer_namestringNoConsumer name for invoices without a customer object. Default: "Consumidor Final".
payment_methodstringNo (default "01")Payment method. See MH catalogs.
transaction_conditionintNo (default 1)1 = Cash, 2 = Credit, 3 = Other.
deadlineintNo (default 1)Credit term unit (MH CAT-018): 1 = Days, 2 = Months, 3 = Years. Only applies to transaction_condition: 2.
periodintNo (default 1)Numeric amount of the term. E.g., deadline: 1, period: 30 = 30 days; deadline: 2, period: 2 = 2 months. Only applies to transaction_condition: 2.
activity_codestringNoIssuer economic activity code for this document. Overrides company default.
redirect_emailstringNoAdditional email to which a copy is sent (besides customer.email).
external_refstringNoYour idempotent identifier. See Retry and idempotency.

Lines (lines)

FieldTypeRequiredDescription
descriptionstringYesProduct/service description. Max 1,000 characters.
quantityfloatYesQuantity. Must be greater than zero.
unit_pricefloatYesUnit price VAT included. Must be greater than zero.
discount_percentagefloatNo (default 0)Discount percentage (0–99).

Customer (customer)

Fully optional on Invoice 01. If you omit it or send it incomplete, Ocote applies sensible defaults:

FieldTypeRequiredDefault (on create)Description
namestringYes (if you send customer)Name or business name.
nitstringNoCustomer NIT (if applicable).
nrcstringNoCustomer NRC (only if VAT contributor).
duistringNoDUI for individuals.
document_typestringNo"37"MH identifier document type.
type_contributorintNo1 (Small)Contributor type. See Conventions.
favorite_docstringNo"01"Customer's preferred DTE type.
addressstringNo"San Salvador"Address.
activity_codestringNoCustomer economic activity code.
districtstringNoDistrict UUID — look it up in /catalogs/districts/search. If sent, department and municipality are ignored. Recommended flow because you don't deal with MH codes.
departmentstringNoMH department code. See MH catalogs. If you send it, municipality is also required. Ignored if district is provided.
municipalitystringNoMH municipality code. Accepts short format ("24") or long format ("1124") — see MH catalogs. Ignored if district is provided.
emailstringNoEmail address for DTE delivery.
phonestringNoPhone.
New vs existing customers

If customer.nit (or customer.dui) already exists in your Ocote company, the API only updates the fields you explicitly sent. If it does not exist, it creates the customer with the defaults from the table above. Sensitive fiscal fields (type_contributor, favorite_doc, document_type, nit, nrc, dui) are audited in Ocote's internal log when they change.

Response

See Responses and states for the full flags semantics. /invoice-specific fields:

FieldTypeDescription
document_idstring (UUID)Internal Ocote identifier.
external_refstringThe one you sent (or auto-generated).
control_numberstringMH DTE correlative. Never regenerated.
generation_codestringMH generation code (same as UUID in uppercase).
reception_stampstringMH reception stamp. Empty if contingency: true or rejected: true.
amount_taxablefloatTaxable base (price without VAT).
amount_vatfloatVAT 13%.
amount_grossfloatVAT-included total, before withholding.
amount_retentionfloat1% VAT withholding (applies only if recipient is type_contributor 3 or 4 and amount_taxable >= 100).
amount_totalfloatNet total = amount_gross − amount_retention.
ticket_urlstringURL to the thermal PDF ticket (8×21 cm). Available once the document was processed (is_dte: true). Only for Invoice 01.
invoice_urlstringURL to the letter-sized PDF. Only if dte_success: true.
json_urlstringURL to signed JSON. Only if dte_success: true.
dteobjectFull signed DTE schema (only if dte_success: true).

Minimal example: simple sale

curl
curl -X POST https://ocote.io/api/connect/invoice \
-H "Authorization: Bearer odt_xxx" \
-H "Content-Type: application/json" \
-d '{
"external_ref": "SALE-2026-0042",
"lines": [
{ "description": "Americano coffee", "quantity": 2, "unit_price": 2.50 },
{ "description": "Chicken empanada", "quantity": 1, "unit_price": 3.00 }
]
}'
Node.js (axios)
const { data } = await axios.post(
'https://ocote.io/api/connect/invoice',
{
external_ref: 'SALE-2026-0042',
lines: [
{ description: 'Americano coffee', quantity: 2, unit_price: 2.50 },
{ description: 'Chicken empanada', quantity: 1, unit_price: 3.00 },
],
},
{ headers: { Authorization: `Bearer ${process.env.OCOTE_API_KEY}` } }
);
Python (requests)
r = requests.post(
"https://ocote.io/api/connect/invoice",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"external_ref": "SALE-2026-0042",
"lines": [
{"description": "Americano coffee", "quantity": 2, "unit_price": 2.50},
{"description": "Chicken empanada", "quantity": 1, "unit_price": 3.00},
],
},
)

Full example: with customer and credit terms

curl
curl -X POST https://ocote.io/api/connect/invoice \
-H "Authorization: Bearer odt_xxx" \
-H "Content-Type: application/json" \
-d '{
"external_ref": "SALE-2026-0043",
"customer": {
"name": "Juan Pérez",
"dui": "01234567-8",
"email": "juan@example.com",
"phone": "2222-3333",
"address": "Colonia Escalón, San Salvador"
},
"lines": [
{
"description": "Marketing consulting - 8 hours",
"quantity": 8,
"unit_price": 50.00,
"discount_percentage": 10
}
],
"payment_method": "05",
"transaction_condition": 2,
"deadline": 1,
"period": 30,
"redirect_email": "accounting@mycompany.com"
}'

payment_method: "05" = Transfer. transaction_condition: 2 = Credit. deadline: 1, period: 30 = 30 days of credit. See MH catalogs for the full list of codes.

Successful response

{
"success": true,
"dte_success": true,
"contingency": false,
"rejected": false,
"posted": true,
"is_duplicate": false,

"document_id": "a1b2c3d4-1234-5678-9abc-def012345678",
"external_ref": "SALE-2026-0042",
"control_number": "DTE-01-M001P001-000000000000123",
"generation_code": "A1B2C3D4-1234-5678-9ABC-DEF012345678",
"reception_stamp": "20260421154532...",

"amount_taxable": 7.96,
"amount_vat": 1.04,
"amount_gross": 9.00,
"amount_retention": 0.00,
"amount_total": 9.00,

"ticket_url": "https://ocote.io/api/connect/file/a1b2c3d4-1234-5678-9abc-def012345678?type=ticket",
"invoice_url": "https://ocote.io/api/connect/file/a1b2c3d4-1234-5678-9abc-def012345678?type=invoice",
"json_url": "https://ocote.io/api/connect/file/a1b2c3d4-1234-5678-9abc-def012345678?type=json"
}

Specific validation errors

HTTP 400 with the detail field populated:

MessageCause
doc_type debe ser uno de: 01, 03, 11Invalid doc_type value.
Debe incluir al menos una línealines empty or absent.
Línea N: cantidad debe ser mayor a ceroSome item has quantity <= 0.
Línea N: precio unitario debe ser mayor a ceroSome item has unit_price <= 0.
Línea N: descripción es requeridaEmpty description.
Departamento/municipio no encontrado: X/Ydepartment/municipality combination does not exist in the MH catalog.

Error messages are returned in Spanish — the language MH operates in.

See also

  • Conventions — VAT-included pricing, timezone, enumerated values.
  • CCF (03) — issuance to VAT contributors with NIT and NRC.
  • Wildcard items — how the internal catalog works and automatic withholding.
  • MH catalogs — activity, department, municipality, payment method codes.
  • Responses and states — full response semantics.