Skip to content

update-address-detail

Method: PUT
Path: /customers/{user_id}/addresses/{address_id}

Tags: Customers

Summary

Update particular address

Description

Update address

Storefront SDK Usage

SDK Method: sdk.customer.updateAddress()

Example:

typescript
const { data, error } = await sdk.customer.updateAddress(
  {
    user_id: "user_456",
    address_id: "addr_789"
  },
  {
    address_line1: "456 Oak Avenue",
    city: "Los Angeles",
    state: "CA",
    pincode: "90210"
  }
);

if (error) {
  console.error("Failed to update address:", error);
  return;
}

console.log("Address updated:", data.address);

TypeScript Definition

typescript
"update-address-detail": {
        parameters: {
            query?: never;
            header?: never;
            path: {
                /** @description address id */
                address_id: string;
                /** @description user id */
                user_id: string;
            };
            cookie?: never;
        };
        /** @description payload for address update */
        requestBody: {
            content: {
                "application/json": components["schemas"]["CustomerAddress"] & {
                    is_default_billing?: boolean;
                    is_default_shipping?: boolean;
                };
            };
        };
        responses: {
            /** @description OK */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        message?: string;
                        success?: boolean;
                        content?: {
                            address?: components["schemas"]["CustomerAddress"];
                        };
                    };
                };
            };
            400: components["responses"]["BadRequest"];
            401: components["responses"]["Unauthorized"];
            404: components["responses"]["NotFound"];
        };
    };

Component References

ReferenceResolves To
components["schemas"]["CustomerAddress"]CustomerAddress
components["responses"]["BadRequest"]BadRequest
components["responses"]["Unauthorized"]Unauthorized
components["responses"]["NotFound"]NotFound

Parameters

  • address_id (path): address id
  • user_id (path): user id

Request Body

payload for address update

Content Types: application/json

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": "update-address-detail",
  "summary": "Update particular address",
  "description": "Update address",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/operations/update-address-detail",
    "description": "API reference for the update-address-detail operation"
  },
  "parameters": [
    {
      "name": "address_id",
      "in": "path",
      "description": "address id",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "user_id",
      "in": "path",
      "description": "user id",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "description": "payload for address update",
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "allOf": [
            {
              "$ref": "#/components/schemas/CustomerAddress"
            },
            {
              "type": "object",
              "properties": {
                "is_default_billing": {
                  "type": "boolean"
                },
                "is_default_shipping": {
                  "type": "boolean"
                }
              }
            }
          ]
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "success": {
                "type": "boolean"
              },
              "content": {
                "properties": {
                  "address": {
                    "$ref": "#/components/schemas/CustomerAddress"
                  }
                },
                "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": "updateAddressDetail"
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: