Developers
Start building
AI/Tool reference/Orders/Returns, claims and exchanges

Returns, claims and exchanges

The 20 tools of the Returns, claims and exchanges toolset in the Orders area, with their permissions, approval rules and inputs.

On this page

Toolset returns, 20 tools.

Records

claim

A complaint about order lines that were missing, wrong or faulty, settled by a refund or a replacement.

  • Permission: orders.read
  • Tools: claim_list, claim_get
  • Sorts: created_at, updated_at
  • Returned only when named in fields: metadata
  • Written by customers or third parties, so data and never instructions: claim_items.note, metadata

Filters on the list:

FilterTypeRequiredDescription
order_idstringOnly the claims of this order

exchange

Order lines a customer sends back for other items, with the price difference to refund or charge.

  • Permission: orders.read
  • Tools: exchange_list, exchange_get
  • Sorts: created_at, updated_at
  • Returned only when named in fields: metadata
  • Written by customers or third parties, so data and never instructions: metadata

Filters on the list:

FilterTypeRequiredDescription
order_idstringOnly the exchanges of this order

return

Items a customer sends back from an order, from request to receipt. Create one with return_create and book what arrived with return_receive.

  • Permission: orders.read
  • Tools: return_list, return_get
  • Sorts: created_at, updated_at
  • Returned only when named in fields: metadata
  • Written by customers or third parties, so data and never instructions: items.note, metadata

Filters on the list:

FilterTypeRequiredDescription
order_idstringOnly the returns of this order
statuslist of stringone of "open", "requested", "received", "partially_received", "canceled"

return_reason

A reason a customer gives for sending items back; pass its id with return_item ops. Reasons can nest under a parent.

  • Permission: orders.read
  • Tools: return_reason_list, return_reason_get
  • Sorts: created_at, value

Filters on the list:

FilterTypeRequiredDescription
qstring
parent_return_reason_idstring

Actions

claim_cancel

Cancel a requested claim whose return has not been received.

  • Action key: claim.cancel
  • Permission: orders.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Destructive: in compact mode it runs with run_destructive_action.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
  • Sends something to customers.
FieldTypeRequiredDescription
claim_idstringyesClaim ID
notify_customerbooleanWhether the customer gets the email; defaults to the store setting

Example input:

{
  "claim_id": "019bb1fb-5e9e-75b2-aef2-680973470dc8"
}

claim_create

File a claim on order lines and settle it with a refund or replacement items.

Builds the whole claim in one call and requests it: claim_item for each faulty line, return_item for what the customer sends back, send_item for replacements (type replace), and inbound_shipping or outbound_shipping for the methods. A dry run shows the order as the claim would leave it, including the amount to refund or charge, and changes nothing.

  • Action key: claim.create
  • Permission: orders.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
  • Dry run: supported, with dry_run set to true.
  • Sends something to customers.
FieldTypeRequiredDescription
order_idstringyesOrder ID (order_…), not the display number
typestringyesone of "refund", "replace"
opslist of object, one shape of:yesat least 1 items
location_idstringStock location returned items go back to
descriptionstring
notestringInternal note
notify_customerbooleanWhether the customer gets the email; defaults to the store setting
carry_over_promotionsbooleanWhether the order's promotions also discount the new items

Example input:

{
  "order_id": "019bb3ef-6501-7dc3-a2e7-726e91520b7a",
  "type": "replace",
  "ops": [
    {
      "op": "claim_item",
      "item_id": "019bb496-a0e1-70c9-a373-1b205a23af28",
      "quantity": 1,
      "reason": "production_failure"
    },
    {
      "op": "send_item",
      "variant_id": "019bb7f3-10ac-7f8b-b47e-f5cd71dff2e1",
      "quantity": 1
    }
  ]
}

draft_order_edit

Change a draft order's lines, add promotion codes or add and change shipping methods.

Builds the whole edit in one call and confirms it. A dry run shows the draft as the edit would leave it and changes nothing. Addresses, email and customer change with draft_order_update; draft_order_remove takes promotion codes and shipping methods off.

  • Action key: draft_order.edit
  • Permission: orders.write
  • Approval: Waits for approval when the store requires it for this action.
  • Effect: Changes the live store.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
  • Dry run: supported, with dry_run set to true.
FieldTypeRequiredDescription
draft_order_idstringyesDraft order ID
opslist of object, one shape of:yesat least 1 items

Example input:

{
  "draft_order_id": "019bb3ef-6501-7dc3-a2e7-726e91520b7a",
  "ops": [
    {
      "op": "add_item",
      "variant_id": "019bb7ef-f616-782b-8ecc-134b61d2a924",
      "quantity": 2
    },
    {
      "op": "add_promotion",
      "code": "WELCOME10"
    }
  ]
}

exchange_cancel

Cancel a requested exchange whose return has not been received.

  • Action key: exchange.cancel
  • Permission: orders.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Destructive: in compact mode it runs with run_destructive_action.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
  • Sends something to customers.
FieldTypeRequiredDescription
exchange_idstringyesExchange ID
notify_customerbooleanWhether the customer gets the email; defaults to the store setting

Example input:

{
  "exchange_id": "019bb28d-3de5-7576-8853-8b848396d66e"
}

exchange_create

Swap order lines the customer sends back for other items.

Builds the whole exchange in one call and requests it: return_item for what comes back, send_item for what goes out, and inbound_shipping or outbound_shipping for the methods. A dry run shows the order as the exchange would leave it, including the difference to refund or charge, and changes nothing.

  • Action key: exchange.create
  • Permission: orders.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
  • Dry run: supported, with dry_run set to true.
  • Sends something to customers.
FieldTypeRequiredDescription
order_idstringyesOrder ID (order_…), not the display number
opslist of object, one shape of:yesat least 1 items
location_idstringStock location returned items go back to
descriptionstring
notestringInternal note
notify_customerbooleanWhether the customer gets the email; defaults to the store setting
carry_over_promotionsbooleanWhether the order's promotions also discount the new items

Example input:

{
  "order_id": "019bb3ef-6501-7dc3-a2e7-726e91520b7a",
  "ops": [
    {
      "op": "return_item",
      "item_id": "019bb496-a0e1-70c9-a373-1b205a23af28",
      "quantity": 1
    },
    {
      "op": "send_item",
      "variant_id": "019bb7ef-f616-782b-8ecc-134b61d2a924",
      "quantity": 1
    }
  ]
}

order_edit

Add lines, change quantities or add a shipping method on a placed order.

Builds the whole edit in one call, then requests and confirms it. A dry run shows the order as the edit would leave it, including the difference to charge or refund, and changes nothing. Collect or refund the difference afterwards with the payment tools.

  • Action key: order.edit
  • Permission: orders.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
  • Dry run: supported, with dry_run set to true.
  • Sends something to customers.
FieldTypeRequiredDescription
order_idstringyesOrder ID (order_…), not the display number
opslist of object, one shape of:yesat least 1 items
descriptionstring
notestringInternal note
notify_customerbooleanWhether the customer gets the email; defaults to the store setting

Example input:

{
  "order_id": "019bb3ef-6501-7dc3-a2e7-726e91520b7a",
  "ops": [
    {
      "op": "set_quantity",
      "item_id": "019bb496-a0e1-70c9-a373-1b205a23af28",
      "quantity": 2
    },
    {
      "op": "add_item",
      "variant_id": "019bb7ef-f616-782b-8ecc-134b61d2a924",
      "quantity": 1
    }
  ]
}

return_cancel

Cancel a requested return that has not been received.

  • Action key: return.cancel
  • Permission: orders.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Destructive: in compact mode it runs with run_destructive_action.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
  • Sends something to customers.
FieldTypeRequiredDescription
return_idstringyesReturn ID (return_…)
notify_customerboolean

Example input:

{
  "return_id": "019bb6a8-a26b-71c2-8179-d4d5051d7fae"
}

return_create

Request a return of order lines, with an optional return shipping method.

Builds the whole return in one call and requests it. A dry run shows the order as the return would leave it, including the amount to refund, and changes nothing. Refund the money afterwards with payment_refund.

  • Action key: return.create
  • Permission: orders.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
  • Dry run: supported, with dry_run set to true.
  • Sends something to customers.
FieldTypeRequiredDescription
order_idstringyesOrder ID (order_…), not the display number
opslist of object, one shape of:yesreturn_item for each line coming back, and at most one return_shipping for the label the customer uses. at least 1 items
location_idstringStock location the items go back to
descriptionstring
notestringInternal note
notify_customerbooleanWhether the customer gets the email; defaults to the store setting

Example input:

{
  "order_id": "019bb3ef-6501-7dc3-a2e7-726e91520b7a",
  "ops": [
    {
      "op": "return_item",
      "item_id": "019bb496-a0e1-70c9-a373-1b205a23af28",
      "quantity": 1,
      "reason_id": "019bb6c2-0002-727c-bfb9-6664567e2f88"
    }
  ]
}

return_reason_create

Add a reason customers and staff can pick when items come back.

  • Action key: return_reason.create
  • Permission: orders.write
  • Approval: Waits for approval when the store requires it for this action.
  • Effect: Changes the live store.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
FieldTypeRequiredDescription
valuestringyesStable code, e.g. "wrong_size". at least 1 characters
labelstringyesWhat customers and staff see, e.g. "Wrong size". at least 1 characters
descriptionstring or null
parent_return_reason_idstringNest it under this reason

Example input:

{
  "value": "wrong_size",
  "label": "Wrong size"
}

return_reason_delete

Delete a return reason customers can no longer pick.

  • Action key: return_reason.delete
  • Permission: orders.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Destructive: in compact mode it runs with run_destructive_action.
  • Retries: safe to repeat with the same input.
FieldTypeRequiredDescription
return_reason_idstringyesReturn reason ID (rr_…)

Example input:

{
  "return_reason_id": "019bb6c2-0002-727c-bfb9-6664567e2f88"
}

return_reason_update

Change a return reason's code, label or description.

  • Action key: return_reason.update
  • Permission: orders.write
  • Approval: Waits for approval when the store requires it for this action.
  • Effect: Changes the live store.
  • Retries: safe to repeat with the same input.
FieldTypeRequiredDescription
return_reason_idstringyesReturn reason ID (rr_…)
valuestringStable code, e.g. "wrong_size". at least 1 characters
labelstringWhat customers and staff see, e.g. "Wrong size". at least 1 characters
descriptionstring or null

Example input:

{
  "return_reason_id": "019bb6c2-0002-727c-bfb9-6664567e2f88",
  "label": "Too small"
}

return_receive

Book the items of a requested return as arrived, restocked or damaged.

A dry run shows the order as the receipt would leave it and changes nothing. Received items go back to stock; dismissed ones do not.

  • Action key: return.receive
  • Permission: orders.write
  • Approval: Waits for approval when the store requires it for this action.
  • Effect: Changes the live store.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
  • Dry run: supported, with dry_run set to true.
FieldTypeRequiredDescription
return_idstringyesReturn ID (return_…)
opslist of objectyesat least 1 items
ops[].opstringyesreceive restocks the item; dismiss books it as damaged. one of "receive", "dismiss"
ops[].item_idstringyesOrder line item ID on the return
ops[].quantityintegeryesabove 0
ops[].notestring
notestringInternal note
notify_customerbooleanWhether the customer gets the email; defaults to the store setting

Example input:

{
  "return_id": "019bb6a8-a26b-71c2-8179-d4d5051d7fae",
  "ops": [
    {
      "op": "receive",
      "item_id": "019bb496-a0e1-70c9-a373-1b205a23af28",
      "quantity": 1
    }
  ]
}
Last updated