Skip to main content
This endpoint submits a new electronic sales invoice to the Factus API, which in turn forwards it to the DIAN (Colombia’s tax authority) for real-time validation. Before forwarding the request, the backend validates the request body via validate_body() — checking that all required fields are present and have the correct types. It also auto-generates the reference_code (a 10-character alphanumeric key) and stamps numbering_range_id: 8; you must not include those fields in your request.

Endpoint

POST /factura

Request Body

The body must be a JSON object with the following top-level fields:
string
required
A free-text note to attach to the invoice. Maximum 249 characters. Longer strings are rejected with a 400 validation error.
number
required
Numeric ID of the payment method from the Factus payment_method catalogue (e.g., 10 for Efectivo).
object
required
Object describing the invoice recipient.
array
required
Array of one or more product or service line items. Each element is an object with the following fields:
Do not include reference_code or numbering_range_id in your request body. The backend’s validate_body() function auto-generates reference_code as a 10-character random key and hard-codes numbering_range_id to 8 before forwarding to Factus. Any values you send for those fields will be overwritten.

Response

200 — Success

Returns the full created invoice detail (identical shape to GET /factura/:number — see that page for the complete field reference).

400 — Bad Request (Validation Failed)

Returned when validate_body() finds missing or incorrectly-typed fields. The conflict object details what went wrong:
array
Names of required top-level fields that were absent from the request body.
array
Type mismatch errors. Each entry has property, type_require, and type_received.

409 — Conflict

Returned when the Factus API responds but with an unexpected status value (e.g., upstream validation failure).

500 — Internal Server Error

Two distinct shapes are possible: Shape A — upstream call failure (from request_fact internal catch):
Optional extra fields: message (Axios error message), code (Axios error code), error_name (error class name). Shape B — controller-level exception:
The messaje key (with a j) in Shape B is a known typo in the backend source. Shape A uses error as a plain string ("ERROR INTERNO").

Example Request Body

The example above omits reference_code and numbering_range_id intentionally — these are injected by the backend. If the Factus API returns a 409 despite a valid-looking request body, double-check that the payment_method_code, tribute_id, municipality_id, identification_document_id, and standard_code_id values exist in the Factus sandbox catalogues.

Example Response (200)

Code Examples