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 viaDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tutosrive/factus_challenge/llms.txt
Use this file to discover all available pages before exploring further.
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:A free-text note to attach to the invoice. Maximum 249 characters. Longer strings are rejected with a
400 validation error.Numeric ID of the payment method from the Factus
payment_method catalogue (e.g., 10 for Efectivo).Object describing the invoice recipient.
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 toGET /factura/:number — see that page for the complete field reference).
400 — Bad Request (Validation Failed)
Returned whenvalidate_body() finds missing or incorrectly-typed fields. The conflict object details what went wrong:
Names of required top-level fields that were absent from the request body.
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 (fromrequest_fact internal catch):
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").