Update Order

Updates an existing order with the specified changes. This endpoint allows partial updates to order details, line items, and fulfillment orders.

⚠️ Important Warning

This endpoint can be dangerous if not used correctly. The fulfillment orders (fulfillment_orders) field behaves as a full replacement - any fulfillment order not included in the request will be permanently removed.


Update Behavior

Simple Fields (Partial Update)

The following fields are updated only if provided in the request:

  • partner_order_reference, order_date, merchant, language, sales_channel
  • taxes_included, duties_included
  • shipping_address, billing_address, customer
  • payment, discount_applications, shipping_lines

Line Items (Full Replacement)

If line_items is provided, it completely replaces the existing line items. Ensure you include all line items you want to keep.

Fulfillment Orders (Full Replacement with Preservation Rules)

If fulfillment_orders is provided:

  • Any FO not included will be REMOVED - Always include all FOs you want to keep
  • FOs are matched by fulfillment_order_id or partner_fulfillment_order_reference
  • New FOs (without matching ID) will be created with a new fulfillment_order_id

Fulfillment Order Line Items - Critical Rules

When updating FO line items, you must follow these rules:

What to Include

Only pass line items with pending statuses:

  • open - Items not yet allocated
  • allocated - Items allocated but not fulfilled

What is Automatically Preserved

The system automatically preserves line items with terminal statuses:

  • fulfilled - Items that have been fulfilled (will be added back automatically)
  • cancelled - Items that have been cancelled (will be added back automatically)
  • closed - Items that are closed (will be added back automatically)

You do NOT need to include fulfilled, cancelled, or closed line items in your request - they will be preserved automatically.


Example Scenarios

Scenario 1: Adding a new line item to an FO

If you have an FO with 2 items (item-1: open, item-2: fulfilled) and want to add item-3:

{
  "fulfillment_orders": [{
    "fulfillment_order_id": "FO-123",
    "line_items": [
      { "id": "item-1", "quantity": 1 },
      { "id": "item-3", "quantity": 2 }
    ]
  }]
}

Result: FO will have item-1 (open), item-2 (fulfilled - preserved), item-3 (open)

Scenario 2: Removing a pending line item from an FO

If you have an FO with 3 items and want to remove item-2 (which is open):

{
  "fulfillment_orders": [{
    "fulfillment_order_id": "FO-123",
    "line_items": [
      { "id": "item-1", "quantity": 1 },
      { "id": "item-3", "quantity": 1 }
    ]
  }]
}

Scenario 3: Moving a line item between FOs

To move item-2 from FO-A to FO-B:

{
  "fulfillment_orders": [
    {
      "fulfillment_order_id": "FO-A",
      "line_items": [{ "id": "item-1", "quantity": 1 }]
    },
    {
      "fulfillment_order_id": "FO-B",
      "line_items": [
        { "id": "item-2", "quantity": 1 },
        { "id": "item-3", "quantity": 1 }
      ]
    }
  ]
}

Common Mistakes to Avoid

  1. Forgetting to include all FOs: If you only include one FO in the request, all other FOs will be deleted
  2. Including fulfilled/cancelled items: Don't include them - they're preserved automatically. Including them may cause unexpected behavior
  3. Not matching FO identifiers: Always use either fulfillment_order_id or partner_fulfillment_order_reference to match existing FOs
  4. Partial line item updates: The line_items array replaces all pending items, so include all pending items you want to keep

Order Status Restrictions

Orders can only be updated when their status allows it:

  • open, partially_allocated, allocated, partially_fulfilled, fulfilled, closed - Can be updated
  • cancelled - Cannot be updated

Inventory Impact

If inventory management is enabled, updating FOs will automatically:

  • Reserve inventory for new FO allocations
  • Release inventory for removed FO allocations
  • Adjust inventory for quantity changes
SecurityOAuth2-Production or OAuth2-Demo
Request
path Parameters
reference
required
string

The order reference (order_id or partner_order_reference based on the key parameter).

query Parameters
key
string
Default: "order_id"

Specifies which reference type is being used:

  • order_id: Carriyo's unique order identifier (default)
  • partner_order_reference: Your system's order reference
Enum: "order_id" "partner_order_reference"
header Parameters
x-api-key
required
string

Your Carriyo API key for authentication.

tenant-id
required
string

Your unique tenant identifier in Carriyo.

Content-Type
string
Default: application/json
Request Body schema: application/json
required
partner_order_reference
string

Your system's unique order reference.

order_date
string <date-time>

The date when the order was placed (ISO 8601 format).

merchant
string

The merchant identifier.

language
string

Language code for customer communications.

sales_channel
string

The sales channel where the order originated.

taxes_included
boolean

Whether prices include taxes.

duties_included
boolean

Whether prices include duties.

object (Address)
object (Address)
object (Address)
object (Order Payment)
Array of objects (Discount Application)
Array of objects (Shipping Line)
Array of objects (Update Line Item Request)

Full replacement - If provided, completely replaces all existing line items. Include all line items you want to keep.

Array of objects (Update Fulfillment Order Request)

Full replacement with preservation rules.

⚠️ Critical: Any fulfillment order NOT included in this array will be PERMANENTLY REMOVED.

For each FO's line_items:

  • Only include open and allocated status items
  • fulfilled, cancelled, and closed items are automatically preserved
Responses
200

Order updated successfully.

400

Invalid request or order cannot be updated in current status.

404

Order not found.

409

Concurrent update detected. Retry the request.

patch/orders/{reference}
Request samples
application/json
{
  • "partner_order_reference": "string",
  • "order_date": "2019-08-24T14:15:22Z",
  • "merchant": "string",
  • "language": "string",
  • "sales_channel": "string",
  • "taxes_included": true,
  • "duties_included": true,
  • "shipping_address": {
    },
  • "billing_address": {
    },
  • "customer": {
    },
  • "payment": {
    },
  • "discount_applications": [
    ],
  • "shipping_lines": [
    ],
  • "line_items": [
    ],
  • "fulfillment_orders": [
    ]
}
Response samples
application/json
{
  • "tenant": "string",
  • "order_id": "string",
  • "merchant": "string",
  • "partner_order_reference": "string",
  • "language": "string",
  • "order_date": "2019-08-24T14:15:22Z",
  • "sales_channel": "string",
  • "creation_source": {
    },
  • "update_source": {
    },
  • "carriyo_metadata": [
    ],
  • "status": "open",
  • "auto_allocation_failed": true,
  • "cancellation_reason": "CUSTOMER_CANCELLATION",
  • "shipping_address": {
    },
  • "billing_address": {
    },
  • "customer": {
    },
  • "payment": {
    },
  • "redacted": true,
  • "taxes_included": true,
  • "duties_included": true,
  • "discount_applications": [
    ],
  • "line_items": [
    ],
  • "fulfillment_orders": [
    ],
  • "shipping_lines": [
    ],
  • "error_details": [
    ],
  • "creation_date": "2019-08-24T14:15:22Z",
  • "update_date": "2019-08-24T14:15:22Z"
}