Skip to main content
POST
Create sale (v2)

Authorizations

X-API-Key
string
header
required

Integration API Key (Integrations → New Integration).

Headers

Idempotency-Key
string

Optional. Unique key per operation (max. 120 characters; more than 120 returns 422 validation_error). Valid for 24 h per integration. A retry with the same key and the same body returns the original response (same code and body) with the header Idempotent-Replay: true, without issuing again. With a different body or endpoint it returns 422 idempotency_key_reused; while the first request is still in progress, 409 idempotency_in_progress. Only 2xx and 422 responses are stored; a 5xx, 401, 403, 404 or 429 error is not stored and can be retried with the same key.

Maximum string length: 120

Body

application/json
branch_id
string<uuid>
required

Issuing branch (GET /branches).

customer_id
string<uuid>
required

Receiving customer.

document_type
enum<string>
required

SV: fc, ccf, fex, nc, nd, nr. US: inv, cm, dm.

Available options:
fc,
ccf,
fex,
nc,
nd,
nr,
inv,
cm,
dm
payment_details
object[]
required
products
object[]
required
date
string

ISO 8601 date and time. Default: now.

observation
string

Notes.

is_credit
boolean

Credit sale.

credit_days
integer

Credit days.

project_id
string<uuid>

Associated project.

point_of_sale_id
string<uuid>

Issuing point of sale (of the branch and active). Default: the branch's default.

cost_center_id
string<uuid>

Cost center of the sale (leaf and active; GET /accounting/cost-centers). Applied to income lines when posting.

incoterm_id
string<uuid>

Incoterm (export).

totals
object

Calculated mode: if totals.saleTotalToPayment is omitted, the server calculates line amounts, taxes, withholdings and totals; only quantity, price before taxes, discount and tax_ids are needed. Not available for fc (totals_required).

cost_center_distribution_id
string<uuid> | null

Active distribution (GET /accounting/cost-center-distributions): income is split among its centers by percentage. Mutually exclusive with cost_center_id at the same level (422 Indique centro de costo o distribución, no ambos.).

country_data
object

Country-specific fields of the branch's country for this document (for example, in Guatemala those of fcam, nabn, ncre, ndeb and nev). Must be an object, not a list. Its schema per document type is in adapter.country_data_schema of GET /v2/countries/{code}. It is validated before transmission, and only if the business has electronic invoicing active; an invalid field returns 422 country_data_invalid. In Guatemala the alias gt is also accepted; if both are sent, country_data prevails. El Salvador does not use country_data.

currency_code
string

Document currency (3 letters, for example GTQ). Must be active for the business (GET /v2/currencies). If omitted or equal to the base currency, the document is in base currency. All amounts are in this currency.

Required string length: 3
exchange_rate
number

Units of base currency per 1 unit of currency_code. If omitted, the rate in effect on the document date is used.

Required range: x > 0

Response

Document issued