Update an Order

This article covers three distinct endpoints for modifying an existing order:

  1. PUT /orders/:orderId — partial update of the order.
  2. PUT /orders/:orderId/customer — updates only the customer data.
  3. POST /orders/:orderId/comments — adds a comment to the order's history.

Update an order

Partially updates an existing order

{
  "deliveryInfo": {
    "address": {
      "addressLine1": "Calle Insurgentes 456, Depto 3B",
      "city": "Ciudad de México",
      "state": "CDMX",
      "zipCode": "03100",
      "countryCode": "MX"
    }
  },
  "notes": "Cliente cambió dirección por teléfono el 11-abr-2026"
}
200Order updated
{
  "data": {
    "_id": "65f3a1b2c4d5e6f7a8b9c0d1",
    "externalId": "FEN-10042",
    "orderStatus": "accepted",
    "deliveryInfo": {
      "address": {
        "addressLine1": "Calle Insurgentes 456, Depto 3B",
        "city": "Ciudad de México",
        "state": "CDMX",
        "zipCode": "03100",
        "countryCode": "MX"
      }
    },
    "notes": "Cliente cambió dirección por teléfono el 11-abr-2026",
    "updatedAt": "2026-04-11T15:02:44.000Z",
    "_links": {
      "self": "/orders/65f3a1b2c4d5e6f7a8b9c0d1",
      "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 -X PUT https://api.fenicia.io/orders/65f3a1b2c4d5e6f7a8b9c0d1 \
  -H "Authorization: Bearer fkapi_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "deliveryInfo": {
      "address": {
        "addressLine1": "Calle Insurgentes 456, Depto 3B",
        "city": "Ciudad de México",
        "state": "CDMX",
        "zipCode": "03100",
        "countryCode": "MX"
      }
    },
    "notes": "Cliente cambió dirección por teléfono el 11-abr-2026"
  }'

Returns the updated order, wrapped in data, with the rest of the document intact.

Required permission: orders:update

Parameters

orderIdstringrequired

Order ID (24-character MongoDB ObjectId).

bodyobjectrequiredestructura libre

Partial order object (Partial<Order>). No schema validates its shape: the handler does a direct cast to Partial<Order>, so any key is accepted at the transport level. Use the same field names documented in Create an order so the backend recognizes them — a key the order model does not declare is ignored.

metafieldsarray

Merchant-owned data. They MERGE with the existing ones: entries matching (namespace, key) are updated, new ones are added, and the ones you do not name are KEPT — so writing yours does not erase the ones the channel wrote. See [Metafields](/en/api/orders/metafields).

metafields.namespacestringrequired

Groups metafields from the same source or purpose.

metafields.keystringrequired

Name of the datum within its namespace. Together with namespace it forms the identity used to merge.

metafields.valueanyrequired

The datum. Accepts any JSON value.

metafields.typestring

A label for the data type, so a consumer knows how to read it.

metafields.descriptionstring

Free text explaining what that metafield is for.

The request body accepts a partial order object (Partial<Order>): you send only the properties you want to change and the rest of the document stays intact.

Use the dedicated endpoints to change status

This endpoint is not designed to advance the order's lifecycle. For that, use the state transition endpoints (/accept, /reject, /cancel, /status, /transition), which apply the state machine's business rules and get logged in the audit trail. Sending orderStatus (or other computed fields like items, subtotal, tax, or total) directly through this endpoint bypasses that business validation — avoid doing so, even though the transport layer doesn't explicitly reject it.

Update only the customer data

Dedicated endpoint to replace only the order's customer information, without touching the rest of the document.

Updates the customer data associated with the order

{ "name": "María González Reyes" }
200Customer data updated
{
  "data": {
    "_id": "65f3a1b2c4d5e6f7a8b9c0d1",
    "externalId": "FEN-10042",
    "customerInfo": { "name": "María González Reyes" },
    "updatedAt": "2026-04-11T15:05:10.000Z",
    "_links": { "self": "/orders/65f3a1b2c4d5e6f7a8b9c0d1" }
  }
}
404No order exists with that ID in your tenant
{ "error": { "code": "orders:not_found", "message": "Order not found" } }
curl -X PUT https://api.fenicia.io/orders/65f3a1b2c4d5e6f7a8b9c0d1/customer \
  -H "Authorization: Bearer fkapi_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{ "name": "María González Reyes" }'

Returns the order with customerInfo replaced, wrapped in data.

Required permission: orders:update

Parameters

orderIdstringrequired

Order ID.

namestringrequired

Customer name.

The body accepts the same customerInfo object used when creating an order: the only field confirmed as required is name.

Add a comment

Adds a note to the order's history. Unlike notes (a replaceable free-text field via PUT /orders/:orderId), a comment is recorded as an append-only event.

Adds a comment to the order

{ "comment": "Cliente confirmó recepción vía WhatsApp" }
200Comment added
{ "data": { "success": true, "orderId": "65f3a1b2c4d5e6f7a8b9c0d1" } }
404No order exists with that ID in your tenant
{ "error": { "code": "orders:not_found", "message": "Order not found" } }
curl -X POST https://api.fenicia.io/orders/65f3a1b2c4d5e6f7a8b9c0d1/comments \
  -H "Authorization: Bearer fkapi_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{ "comment": "Cliente confirmó recepción vía WhatsApp" }'

Returns a confirmation (success) and the ID of the commented order.

Required permission: orders:update

Parameters

orderIdstringrequired

Order ID.

commentstringrequired

Comment text.

Tip

See the full history of comments and events with GET /orders/:orderId/activity-log.

Next steps