Saltar al contenido principal

Enviar tu primera factura

cURL

curl -X POST https://sandbox.api.erply.pro/v1/invoices \
-H "Authorization: Bearer $ERPLYPRO_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d @invoice.json

invoice.json:

{
"tenantId": "demo-rnc-131000001",
"ecfType": "31",
"encf": "E310000000001",
"issueDate": "2026-05-01",
"buyer": { "rnc": "131000002", "name": "Cliente Demo S.R.L." },
"lines": [
{ "description": "Servicio", "qty": 1, "unitPrice": 5000.00, "taxRate": 0.18 }
],
"subtotal": 5000.00,
"tax": 900.00,
"grandTotal": 5900.00
}

Python

import os, uuid, requests

resp = requests.post(
"https://sandbox.api.erply.pro/v1/invoices",
headers={
"Authorization": f"Bearer {os.environ['ERPLYPRO_API_KEY']}",
"Content-Type": "application/json",
"Idempotency-Key": str(uuid.uuid4()),
},
json={...},
timeout=10,
)
print(resp.status_code, resp.json())

Respuesta esperada

{
"docId": "01HW9X4G…",
"trackId": "20260501-DGII-9988",
"status": "pending",
"_links": {
"self": "/v1/invoices/01HW9X4G…",
"status": "/v1/invoices/01HW9X4G…/status"
}
}

Polling vs webhook

  • Polling: GET /v1/invoices/{docId}/status cada 30 s hasta que status sea accepted o rejected.
  • Webhook (recomendado): ERPly Pro te llama tan pronto DGII responde. Verifica la firma HMAC X-ErplyPro-Signature (ventana ±300 s).

¿Recibiste un error? Salta al paso 4.