POST

Change Line Item Status

Change the status of a single line item. Triggers notifications when configured on the target status.

Endpoint

HTTP Request
POST /v1/line-items/:lineItemId/status

Authentication

This endpoint requires a valid API key with canChangeOrderStatus permission. The API key must be passed in the X-API-Key header.
Required Header
X-API-Key: ucos_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

URL Parameters

ParameterTypeRequiredDefaultDescription
lineItemIdstringYes-Internal line item ID (SyncedLineItem.id)

Request Body

ParameterTypeRequiredDefaultDescription
status_idstringYes-Target status ID. An addon status is added to the line item when it is missing and removed when the line item already carries it; its sub-status is updated when one is given.
sub_status_option_idstringNo-Required when the target status has a sub-status group with options

Response

Returns confirmation with updated line item status:
200 OK - Success Response
{
  "success": true,
  "data": {
    "message": "string",
    "line_item": {
      "id": "string",
      "shopify_line_item_id": "string",
      "name": "string",
      "quantity": 0,
      "title": null,
      "variant_title": null,
      "sku": null,
      "custom_status": {
        "id": "string",
        "name": "string",
        "color": "string"
      },
      "custom_sub_status": null
    },
    "notifications": {
      "total_sent": 0,
      "total_failed": 0,
      "errors": [
        {
          "channel": "string",
          "code": "string",
          "message": "string"
        }
      ]
    },
    "metafield_errors": []
  }
}

Response Fields

Root Response Object

FieldTypeDescription
successbooleanAlways true on a successful response.
dataobjectThe endpoint's payload. Its fields are listed in the tables below.
messagestringConfirmation message
line_itemobjectUpdated line item object
notificationsobjectNotification delivery summary.
metafield_errorsarrayDeclared as { orderId, message }[]; the metafield rebuild never rejects, so this array is always empty in practice.

Line Item Object Fields

FieldTypeDescription
idstringUnique identifier for the line item
shopify_line_item_idstringShopify's global ID for the line item
namestringProduct name
quantitynumberQuantity ordered
titlestring | nullProduct title
variant_titlestring | nullVariant title, or null
skustring | nullSKU, or null
custom_statusobjectCurrent status object, or null.
custom_sub_statusobject | nullCurrent sub-status object, or null.

Status Object Fields

FieldTypeDescription
idstringUnique identifier for the custom status
namestringDisplay name of the status (uses public name if configured)
colorstringHex color code for the status

Sub-Status Object

FieldTypeDescription
idstringUnique identifier for the sub-status
namestringName of the sub-status

Notifications Object Fields

FieldTypeDescription
total_sentnumberNumber of notifications sent.
total_failednumberNumber of notifications that failed.
errorsarrayPer-channel notification errors.

Notification Error Object Fields

FieldTypeDescription
channelstringChannel that failed.
codestringMachine-readable error code.
messagestringHuman-readable error message.

Metafield Error Object Fields

FieldTypeDescription
orderIdstringOrder id whose metafield failed.
messagestringHuman-readable error message.

Examples

Basic Request

cURL Request
curl -X POST "https://api.ultimate-custom-order-status.apps.msmtech.ca/api/v1/line-items/8c1d4e2f-0a53-49b7-b6e4-7f2d9c3a5e10/status" \
  -H "X-API-Key: ucos_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
  -H "X-API-Version: 1.4" \
  -H "Content-Type: application/json" \
  -d '{"line_item_id":"8c1d4e2f-0a53-49b7-b6e4-7f2d9c3a5e10","status_id":"8c1d4e2f-0a53-49b7-b6e4-7f2d9c3a5e10","sub_status_option_id":"8c1d4e2f-0a53-49b7-b6e4-7f2d9c3a5e10"}'

Rate Limiting

This endpoint is subject to per-minute and per-day rate limits based on your API key. Rate limit information is returned in the response headers:
  • X-RateLimit-Limit-Minute: Maximum requests per minute
  • X-RateLimit-Remaining-Minute: Remaining requests in current minute
  • X-RateLimit-Reset-Minute: Unix timestamp when minute window resets
  • X-RateLimit-Limit-Day: Maximum requests per day
  • X-RateLimit-Remaining-Day: Remaining requests in current day
  • X-RateLimit-Reset-Day: Unix timestamp when day window resets
  • Retry-After: Seconds to wait before retrying (when rate limited)

Error Responses

400 Bad Request

Line item status not enabled, validation failed, or product chain enforcement violation

400 Bad Request
{
  "success": false,
  "error": "Validation failed",
  "details": {
    "errors": [
      {
        "code": "invalid_type",
        "expected": "string",
        "received": "undefined",
        "path": [
          "status_id"
        ],
        "message": "Required"
      }
    ]
  }
}

401 Unauthorized

Missing or invalid API key

401 Unauthorized
{
  "success": false,
  "error": "Missing API key. Include it in the X-API-Key header"
}

403 Forbidden

API key lacks required permissions

403 Forbidden
{
  "success": false,
  "error": "Insufficient permissions. Required: canChangeOrderStatus"
}

404 Not Found

Line item, status, or sub-status not found

404 Not Found
{
  "success": false,
  "error": "Line item not found"
}

500 Internal Server Error

Server error occurred

500 Internal Server Error
{
  "success": false,
  "error": "Internal server error",
  "details": {
    "message": "An unexpected error occurred"
  }
}