create_invoice
Issue an Argentina AFIP/ARCA electronic invoice (factura electrónica) and get the CAE (Código de Autorización Electrónico) via WSFE, through the Afip SDK. Bring your own Afip SDK access_token via header x-afipsdk-token (sign up free at app.afipsdk.com — 1000 requests/month). Header x-afip-mode: dev (default, no AFIP certificate needed — test CUIT 20409378472) or prod. Header x-afip-cuit: the 11-digit issuer CUIT (defaults to the test CUIT in dev). In prod, pass your AFIP X.509 certificate + private key per-request as afip_cert / afip_key (PEM strings) — they are forwarded to Afip SDK for this request only and never stored or logged. Give flat fields (invoice_type, point_of_sale, customer doc, line items with net_price + iva_rate) and this server COMPUTES the WSFE amounts: ImpNeto, ImpIVA (grouped AlicIva array), ImpTotal — IVA is discriminated for Factura A/B and not discriminated for Factura C (monotributo). The next invoice number is fetched automatically (FECompUltimoAutorizado) unless you pass invoice_number. Returns cae, cae_expiry and invoice_number.
Parameters11
| invoice_type | string | optional | Factura type: C (default, monotributo — IVA not discriminated, CbteTipo 11), B (final consumer, CbteTipo 6), A (registered VAT buyer, CbteTipo 1). A/B discriminate IVA per line. |
| point_of_sale | number | optional | Punto de venta (PtoVta) registered at AFIP for electronic invoicing. Default 1. |
| concept | string | optional | Concepto: PRODUCTS (default), SERVICES, or BOTH. |
| customer_doc_type | string | optional | Buyer document type: CUIT (80), DNI (96), or CF = Consumidor Final unidentified (99, doc number 0). Default CF for Factura B/C, CUIT for Factura A. |
| customer_doc_number | string | optional | Buyer document number (digits only). For CF use 0 or omit. Required (non-zero) for Factura A. |
| customer_iva_condition | number | optional | CondicionIVAReceptorId (AFIP RG 5616): 1 IVA Responsable Inscripto, 4 Exento, 5 Consumidor Final (default), 6 Responsable Monotributo. |
| currency | string | optional | Currency code (MonId). Default PES (Argentine peso). Use with foreign currency only if your AFIP setup allows it. |
| invoice_number | number | optional | Optional explicit invoice number (CbteDesde/Hasta). If omitted, the server queries FECompUltimoAutorizado and uses last+1. |
| afip_cert | string | optional | Optional AFIP X.509 certificate (PEM) for prod mode. Forwarded per-request to Afip SDK, never stored or logged. Not needed in dev. |
| afip_key | string | optional | Optional AFIP private key (PEM) for prod mode. Forwarded per-request to Afip SDK, never stored or logged. Not needed in dev. |
| items | array | required | Line items. Each: description, net_price (unit price in ARS, tax-EXCLUSIVE), optional quantity (default 1) and iva_rate (VAT percent: 0, 10.5, 21, 27; default 21; IGNORED for Factura C which does not discriminate IVA). |
Raw schema
{
"type": "object",
"properties": {
"invoice_type": {
"type": "string",
"enum": [
"A",
"B",
"C"
],
"description": "Factura type: C (default, monotributo — IVA not discriminated, CbteTipo 11), B (final consumer, CbteTipo 6), A (registered VAT buyer, CbteTipo 1). A/B discriminate IVA per line."
},
"point_of_sale": {
"type": "number",
"description": "Punto de venta (PtoVta) registered at AFIP for electronic invoicing. Default 1."
},
"concept": {
"type": "string",
"enum": [
"PRODUCTS",
"SERVICES",
"BOTH"
],
"description": "Concepto: PRODUCTS (default), SERVICES, or BOTH."
},
"customer_doc_type": {
"type": "string",
"enum": [
"CUIT",
"DNI",
"CF"
],
"description": "Buyer document type: CUIT (80), DNI (96), or CF = Consumidor Final unidentified (99, doc number 0). Default CF for Factura B/C, CUIT for Factura A."
},
"customer_doc_number": {
"type": "string",
"description": "Buyer document number (digits only). For CF use 0 or omit. Required (non-zero) for Factura A."
},
"customer_iva_condition": {
"type": "number",
"description": "CondicionIVAReceptorId (AFIP RG 5616): 1 IVA Responsable Inscripto, 4 Exento, 5 Consumidor Final (default), 6 Responsable Monotributo."
},
"currency": {
"type": "string",
"description": "Currency code (MonId). Default PES (Argentine peso). Use with foreign currency only if your AFIP setup allows it."
},
"invoice_number": {
"type": "number",
"description": "Optional explicit invoice number (CbteDesde/Hasta). If omitted, the server queries FECompUltimoAutorizado and uses last+1."
},
"afip_cert": {
"type": "string",
"description": "Optional AFIP X.509 certificate (PEM) for prod mode. Forwarded per-request to Afip SDK, never stored or logged. Not needed in dev."
},
"afip_key": {
"type": "string",
"description": "Optional AFIP private key (PEM) for prod mode. Forwarded per-request to Afip SDK, never stored or logged. Not needed in dev."
},
"items": {
"type": "array",
"minItems": 1,
"description": "Line items. Each: description, net_price (unit price in ARS, tax-EXCLUSIVE), optional quantity (default 1) and iva_rate (VAT percent: 0, 10.5, 21, 27; default 21; IGNORED for Factura C which does not discriminate IVA).",
"items": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"net_price": {
"type": "number",
"description": "Tax-exclusive unit price in ARS."
},
"quantity": {
"type": "number",
"description": "Default 1."
},
"iva_rate": {
"type": "number",
"description": "VAT rate percent: 0, 10.5, 21 (default), or 27. Ignored for Factura C."
}
},
"required": [
"description",
"net_price"
]
}
}
},
"required": [
"items"
]
}