Skip to content

List Return Custom Fields

List the active custom fields the store asks the shopper to fill in while raising a return — the same additional questions the storefront return form renders. Answer them with custom_attributes when calling POST /api/shop/returns, keyed by each field's id.

The list is empty when the store has not configured any custom fields, in which case custom_attributes can be omitted entirely.

Endpoint

GET /api/shop/return-custom-fields

Authentication

This endpoint requires an authenticated customer — send the storefront key and a customer Bearer token. See the Authentication page.

Request Headers

HeaderRequiredDescription
Content-TypeYesapplication/json
X-STOREFRONT-KEYYesYour storefront API key
AuthorizationYesBearer token (customer login required)

Response Fields (200 OK)

The response is a plain JSON array, in the order the storefront renders the fields.

FieldTypeDescription
idintegerNumeric field id — the key to use in custom_attributes.
codestringMachine name of the field.
labelstringLabel shown to the shopper.
typestringInput type — text, textarea, date, select, multiselect, checkbox or radio.
isRequiredbooleanWhether an answer is mandatory when raising a return.
positionintegerDisplay order position.
inputValidationstringValidation rule configured by the admin, when any.
optionsarrayAllowed choices for option-based types — id, name, value. Empty for free-text types.

Answering the Fields

Send the answers as an object keyed by field id:

json
{
  "custom_attributes": {
    "1": "INV-9921",
    "2": "morning"
  }
}
  • every field with isRequired: true must be answered
  • select and radio answers must be one of the field's option values
  • multiselect and checkbox answers take a list of option values, e.g. ["morning", "evening"]
  • the stored answers come back on the return as customAttributes

WARNING

A required field left unanswered rejects the whole return with 400 Bad Request — nothing is stored. Fetch this endpoint before rendering your return form so the shopper is asked for everything the store expects.

Status Codes

StatusMeaning
200 OKCustom fields retrieved.
401 UnauthorizedMissing or invalid storefront key.
403 ForbiddenMissing or invalid customer Bearer token.

Released under the MIT License.