Skip to main content

Send your first invoice

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 (canonical body — see tests/fixtures/quickstart_invoice_request.json in the repo):

{
"type": "31",
"encf": "E310000000001",
"client_request_id": "req-2026-05-01-001",
"company": { "rnc": "131000001", "name": "ERPly Pro Demo S.R.L." },
"customer": { "rnc": "131000002", "name": "Cliente Demo S.R.L." },
"lines": [
{
"line_number": 1,
"description": "Servicio de consultoria",
"quantity": "1",
"unit_price": "5000.00",
"subtotal": "5000.00"
}
],
"totals": { "subtotal": "5000.00", "tax": "900.00", "grand_total": "5900.00" }
}
Tenant identity

tenantId does not belong in the body. It is derived from the tenant_id / environment claims of the JWT in Authorization. This prevents a leaked API key from being used to issue invoices against a different tenant.

Python

import os, uuid, requests

payload = {
"type": "31",
"encf": "E310000000001",
"client_request_id": "req-2026-05-01-001",
"company": {"rnc": "131000001", "name": "ERPly Pro Demo S.R.L."},
"customer": {"rnc": "131000002", "name": "Cliente Demo S.R.L."},
"lines": [
{
"line_number": 1,
"description": "Servicio de consultoria",
"quantity": "1",
"unit_price": "5000.00",
"subtotal": "5000.00",
}
],
"totals": {"subtotal": "5000.00", "tax": "900.00", "grand_total": "5900.00"},
}

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=payload,
timeout=10,
)
print(resp.status_code, resp.json())

Expected response

{
"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 every 30 s until status is accepted or rejected.
  • Webhook (recommended): ERPly Pro calls you as soon as DGII responds. Verify the HMAC signature X-ErplyPro-Signature (±300 s window).

Got an error? Jump to step 4.