Measura API documentation · v1

Edit order measurements

Edit built-in or custom measured lines, split eligible lines, and adjust supported fulfilled lines with durable operation receipts.

Code example
PATCH /api/v1/orders/{orderId}

Headers:
  Authorization: Bearer <api-key>
  Content-Type: application/json
  Idempotency-Key: order-change-unique-key

Path parameters

Scroll horizontally to see all columns.

ParameterTypeDescription
orderIdstringRequired — Numeric Shopify order legacy (REST) ID; do not send a GraphQL GID.

Request body

Code example
{
  "expectedRevision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "edits": [
    {
      "operation": "update",
      "lineItemId": "111",
      "variantId": "333",
      "quantity": 1,
      "measurement": {
        "value": 1.5,
        "unit": "kg",
        "type": "weight"
      }
    }
  ],
  "notifyCustomer": false,
  "staffNote": "Adjust measured amount"
}

Response example (200 success)

Code example
{
  "success": true,
  "data": {
    "order": {
      "id": "1234567890",
      "name": "#1001",
      "currencyCode": "USD",
      "revision": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
      "updatedAt": "2026-10-19T00:01:00Z",
      "cancelledAt": null,
      "financialStatus": "PAID",
      "fulfillmentStatus": "UNFULFILLED",
      "items": [
        {
          "lineItemId": "112",
          "productId": "222",
          "variantId": "333",
          "quantity": 1,
          "measurement": {
            "type": "weight",
            "value": 1.5,
            "unit": "kg"
          },
          "unitPrice": "$10.00 per kg",
          "totalPrice": 15.0,
          "title": "Measured product",
          "originalLineItemId": "111",
          "previousLineItemId": "111",
          "originalProductId": "222",
          "originalVariantId": "333",
          "unfulfilledQuantity": 1,
          "fulfilledQuantity": 0,
          "editability": {
            "canEdit": true,
            "canSplit": true,
            "canAdjustFulfilled": false,
            "canReturn": false,
            "reason": null
          }
        }
      ],
      "totals": {
        "total": {
          "amount": "15.00",
          "currencyCode": "USD"
        },
        "tax": {
          "amount": "0.00",
          "currencyCode": "USD"
        },
        "shipping": {
          "amount": "0.00",
          "currencyCode": "USD"
        },
        "outstanding": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      },
      "paymentSettlement": "separate"
    },
    "lineMappings": [
      {
        "sourceLineItemId": "111",
        "originalLineItemId": "111",
        "resultingLineItemIds": [
          "112"
        ]
      }
    ],
    "paymentSettlement": "separate",
    "operationId": "123e4567-e89b-42d3-a456-426614174000",
    "operationStatus": "completed"
  },
  "error": null
}

Response fields

Scroll horizontally to see all columns.

FieldTypeDescription
data.orderobjectCurrent full order state, using the same schema as Get order details.
data.lineMappingsarrayFor each previous measured line: sourceLineItemId, originalLineItemId, and resultingLineItemIds. Empty resultingLineItemIds can indicate removal.
data.operationId / operationStatusstringDurable operation UUID and completed status. Use operationId as editId on the edit detail endpoint.
data.paymentSettlementstringAlways separate; no automatic collection or monetary refund.

Error responses

Scroll horizontally to see all columns.

Status codeDescription
400bad_request — Invalid JSON, missing Idempotency-Key or expectedRevision, unsupported fields, invalid measurements or quantities, duplicate lines, or mixed workflows.
405method_not_allowed — Use GET or PATCH; Allow: GET, PATCH.
404not_found — Order not found or unavailable.
409conflict — Stale revision; reload the order and submit a new request with its new revision and a new idempotency key.
409idempotency_key_reused — The same key was used for a different method, resource, or request body.
409operation_in_progress / resource_in_progress — This operation or another operation on the order is still running. Retry-After: 2 may be returned.
409operation_requires_review — Changes may have applied, or receipt persistence is uncertain. Retrieve the operation and reconcile before another write.
422unprocessable_entity — Cancelled order, unavailable action, wrong line ownership or measurement workflow, or another unsupported order state.
401unauthorized — Missing or invalid API key.
403forbidden — The Order edit add-on is not ACTIVE for this shop.
500internal_error — The request could not be processed.

Note

  • Both writes and operation-history reads require the active Order edit add-on.
  • Idempotency-Key is required (1–255 characters, not blank). Keep one unique key per intended write across the shop. Retry an identical request with its original key after a lost response; a changed request needs a new key. Completed/rejected replays return the saved result and Idempotency-Replayed: true.
  • Only one operation may own an order at a time. Inspect operation_in_progress or resource_in_progress before retrying. An operation_requires_review outcome can include applied changes and keeps the order blocked until reconciled; never start the same mutation with a fresh key to bypass it.
  • Order changes and monetary settlement are separate. Handle payment collection or refunds separately.
  • Read the order first. expectedRevision is required and must match its latest revision. JSON objects reject unsupported fields. IDs are numeric legacy strings.
  • Send exactly one non-empty workflow: standard edits/splits/discount repair, fulfilledEdits, or customEdits. Custom edits cannot be combined with standard fields, catalogPricing, staffNote, or splits. Fulfilled returns must use POST /api/v1/orders/{orderId}/returns.
  • Each supplied edit list accepts 1–100 entries. Standard edits plus all split pieces total at most 100 resulting changes. Source line IDs cannot be repeated across edits, fulfilledEdits, and splits.
  • Built-in measurements require a finite positive value, a valid unit for weight, length, area, volume, or time, and the source measurement type. Cross-dimension units and typos are rejected. Whole-copy quantities must be integers from 1 to 9999.

Request fields

Scroll horizontally to see all columns.

FieldTypeDescription
expectedRevisionstringRequired — revision copied from the latest GET order response.
editsarrayBuilt-in changes. operation defaults to update; supported: add, update, remove, reprice. Every entry requires variantId and measurement. Non-add operations require lineItemId. Quantity is required except for remove. Use source variantId and lines with canEdit.
edits[].fixedLinePricenumberOptional nonnegative finite explicit price; allowed only for operation reprice.
splitsarrayEach {lineItemId, pieces} needs at least two pieces, each {quantity, measurement}. Source must have canSplit; all pieces retain its measurement type. Do not send internal splitFromLineItemId fields.
fulfilledEditsarrayBuilt-in lines with canAdjustFulfilled. Entries contain lineItemId, quantity, measurement, and optional nonnegative fixedLinePrice. Measurement is the target per-copy amount; quantity is the target copy count.
discountRepairLineItemIdsstring[]Optional non-empty list of up to 100 active replacement-line IDs. Server derives trusted historical percentage discount data.
catalogPricingobjectOptional standard-workflow concurrency snapshot: {snapshot: {companyLocationId: string | null, currencyCode: string, prices: {[variantId]: {amount: string, currencyCode: string}}, productPrices?: object}, repriceLineItemIds: string[]}. Up to 100 selected legacy line IDs; actual applied catalog amounts are derived by the server.
customEditsarrayCustom-unit add/update/remove changes. Require operation and variantId; update/remove require lineItemId. Add/update require quantity, positive finite amount, unitId, saleId, and historical selection revision. Prices are derived by the server.
notifyCustomerbooleanOptional — Request customer notification from the edit workflow.
staffNotestringOptional — At most 2000 characters. Not supported for customEdits.

Split example

Code example
{
  "expectedRevision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "splits": [
    {
      "lineItemId": "111",
      "pieces": [
        {
          "quantity": 1,
          "measurement": {
            "type": "weight",
            "unit": "kg",
            "value": 0.75
          }
        },
        {
          "quantity": 1,
          "measurement": {
            "type": "weight",
            "unit": "kg",
            "value": 0.5
          }
        }
      ]
    }
  ]
}

Custom-unit update example

Code example
{
  "expectedRevision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "customEdits": [
    {
      "operation": "update",
      "lineItemId": "111",
      "variantId": "333",
      "quantity": 1,
      "amount": 2,
      "unitId": "custom:case",
      "saleId": "sale:case",
      "revision": "sale-revision-from-selection"
    }
  ]
}