Skip to content

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:

typescript
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 ​

typescript
"list-attributes": {
        parameters: {
            query?: {
                /** @description Page number, from 1. */
                page?: components["parameters"]["pageParam"];
                /** @description Number of results per page. */
                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"]["BadRequest"];
            401: components["responses"]["Unauthorized"];
        };
    };

Component References ​

ReferenceResolves To
components["parameters"]["pageParam"]pageParam
components["parameters"]["pageLimitParam"]pageLimitParam
components["schemas"]["AttributeKind"]AttributeKind
components["schemas"]["StorefrontAttribute"]StorefrontAttribute
components["schemas"]["Pagination"]Pagination
components["responses"]["BadRequest"]BadRequest
components["responses"]["Unauthorized"]Unauthorized

Parameters ​

  • page (query): Page number, from 1.
  • limit (query): Number of results per page.
  • is_readonly (query): false: only the attributes shoppers can set; true: only the others.
  • kind (query): Only attributes of this kind. linked: the ones POST /auth/forgot-username takes.

Responses ​

200 ​

OK

400 ​

Bad request

401 ​

Not authorized for given operation on the Resource

OpenAPI Definition ​

json
{
  "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/BadRequest"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  },
  "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

Last updated: