list-attributes
Method: GET
Path: /auth/attributes
Tags: Customer attributes
Summary
List customer attributes
Description
Lists the store's customer attributes that shoppers see, as StorefrontAttribute objects ordered by name. Use them to build profile forms: shoppers can set the custom ones that aren't is_readonly with PUT /auth/user/\{id\}/attributes. Works with the store's API key alone or any access token.
Storefront SDK Usage
SDK Method: sdk.store.listCustomerAttributes()
Example:
const { data, error } = await sdk.store.listCustomerAttributes();
if (error) {
console.error("Failed to list customer attributes:", error.message);
return;
}
data.attributes.forEach((attribute) => {
console.log(`${attribute.name} (${attribute.slug}):`, attribute.attribute_type);
});
// Only the attributes shoppers can set
const { data: editable } = await sdk.store.listCustomerAttributes({
kind: "custom",
is_readonly: false,
});
// The KYC document attributes forgot-username takes
const { data: linked } = await sdk.store.listCustomerAttributes({
kind: "linked",
});TypeScript Definition
"list-attributes": {
parameters: {
query?: {
/** @description Page number, starting at 1. Non-integer values and values below 1 return 400. */
page?: components["parameters"]["pageParam"];
/** @description Results per page. Values outside 1–100 are clamped to that range. Non-integer input returns 400. */
limit?: components["parameters"]["pageLimitParam"];
/** @description `false`: only the attributes shoppers can set; `true`: only the others. */
is_readonly?: boolean;
/** @description Only attributes of this kind. `linked`: the ones `POST /auth/forgot-username` takes. */
kind?: components["schemas"]["AttributeKind"];
};
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
/** @example Attributes retrieved successfully. */
message: string;
success: boolean;
content: {
attributes: components["schemas"]["StorefrontAttribute"][];
pagination: components["schemas"]["Pagination"];
};
};
};
};
400: components["responses"]["AuthBadRequest"];
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
500: components["responses"]["InternalServerError"];
504: components["responses"]["GatewayTimeout"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["parameters"]["pageParam"] | pageParam |
components["parameters"]["pageLimitParam"] | pageLimitParam |
components["schemas"]["AttributeKind"] | AttributeKind |
components["schemas"]["StorefrontAttribute"] | StorefrontAttribute |
components["schemas"]["Pagination"] | Pagination |
components["responses"]["AuthBadRequest"] | AuthBadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["Forbidden"] | Forbidden |
components["responses"]["InternalServerError"] | InternalServerError |
components["responses"]["GatewayTimeout"] | GatewayTimeout |
Parameters
- page (query): Page number, starting at 1. Non-integer values and values below 1 return 400.
- limit (query): Results per page. Values outside 1–100 are clamped to that range. Non-integer input returns 400.
- is_readonly (query):
false: only the attributes shoppers can set;true: only the others. - kind (query): Only attributes of this kind.
linked: the onesPOST /auth/forgot-usernametakes.
Responses
200
OK
400
Bad request
401
Authentication failed. Codes include token-required, token-expired and token_not_valid for an invalid or expired token.
403
Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.
500
The request failed because of an unexpected error.
504
The request timed out.
OpenAPI Definition
{
"tags": [
"Customer attributes"
],
"operationId": "list-attributes",
"summary": "List customer attributes",
"description": "Lists the store's customer attributes that shoppers see, as `StorefrontAttribute` objects ordered by `name`. Use them to build profile forms: shoppers can set the `custom` ones that aren't `is_readonly` with `PUT /auth/user/{id}/attributes`. Works with the store's API key alone or any access token.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/list-attributes",
"description": "API reference for the list-attributes operation"
},
"parameters": [
{
"$ref": "#/components/parameters/pageParam"
},
{
"$ref": "#/components/parameters/pageLimitParam"
},
{
"name": "is_readonly",
"in": "query",
"description": "`false`: only the attributes shoppers can set; `true`: only the others.",
"required": false,
"schema": {
"type": "boolean"
}
},
{
"name": "kind",
"in": "query",
"description": "Only attributes of this kind. `linked`: the ones `POST /auth/forgot-username` takes.",
"required": false,
"schema": {
"$ref": "#/components/schemas/AttributeKind"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success",
"content"
],
"properties": {
"message": {
"type": "string",
"examples": [
"Attributes retrieved successfully."
]
},
"success": {
"type": "boolean"
},
"content": {
"properties": {
"attributes": {
"type": "array",
"items": {
"$ref": "#/components/schemas/StorefrontAttribute"
}
},
"pagination": {
"$ref": "#/components/schemas/Pagination"
}
},
"required": [
"attributes",
"pagination"
],
"type": "object"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/AuthBadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
},
"504": {
"$ref": "#/components/responses/GatewayTimeout"
}
},
"security": [
{
"X-Api-Key": []
},
{
"Authorization": []
}
],
"x-speakeasy-group": "auth",
"x-speakeasy-ignore": false,
"x-speakeasy-name-override": "listAttributes"
}Auto-generated from OpenAPI spec and TypeScript definitions