/api/peru/cpe/drafts
Requiere Bearer JWT. Envíe el JSON de factura en la raíz, sin documentType, sin payload y sin indicar una factura existente. No requiere Idempotency-Key: cada solicitud crea un borrador y un folio nuevos. No genera XML, ZIP o CDR y no se comunica con SUNAT. El PDF temporal se solicita por separado. La sección de referencias sólo aparece cuando se envían elementos en references[]; purchaseOrder por sí solo no se imprime.
curl -X POST "https://facturador-peru.bheed.net/api/peru/cpe/drafts" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $BHEED_SUNAT_TOKEN" \
-d '{
"series": "F001",
"currency": "PEN",
"operationType": "0101",
"customer": {
"documentType": "6",
"documentNumber": "20123456789",
"legalName": "CLIENTE SAC",
"addressCode": "0000"
},
"payment": { "method": "CONTADO" },
"items": [{
"sku": "SAAS-001",
"description": "Servicio SaaS mensual",
"quantity": "1",
"unitCode": "NIU",
"unitValue": "100.00",
"tax": { "type": "IGV", "affectationCode": "10", "rate": "18.00" }
}]
}'
{
"id": "49e8d90a-ff2a-4fc9-8a02-ed8a7afb4f09",
"folio": "BOR-01-5A67D449C1",
"documentType": "invoice",
"documentTypeCode": "01",
"status": "DRAFT",
"isDraft": true,
"tributaryValidity": false,
"sentToSunat": false,
"externalReference": null,
"payload": {
"series": "F001",
"currency": "PEN",
"customer": {
"documentType": "6",
"documentNumber": "20123456789",
"legalName": "CLIENTE SAC"
},
"items": [{ "sku": "SAAS-001", "description": "Servicio SaaS mensual" }]
},
"createdAt": "2026-09-08T12:00:00.000Z",
"updatedAt": "2026-09-08T12:00:00.000Z",
"message": "Borrador creado. No fue emitido ni enviado a SUNAT."
}
Título tributario: cuando todas las líneas usan affectationCode: "20", tanto el borrador como el PDF emitido se identifican como FACTURA ELECTRONICA EXONERADA. En una factura mixta se conserva el título general y se separan los importes en los totales.
Contrato: usa el mismo esquema Zod de POST /api/peru/cpe/invoices. El tipo se fija internamente como factura 01; el prefijo BOR- evita confundir el folio con un número fiscal.