Record a return of an order line (idempotent by return ID and line)
const url = 'https://api.tryyoursize.com/v1/returns';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"id":"example","order_id":"example","line_id":"example","quantity":1,"reason":"example","exchange":true,"exchange_size":"example","returned_at":"2026-04-15T12:00:00Z"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.tryyoursize.com/v1/returns \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "id": "example", "order_id": "example", "line_id": "example", "quantity": 1, "reason": "example", "exchange": true, "exchange_size": "example", "returned_at": "2026-04-15T12:00:00Z" }'Key scopes: returns:write. A secret key (sk_) has every scope; a restricted key (rk_) needs the scopes listed.
Secret key, or a restricted key with returns:write (e.g. a returns platform). The order must have been sent first (404 otherwise). Reasons are normalised to TryYourSize’s taxonomy.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”A return of (part of) an order line. Idempotent by (line, id). Free-text notes are not accepted.
object
Your return (or RMA) ID.
Size_too_small, size_too_large, fit_other, style, quality, damaged_or_wrong, changed_mind, other; Shopify’s ReturnReason codes (SIZE_TOO_SMALL…) and common returns-platform words are mapped. Empty: unspecified.
The item was exchanged rather than refunded.
The size sent in exchange (implies exchange).
Example generated
{ "id": "example", "order_id": "example", "line_id": "example", "quantity": 1, "reason": "example", "exchange": true, "exchange_size": "example", "returned_at": "2026-04-15T12:00:00Z"}Responses
Section titled “Responses”Updated
object
The reason as normalised to TryYourSize’s taxonomy.
Example generated
{ "created": true, "reason": "example"}Created
object
The reason as normalised to TryYourSize’s taxonomy.
Example generated
{ "created": true, "reason": "example"}Invalid request
Every error has this shape. error is a human-readable message, status the HTTP status. code is stable and machine-readable; doc_url links its explanation; request_id identifies the request (also in the X-Request-ID response header): quote it to support.
object
Stable error code, e.g. invalid_request, unauthorized, reauth_required, payment_required, forbidden, not_found, conflict, unprocessable, rate_limited, internal_error, not_implemented, unavailable, invalid_api_version, idempotency_key_in_use, idempotency_key_reused, invalid_idempotency_key, handle_expired, handle_invalid.
Example
{ "code": "not_found", "doc_url": "https://docs.tryyoursize.com/api/errors/#not_found"}Missing or invalid credentials
Every error has this shape. error is a human-readable message, status the HTTP status. code is stable and machine-readable; doc_url links its explanation; request_id identifies the request (also in the X-Request-ID response header): quote it to support.
object
Stable error code, e.g. invalid_request, unauthorized, reauth_required, payment_required, forbidden, not_found, conflict, unprocessable, rate_limited, internal_error, not_implemented, unavailable, invalid_api_version, idempotency_key_in_use, idempotency_key_reused, invalid_idempotency_key, handle_expired, handle_invalid.
Example
{ "code": "not_found", "doc_url": "https://docs.tryyoursize.com/api/errors/#not_found"}Not allowed
Every error has this shape. error is a human-readable message, status the HTTP status. code is stable and machine-readable; doc_url links its explanation; request_id identifies the request (also in the X-Request-ID response header): quote it to support.
object
Stable error code, e.g. invalid_request, unauthorized, reauth_required, payment_required, forbidden, not_found, conflict, unprocessable, rate_limited, internal_error, not_implemented, unavailable, invalid_api_version, idempotency_key_in_use, idempotency_key_reused, invalid_idempotency_key, handle_expired, handle_invalid.
Example
{ "code": "not_found", "doc_url": "https://docs.tryyoursize.com/api/errors/#not_found"}Not found
Every error has this shape. error is a human-readable message, status the HTTP status. code is stable and machine-readable; doc_url links its explanation; request_id identifies the request (also in the X-Request-ID response header): quote it to support.
object
Stable error code, e.g. invalid_request, unauthorized, reauth_required, payment_required, forbidden, not_found, conflict, unprocessable, rate_limited, internal_error, not_implemented, unavailable, invalid_api_version, idempotency_key_in_use, idempotency_key_reused, invalid_idempotency_key, handle_expired, handle_invalid.
Example
{ "code": "not_found", "doc_url": "https://docs.tryyoursize.com/api/errors/#not_found"}Was this page helpful?
Thank you. We read every answer.