Get an Order

This endpoint returns all the information for an order: its items, the customer, the originating channel, and the HATEOAS links with the actions available for its current state. This page also covers two related endpoints for a specific order: its valid state transitions and its financial profit breakdown.

Use it when you need to:

  • Display an order's detail in your application.
  • Sync information to external systems.
  • Verify which actions are available before executing a transition (accept, prepare, cancel).
  • Calculate an order's real profit after shipping, commission, cost of goods, packaging, and other fees.

Retrieves an order by its ID

200Order found
{
  "data": {
    "_id": "65f3a1b2c4d5e6f7a8b9c0d1",
    "externalId": "FEN-10042",
    "handle": "fen-10042",
    "locationId": "65f2a0b1c4d5e6f7a8b9c0aa",
    "origin": "manual",
    "channelId": "manual",
    "orderStatus": "accepted",
    "paymentStatus": "paid",
    "currency": "MXN",
    "totalAmount": 1986.26,
    "subtotalAmount": 1798.50,
    "totalTaxes": 287.76,
    "orderCreated": "2026-04-11T14:23:11.000Z",
    "items": [
      {
        "sku": "CAM-ROJO-M",
        "title": "Camisa Roja Talla M",
        "quantity": 2,
        "totalAmount": 998.00
      },
      {
        "sku": "PAN-AZUL-32",
        "title": "Pantalón Azul 32",
        "quantity": 1,
        "totalAmount": 799.50
      }
    ],
    "customerInfo": { "name": "María González" },
    "customerId": "65f3a1b2c4d5e6f7a8b9c0d2",
    "_links": {
      "prepare": "/orders/65f3a1b2c4d5e6f7a8b9c0d1/prepare",
      "cancel": "/orders/65f3a1b2c4d5e6f7a8b9c0d1/cancel"
    }
  }
}
404No order exists with that ID in your tenant
{
  "error": {
    "code": "orders:not_found",
    "message": "Order not found"
  }
}
curl https://api.fenicia.io/orders/65f3a1b2c4d5e6f7a8b9c0d1 \
  -H "Authorization: Bearer fkapi_your_api_key"

Returns the complete order, wrapped in data, including its _links with the actions available for its current state.

Required permission: orders:read

Parameters

orderIdstringrequired

Order ID (24-character MongoDB ObjectId).

The _links object (inside data, not as a sibling of the order) indicates which actions are available based on the current state. The possible actions are accept, reject, cancel, prepare, fulfill, and returns — the links engine only exposes the ones valid for the order's current state according to the state machine. You don't have to hardcode that logic in your client.

If an action doesn't appear in _links, it isn't valid in the current state; see State Transitions for the complete state machine.

Tenant isolation

You can only retrieve orders from your own tenant. Attempting to access an order from another tenant returns 404, never cross-tenant information.

Valid transitions for an order

Returns the states the order can transition to from its current state

200Valid states from the current state
{
  "data": {
    "currentStatus": "accepted",
    "validTargets": ["processing", "fulfilled", "cancelled"]
  }
}

Returns the order's current state (currentStatus) and the array of states it can transition to (validTargets).

Required permission: orders:read

Parameters

orderIdstringrequired

Order ID.

flowProfilestring

Flow profile the valid transitions are computed against: basic, intermediate (default), or wms-full.

This is NOT the 23-state HATEOAS table

This endpoint validates against a different table than the one that decides which actions appear in _links — see State Transitions for the full detail (two tables, with 17 vs. 23 states, and why they differ). With the default profile (intermediate), accepted transitions to processing, fulfilled, or cancelled — not to preparing.


Order financial breakdown

Calculates the order's net profit: revenue minus real shipping cost, commission, cost of goods sold (COGS), packaging, and other fees

200Breakdown calculated
{
  "data": {
    "orderId": "65f3a1b2c4d5e6f7a8b9c0d1",
    "currency": "MXN",
    "revenue": 1986.26,
    "subtotalAmount": 1798.50,
    "shippingCharged": 150.00,
    "costs": {
      "shipping": 187.40,
      "commission": 99.31,
      "cogs": 850.00,
      "packaging": 25.00,
      "labor": 0,
      "other": 0,
      "otherFees": 0
    },
    "taxWithheld": 0,
    "netProfit": 824.55,
    "marginPercent": 41.51,
    "flags": {
      "cogsComplete": true,
      "currencyMixed": false
    }
  }
}

Returns the order's net profit: revenue minus real shipping cost, commission, cost of goods sold (COGS), packaging, and other fees (otherFees, e.g. payment gateway or platform charges). This endpoint answers the question "how much did this order actually earn?" — unlike shippingCharged, which is what was charged to the customer for shipping, costs.shipping is what shipping actually cost.

Order additional costs

costs.packaging, costs.labor and costs.other add up the order's additional costs by category (see Order costs and COGS correction). An order without additional costs returns 0 in all three.

Required permission: orders:read

Parameters

orderIdstringrequired

Order ID.

Response fields

revenuenumber

Total order revenue.

subtotalAmountnumber

Subtotal before taxes.

shippingChargednumber

Shipping amount charged to the customer.

costsobject

Breakdown of the order's real costs.

costs.shippingnumber

Real shipping cost (fee paid to the carrier).

costs.commissionnumber

Sales channel commission.

costs.cogsnumber

Cost of goods sold: the sum of the lines' COGS minus their reversals, with corrections applied. Lines with costMissing do not add up.

costs.packagingnumber

Sum of the order's additional costs with category packaging (packaging and supplies).

costs.labornumber

Sum of the order's additional costs with category labor.

costs.othernumber

Sum of the order's additional costs with category other.

costs.otherFeesnumber

Other fees or charges (payment gateway, platform, other) — excludes the channel commission, which is reported separately in commission.

taxWithheldnumber

Taxes withheld.

netProfitnumber

Net profit: `revenue` minus `shipping`, `commission`, `cogs`, `packaging`, `labor`, `other`, and `otherFees`.

marginPercentnumber

Profit margin as a percentage.

flagsobject

Reliability indicators for the calculation.

flags.cogsCompleteboolean

`false` if any order line lacks a cost snapshot or was left with costMissing (no lot and no unitCost) — in that case the breakdown doesn't invent a cost, it flags it as incomplete.

flags.currencyMixedboolean

`true` if the order mixes different currencies across its components.

No invented costs

When a line's cost snapshot is missing, or the line was left with costMissing, the breakdown flags flags.cogsComplete: false instead of estimating or inventing a cost. A netProfit calculated with cogsComplete: false is a preliminary profit: treat it as a maximum, not as final profit. Enter the product's unitCost and correct the line's COGS to complete it.

Next steps