Orders
Return order lines
Marks the returning material as returned: which line, how many units and in what condition.
orders:writeorders:write- 120/min
- Server annotation: Destructive
- Requires human confirmation
- Send your own idempotencyKey
Result
generated from the schema
Send your own idempotencyKey
A retry without the same key duplicates the effect. Send your own idempotencyKey (a UUID) and resend the same one if you retry.
Requires human confirmation
Put this tool on your client's “ask before running” list. The annotations are hints that the server declares, not guarantees: do not decide the approval from destructiveHint alone. The server flags this tool with _meta["anthropic, which clients that honor it use to ask a person before every call.
It hangs off the resource and not off an order because an unload crosses orders, which is what this call resolves at once. Send Idempotency-Key: returning the same line twice would put the material into the pool twice, and each line goes at most once per request (add up its quantities). It is a batch: atomic is true by default, so a line that cannot be returned rejects the whole batch with 409 and one issue per failing line, touching nothing; with atomic: false each order is processed on its own and the response is 207 with one result per element, where the failed ones were not returned and the rest HAVE been. On success the response is 200 with one result per element, in request order.
Arguments
Lines being returned. At least one, at most 500, each line at most once.
Limits: min 1 items, max 500 items
Show child attributesHide child attributes
Order line being returned.
Limits: min length 1
Units being returned, at least one. It can be a partial return.
Limits: min 1
Physical condition the material comes back in: good, damaged, lost, needs_repair or incident.
Available options: good, damaged, lost, needs_repair, incident
Effective date of the return, in ISO 8601 with offset. Defaults to now.
All or nothing (default true): if any line cannot be returned, none is, and the response is 409 with one issue per line. With false, each order is processed on its own, the response is 207 and every element carries its own status.
Idempotency key chosen by the client (a UUID is recommended). Repeating the same key with the same arguments within 24 h returns the stored response without executing again; with different arguments it responds 422. It is the safe way to retry after a network failure.
Limits: min length 1, max length 255
Result
On success the result carries structuredContent with data and meta. These are the attributes of data.
Show the attributes of data
Position of the element in the request array.
Identifier of the element as it was sent.
returned or failed.
Available options: returned, failed
Why it failed; null when returned.
Show child attributesHide child attributes
Stable error code of the element, from the same catalog as errors[].
Localized reason.
An error is a result with isError: true and the problem in content[0].; there is no structuredContent. See Errors.
The same operation by REST
This tool runs POST /api/v1/orders/line-items/returns.
Related pages
Link to this section: Related pagesOrders
Return order lines
Marks the returning material as returned: which line, how many units and in what condition.
Guides
Safe writes
An assistant that can write can also write the wrong thing. Decide which tools need a person, retry without duplicating, and know what a write sets in motion.
Guides
Errors
A tool error is a result with
isError: trueand the problem in the first text block. Branch on itscode.
Was this page helpful?