Create an Order

Creates an order in the authenticated tenant. Use it for sales that don't come from a connected channel: phone sales, counter sales without a POS, integrations with your own ERP, or historical migrations from another platform.

Don't manually create orders from a connected channel

If the order already exists in Shopify, Amazon, MercadoLibre or another connected channel, Fenicia syncs it on its own. Creating it by hand duplicates the order and throws inventory off.

Creates an order. The entire body is nested inside the order property.

{
  "order": {
    "externalId": "FEN-10042",
    "handle": "fen-10042",
    "locationId": "65f2a1b2c4d5e6f7a8b9c0aa",
    "origin": "manual",
    "channelId": "65f2a1b2c4d5e6f7a8b9c0bb",
    "orderStatus": "new",
    "paymentStatus": "paid",
    "currency": "MXN",
    "totalAmount": 1986.26,
    "orderCreated": "2026-04-11T14:23:11.000Z",
    "items": [
      { "sku": "CAM-ROJO-M", "title": "Camisa Roja Talla M", "quantity": 2, "totalAmount": 998.00 }
    ],
    "customerInfo": { "name": "María González" }
  }
}
201Order created
{
  "data": {
    "_id": "65f3a1b2c4d5e6f7a8b9c0d1",
    "externalId": "FEN-10042",
    "handle": "fen-10042",
    "locationId": "65f2a1b2c4d5e6f7a8b9c0aa",
    "origin": "manual",
    "channelId": "65f2a1b2c4d5e6f7a8b9c0bb",
    "orderStatus": "new",
    "paymentStatus": "paid",
    "currency": "MXN",
    "totalAmount": 1986.26,
    "orderCreated": "2026-04-11T14:23:11.000Z",
    "items": [
      { "sku": "CAM-ROJO-M", "title": "Camisa Roja Talla M", "quantity": 2, "totalAmount": 998.00 }
    ],
    "customerInfo": { "name": "María González" },
    "_links": {
      "self": "/orders/65f3a1b2c4d5e6f7a8b9c0d1",
      "attachments": "/orders/65f3a1b2c4d5e6f7a8b9c0d1/attachments",
      "activityLog": "/orders/65f3a1b2c4d5e6f7a8b9c0d1/activity-log",
      "validTransitions": "/orders/65f3a1b2c4d5e6f7a8b9c0d1/valid-transitions",
      "accept": "/orders/65f3a1b2c4d5e6f7a8b9c0d1/accept",
      "reject": "/orders/65f3a1b2c4d5e6f7a8b9c0d1/reject",
      "cancel": "/orders/65f3a1b2c4d5e6f7a8b9c0d1/cancel"
    }
  }
}
400The order envelope is missing
{ "error": { "code": "validation:invalid_input", "message": "order object is required" } }
400Unknown key inside order
{
  "error": {
    "code": "validation:invalid_input",
    "message": "Validation failed: createOrder: Unrecognized key(s) in object: 'payments'",
    "details": {
      "errors": [
        {
          "field": "createOrder",
          "message": "Unrecognized key(s) in object: 'payments'"
        }
      ]
    }
  }
}
curl -X POST https://api.fenicia.io/orders \
  -H "Authorization: Bearer $FENICIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "order": {
      "externalId": "FEN-10042",
      "handle": "fen-10042",
      "locationId": "65f2a1b2c4d5e6f7a8b9c0aa",
      "origin": "manual",
      "channelId": "65f2a1b2c4d5e6f7a8b9c0bb",
      "orderStatus": "new",
      "paymentStatus": "paid",
      "currency": "MXN",
      "totalAmount": 1986.26,
      "orderCreated": "2026-04-11T14:23:11.000Z",
      "items": [
        { "sku": "CAM-ROJO-M", "title": "Camisa Roja Talla M", "quantity": 2, "totalAmount": 998.00 }
      ],
      "customerInfo": { "name": "María González" }
    }
  }'

Returns the created order, wrapped in data. The _links it carries depend on the resulting orderStatus — they are the actions valid from that state, per the state machine.

Required permission: orders:create

Parameters

orderobjectrequired

Required envelope: THE ENTIRE order goes inside it. Properties you place outside order raise no error, but they are ignored and not stored.

order.externalIdstringrequired

The order's identifier in your source system. Cannot be empty.

order.handlestringrequired

Human-readable handle or folio for the order. Cannot be empty.

order.locationIdstringrequired

ID of the location (warehouse or store) fulfilling the order. Cannot be empty.

order.originstringrequired

Sales origin. For orders captured through the API it is usually 'manual'. Cannot be empty.

order.channelIdstringrequired

ID of the sales channel the order belongs to. Cannot be empty.

order.orderStatusstringrequired

Initial status. Must be a valid state from the state machine; 'pending' is the usual one when capturing. Accepted values: draft, new, accepted, cancelled, rejected, processing, packaging, picking, pickup-pending, in-transit, fulfilled, delivered, returned, partially-fulfilled, partially-delivered, not-delivered, exception.

order.paymentStatusstringrequired

Payment status at the time the order is created. Accepted values: paid, pending, processing, captured, refunded, settled, voided, authorized, partially_paid.

order.currencystringrequired

ISO 4217 code of exactly 3 letters: MXN, USD, EUR.

order.totalAmountnumberrequired

Total order amount. Must be greater than or equal to 0.

order.orderCreatedstring (ISO 8601)required

Original creation date of the order, with offset (for example the trailing Z). When migrating history, it is the real sale date, not the request date.

order.itemsarrayrequired

Order lines. Must carry at least one. Accepts keys beyond the documented ones: it does not reject them, but it does not validate them either.

order.items.skustringrequired

Product SKU. Cannot be empty.

order.items.titlestringrequired

Line name. Cannot be empty.

order.items.quantitynumberrequired

Quantity sold. Integer greater than 0.

order.items.totalAmountnumberrequired

Total amount for the line — not the unit price. Greater than or equal to 0.

order.customerInfoobjectrequired

Customer data. Accepts additional keys, but only 'name' is validated.

order.customerInfo.namestringrequired

Customer name. Cannot be empty.

order.customerIdstring

ID of an existing customer in your CRM.

order.notesstring

Internal notes, visible only to your team. Free-form field: do not put card data or sensitive cardholder data here.

order.tagsstring[]

Not persisted in this version of the API. To classify orders, use metafields.

order.discountsarrayestructura libre

Not persisted in this version of the API. Reflect the discount in `totalAmount`, which is the amount the order stores.

order.subtotalnumber

Not persisted in this version of the API. The only amount this endpoint stores is `totalAmount`.

order.taxnumber

Not persisted in this version of the API. The only amount this endpoint stores is `totalAmount`.

order.shippingnumber

Not persisted in this version of the API. The only amount this endpoint stores is `totalAmount`.

order.paymentobject

Payment information. Unlike the other subobjects, this one is STRICT: a key not in this list rejects the request. Mind the name: it is 'payment', singular.

order.payment.methodenumrequired

One of: cash, credit-card, debit-card, prepaid-card, bank-transfer, digital-wallet, voucher, store-credit, marketplace-balance, other, unknown.

order.payment.sourceMethodstring

Method as reported by the source channel.

order.payment.brandstring

Card brand, for example visa.

order.payment.bankstring

Issuing bank.

order.payment.lastFourstring

Last 4 digits. Never send the full number or the CVV: Fenicia does not store data subject to PCI DSS and the schema would reject them.

order.payment.installmentsnumber

Number of installments. Integer greater than or equal to 0.

order.payment.amountnumber

Amount paid. Greater than or equal to 0.

order.payment.currencystring

Payment currency.

order.payment.statusstring

Payment status.

order.payment.transactionIdstring

Transaction ID at the gateway.

order.payment.authorizationCodestring

Authorization code.

order.payment.paidAtstring (ISO 8601)

Payment date and time. ISO 8601 is the recommended format; the validator also admits other recognizable date formats.

order.paymentSummaryobjectestructura libre

Not stored. The validator imposes no structure (passthrough) and the order has no paymentSummary field. The payment object Fenicia does model is payment (above in this list) — use that one if you need the method, amount, or payment status to be saved.

order.deliveryInfoobject

Delivery information. The validator imposes no structure at this endpoint (passthrough), but the order model does recognize a concrete shape — use these fields so the data is saved predictably. It also accepts a flat address format not nested under address, Shopify-style: country, firstName, lastName, streetAddress, zipCode, city, state, phoneNumber, company. The model additionally tracks fields managed by the shipping flow (shipments[], trackingHistory, deliveredAt, pickupDate, shippingStatus, canDownloadLabel, logisticType) that are not meant to be populated by hand at order creation.

order.deliveryInfo.carrierstring

Carrier or shipping company. Feeds the order-by-carrier filter. Accepted values: fedex, dhl, ups, estafeta, redpack, 99minutos, other. If your carrier is not on the list, send `other` and put its name in `carrierName`. Do not send `manual`, `automatic`, `automatica` or similar: those are capture modes —how the label was obtained—, not carriers, and the API rejects them.

order.deliveryInfo.trackingUrlstring

Shipment tracking URL.

order.deliveryInfo.addressobject

Delivery address. Same shape as billingAddress (see below).

order.deliveryInfo.address.companyNamestring

Company name, if applicable.

order.deliveryInfo.address.addressLine1string

Street and number.

order.deliveryInfo.address.addressLine2string

Apartment, suite, or other line-2 reference.

order.deliveryInfo.address.neighborhoodstring

Neighborhood (used for Mexican addresses, SEPOMEX).

order.deliveryInfo.address.citystring

City.

order.deliveryInfo.address.provincestring

State or province (name).

order.deliveryInfo.address.provinceCodestring

State or province code.

order.deliveryInfo.address.statestring

State — duplicate field of province that the model also accepts.

order.deliveryInfo.address.countryNamestring

Country name.

order.deliveryInfo.address.countryCodestring

Country code.

order.deliveryInfo.address.zipCodestring

ZIP / postal code.

order.deliveryInfo.address.referencesstring

Additional delivery references.

order.deliveryInfo.contactInfoobject

Contact details for the delivery.

order.deliveryInfo.contactInfo.fullNamestring

Contact's full name.

order.deliveryInfo.contactInfo.firstNamestring

First name.

order.deliveryInfo.contactInfo.lastNamestring

Last name.

order.deliveryInfo.contactInfo.emailstring

Contact's email.

order.deliveryInfo.contactInfo.phoneNumberstring

Contact's phone number.

order.deliveryInfo.estimatedDeliveryDatestring (ISO 8601)

Estimated delivery date.

order.billingAddressobject

Billing address. The validator imposes no structure at this endpoint (passthrough), but the order model does recognize a concrete shape — use these fields so the data is saved predictably.

order.billingAddress.companyNamestring

Company name.

order.billingAddress.addressLine1string

Street and number.

order.billingAddress.addressLine2string

Apartment, suite, or other line-2 reference.

order.billingAddress.neighborhoodstring

Neighborhood (Mexican addresses, SEPOMEX).

order.billingAddress.citystring

City.

order.billingAddress.provincestring

State or province (name).

order.billingAddress.provinceCodestring

State or province code.

order.billingAddress.statestring

State — duplicate field of province that the model also accepts.

order.billingAddress.countryNamestring

Country name.

order.billingAddress.countryCodestring

Country code.

order.billingAddress.zipCodestring

ZIP / postal code.

order.billingAddress.referencesstring

Additional references.

order.shippingAddressobjectestructura libre

Not stored. The validator accepts any structure (passthrough) and the order has no shippingAddress field. The delivery address Fenicia does persist lives at deliveryInfo.address (above) — use that one if you need the shipping address to be saved.

order.metadataobjectestructura libre

Not persisted: this endpoint accepts it and the order does not store it. Do not send card data or sensitive cardholder data here.

Where merchant-owned order data goes

The order models metafields: namespace + key pairs with a free-form value. They are written both by Fenicia's flows —the date the channel settled, the marketplace's package number— and by you.

This endpoint does not accept them: POST /orders rejects metafields with 400. Create the order, then add them with PUT /orders/{orderId}, where they merge with the existing ones instead of replacing them. See Metafields.

order.isCounterSaleboolean

Not stored. The validator accepts the field, but no Fenicia process consumes or persists it.

Nine fields are accepted and not stored

The validator accepts tags, discounts, subtotal, tax, shipping, paymentSummary, shippingAddress, metadata and isCounterSale, but the order does not keep them under those names. The response is 201 and the value disappears: it shows up neither on the order, nor in the list, nor in reports.

Four of them are amounts (subtotal, tax, shipping, discounts). The only amount this endpoint persists is totalAmount — if a discount or shipping must affect the total, include them in that calculation.

This is a known API defect, not a design decision. Until it is fixed, do not send these fields: they do nothing.

Validation

Inside order, only the keys above are accepted. Any other one — extra or misspelled — rejects the whole request with validation:invalid_input, and the detail arrives in details.errors[] (see the 400 example above).

Two behaviours worth keeping in mind while debugging:

  • Strict above, permissive below. The root of order and the payment subobject reject anything unknown; items[] and customerInfo ignore it silently. A misspelled key inside a line raises no error: it simply is not stored.
  • Nothing is validated outside order. If you sent a field and it does not show up on the created order, check that it did not end up as a sibling of order.

The full details.errors[] contract — how many entries it carries, the field format and its known quirks — lives in the error reference.

Tip

Save the returned _id: you need it to get, update or transition the order.

Import orders in bulk

To load several orders in a single call (migrations, backfills), use the import endpoint instead of calling this one in a loop.

Imports a batch of orders into the authenticated tenant.

{
  "orders": [
    { "externalId": "LEGACY-001", "locationId": "65f2a1b2c4d5e6f7a8b9c0aa" },
    { "externalId": "LEGACY-002", "locationId": "65f2a1b2c4d5e6f7a8b9c0aa" }
  ]
}
200Batch processed
{ "data": { "imported": 2 } }
400The body does not carry an orders array
{ "error": { "code": "validation:invalid_input", "message": "orders must be an array" } }

Returns the number of imported orders in data.imported.

Required permission: orders:import

Parameters

ordersarrayrequired

Array of orders. Validation is applied by the domain library (importMany), not by a per-item transport schema: only three fields are strictly required per element (see below); the rest of the object follows the same shape as the order envelope used to create an order. Test with a small batch in development before a massive import.

orders.externalIdstring

Identifier of the order in your source system. Required unless you send handle instead — importMany requires at least one of the two.

orders.handlestring

Readable handle or folio for the order. Required unless you send externalId instead.

orders.channelIdstringrequired

ID of the sales channel the order belongs to.

orders.locationIdstringrequired

ID of the location that fulfills the order. importMany does not resolve it for you — you must compute it before importing.

Next steps