Skip to main content
POST
Emitir el DTE de una venta
Issues the DTE of a sale that already exists — for example one created without dte, or one whose DTE failed when it was created with POST /v1/ecommerce/sales.

Endpoint

Required scope

ecommerce:invoicing:issue
The scope comes from your role. Minting a token with ecommerce:invoicing:issue requires the permission to issue DTE in your Keebai role, unless you are the company owner or a superuser. See scopes.

Headers

Path parameters

Body

Example request

Response

200 OK

The call answers with what was issued and what failed. A DTE that cannot be issued comes back in failed with its reason, not as an HTTP error.
Failed

Failure reasons

400 Bad Request

The body does not match the schema, DUE_DATE_INVALID (due_date is not YYYY-MM-DD or is before today), or dte_issuer_missing: the company has not registered its DTE issuer yet. That is configured in the portal.

401 Unauthorized

Missing, invalid, revoked, or expired token.

403 Forbidden

The token does not have the ecommerce:invoicing:issue scope.

404 Not Found

No sale with that id, or it belongs to a different company.

422 Unprocessable Entity

RECEIVER_DATA_REQUIRED — the invoice receiver is incomplete and the RUT has no stored data to fill it. missing lists the fields. Nothing is issued.

502 Bad Gateway

ECOMMERCE_UPSTREAM_ERROR — the ecommerce service could not answer.

Operational notes

  • Branch on failed, not only on the status. A request that did not issue anything can still succeed at the HTTP level.
  • already_issued makes retries safe. Calling again for a sale that already has its DTE does not issue a second one; it comes back in failed with that reason.
  • Check the documents first. GET /v1/ecommerce/invoicing/types tells you which document values the company can issue today and whether it allows credit invoices.
  • Invoices can go on credit. With credit invoices enabled in Sales › Settings, an invoice on a sale that is not fully paid is issued as a credit invoice with its due date. Record the payment later from the Keebai portal or with the MCP tool keebai_ecommerce_sale_payment_add.
  • Read the issued documents with GET /v1/ecommerce/sales/{id}/documents.

Authorizations

Authorization
string
header
required

Personal Access Token con prefijo kbai_pk_. Generar desde el portal con permiso developer.manage_tokens.

Path Parameters

id
string
required

Body

application/json
document
enum<string>
required

invoice (factura), exempt_invoice (factura exenta), receipt (boleta), exempt_receipt (boleta exenta). La factura exige receiver; con un RUT ya facturado basta receiver.rut

Available options:
invoice,
exempt_invoice,
receipt,
exempt_receipt
due_date
string

Vencimiento (YYYY-MM-DD) de una factura emitida a crédito, sobre una venta que no está pagada completa. Sin él, hoy más los días configurados en la empresa. Se ignora si la venta está pagada

Example:

"2026-12-10"

receiver
object
save_receiver
boolean

Guarda el receptor en el cliente para la próxima factura

Response

200 - application/json
issued
object[]
required
failed
object[]
required