Skip to content

list-addresses

Method: GET
Path: /customers/{user_id}/addresses

Tags: Customers

Summary

Retrieve all addresses

Description

Retrieve billing and shipping address of particular customer

Storefront SDK Usage

SDK Method: sdk.customer.listAddresses()

Example:

typescript
const { data, error } = await sdk.customer.listAddresses({
  user_id: "user_456"
});

if (error) {
  console.error("Failed to list addresses:", error);
  return;
}

console.log("Addresses:", data.addresses);
console.log("Pagination:", data.pagination);

// With pagination
const { data: page2, error: page2Error } = await sdk.customer.listAddresses({
  user_id: "user_456",
  page: 2,
  limit: 10
});

TypeScript Definition

typescript
"list-addresses": {
        parameters: {
            query?: {
                /** @description page number of pagination list */
                page?: components["parameters"]["pageParam"];
                /** @description no of rows per page */
                limit?: components["parameters"]["pageLimitParam"];
            };
            header?: never;
            path: {
                /** @description User id */
                user_id: string;
            };
            cookie?: never;
        };
        requestBody?: never;
        responses: {
            /** @description OK */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        message?: string;
                        success?: boolean;
                        content?: {
                            addresses?: (components["schemas"]["CustomerAddress"] & {
                                is_default_billing?: boolean;
                                is_default_shipping?: boolean;
                            })[];
                            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"]["CustomerAddress"]CustomerAddress
components["schemas"]["Pagination"]Pagination
components["responses"]["BadRequest"]BadRequest
components["responses"]["Unauthorized"]Unauthorized
components["responses"]["NotFound"]NotFound

Parameters

  • page (query): page number of pagination list
  • limit (query): no of rows per page
  • user_id (path): User 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": [
    "Customers"
  ],
  "operationId": "list-addresses",
  "summary": "Retrieve all addresses",
  "description": "Retrieve billing and shipping address of particular customer",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/operations/list-addresses",
    "description": "API reference for the list-addresses operation"
  },
  "parameters": [
    {
      "$ref": "#/components/parameters/pageParam"
    },
    {
      "$ref": "#/components/parameters/pageLimitParam"
    },
    {
      "name": "user_id",
      "in": "path",
      "description": "User id",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "success": {
                "type": "boolean"
              },
              "content": {
                "properties": {
                  "addresses": {
                    "type": "array",
                    "items": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/CustomerAddress"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "is_default_billing": {
                              "type": "boolean"
                            },
                            "is_default_shipping": {
                              "type": "boolean"
                            }
                          }
                        }
                      ]
                    }
                  },
                  "pagination": {
                    "$ref": "#/components/schemas/Pagination"
                  }
                },
                "type": "object"
              }
            }
          }
        }
      }
    },
    "400": {
      "$ref": "#/components/responses/BadRequest"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    }
  },
  "security": [
    {
      "Authorization": []
    }
  ],
  "x-speakeasy-group": "customers",
  "x-speakeasy-ignore": false,
  "x-speakeasy-name-override": "listAddresses"
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: