Skip to content

list-user-attributes ​

Method: GET
Path: /auth/user/{id}/attributes

Tags: Customer attributes

Summary ​

List a user's attribute values

Description ​

Retrieves every attribute of GET /auth/attributes with the customer's value, as UserAttributeValue objects ordered by name; value is null where none is set. In a business account every user of the customer sees the same values. With an anonymous token, pass its user id: the visitor's values. The id must be the token's own user (signed in), or its visitor's id (anonymous token); any other id gets 404, as an unknown one does.

Storefront SDK Usage ​

SDK Method: sdk.auth.listUserAttributes()

Example:

typescript
const { data, error } = await sdk.auth.listUserAttributes({
  id: "01H9XYZ12345USERID"
});

if (error) {
  console.error("Failed to list user attributes:", error.message);
} else {
  data.attributes.forEach((attribute) => {
    console.log(`${attribute.slug}:`, attribute.value, attribute.updated_at);
  });
  console.log("Pagination:", data.pagination);
}

TypeScript Definition ​

typescript
"list-user-attributes": {
        parameters: {
            query?: {
                /** @description Page number, from 1. */
                page?: components["parameters"]["pageParam"];
                /** @description Number of results per page. */
                limit?: components["parameters"]["pageLimitParam"];
            };
            header?: never;
            path: {
                /** @description The user's `id`. */
                id: string;
            };
            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"]["UserAttributeValue"][];
                            pagination: components["schemas"]["Pagination"];
                        };
                    };
                };
            };
            400: components["responses"]["BadRequest"];
            401: components["responses"]["Unauthorized"];
            404: components["responses"]["NotFound"];
        };
    };

Component References ​

ReferenceResolves To
components["parameters"]["pageParam"]pageParam
components["parameters"]["pageLimitParam"]pageLimitParam
components["schemas"]["UserAttributeValue"]UserAttributeValue
components["schemas"]["Pagination"]Pagination
components["responses"]["BadRequest"]BadRequest
components["responses"]["Unauthorized"]Unauthorized
components["responses"]["NotFound"]NotFound

Parameters ​

  • page (query): Page number, from 1.
  • limit (query): Number of results per page.
  • id (path): The user's id.

Responses ​

200 ​

OK

400 ​

Bad request

401 ​

Not authorized for given operation on the Resource

404 ​

Requested resource not found

OpenAPI Definition ​

json
{
  "tags": [
    "Customer attributes"
  ],
  "operationId": "list-user-attributes",
  "summary": "List a user's attribute values",
  "description": "Retrieves every attribute of `GET /auth/attributes` with the customer's value, as `UserAttributeValue` objects ordered by `name`; `value` is `null` where none is set. In a business account every user of the customer sees the same values. With an anonymous token, pass its user id: the visitor's values. The id must be the token's own user (signed in), or its visitor's id (anonymous token); any other id gets 404, as an unknown one does.",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/operations/list-user-attributes",
    "description": "API reference for the list-user-attributes operation"
  },
  "parameters": [
    {
      "$ref": "#/components/parameters/pageParam"
    },
    {
      "$ref": "#/components/parameters/pageLimitParam"
    },
    {
      "name": "id",
      "in": "path",
      "description": "The user's `id`.",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "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/UserAttributeValue"
                    }
                  },
                  "pagination": {
                    "$ref": "#/components/schemas/Pagination"
                  }
                },
                "required": [
                  "attributes",
                  "pagination"
                ],
                "type": "object"
              }
            }
          }
        }
      }
    },
    "400": {
      "$ref": "#/components/responses/BadRequest"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    }
  },
  "security": [
    {
      "Authorization": []
    }
  ],
  "x-speakeasy-group": "auth",
  "x-speakeasy-ignore": false,
  "x-speakeasy-name-override": "listUserAttributes"
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: