# Replace Address

> Replace an existing address in a shopper's address book. These changes delete the existing address and create a new one.

Source: https://help.boltapp.com/api-reference/embeddable-checkout-v1/account/replaceaddress

`POST /v1/account/addresses/{id}`

## OpenAPI definition

This endpoint as it appears in the OpenAPI document, with every schema it references included.

```json
{
  "openapi": "3.2.0",
  "info": {
    "version": "1.0.1",
    "title": "Embedded API Reference",
    "description": "Postman Collection:\n\n[![](https://run.pstmn.io/button.svg)](https://god.gw.postman.com/run-collection/9136127-55d2bde1-a248-473f-95b5-64cfd02fb445?action=collection%2Ffork&collection-url=entityId%3D9136127-55d2bde1-a248-473f-95b5-64cfd02fb445%26entityType%3Dcollection%26workspaceId%3D78beee89-4238-4c5f-bd1f-7e98978744b4#?env%5BBolt%20Sandbox%20Environment%5D=W3sia2V5IjoiYXBpX2Jhc2VfdXJsIiwidmFsdWUiOiJodHRwczovL2FwaS1zYW5kYm94LmJvbHQuY29tIiwidHlwZSI6ImRlZmF1bHQiLCJlbmFibGVkIjp0cnVlfSx7ImtleSI6InRrX2Jhc2UiLCJ2YWx1ZSI6Imh0dHBzOi8vc2FuZGJveC5ib2x0dGsuY29tIiwidHlwZSI6ImRlZmF1bHQiLCJlbmFibGVkIjp0cnVlfSx7ImtleSI6ImFwaV9rZXkiLCJ2YWx1ZSI6IjxyZXBsYWNlIHdpdGggeW91ciBCb2x0IFNhbmRib3ggQVBJIGtleT4iLCJ0eXBlIjoic2VjcmV0IiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJwdWJsaXNoYWJsZV9rZXkiLCJ2YWx1ZSI6IjxyZXBsYWNlIHdpdGggeW91ciBCb2x0IFNhbmRib3ggcHVibGlzaGFibGUga2V5PiIsInR5cGUiOiJkZWZhdWx0IiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJkaXZpc2lvbl9pZCIsInZhbHVlIjoiPHJlcGxhY2Ugd2l0aCB5b3VyIEJvbHQgU2FuZGJveCBwdWJsaWMgZGl2aXNpb24gSUQ+IiwidHlwZSI6ImRlZmF1bHQiLCJlbmFibGVkIjp0cnVlfV0=)\n\n## About\nThe Embedded API reference is a consolidation of critical APIs that a developer will use when integrating with Bolt's Embedded Accounts product suite.\n"
  },
  "servers": [
    {
      "url": "https://api.boltapp.com",
      "description": "The Production URL (Live Data)."
    },
    {
      "url": "https://api-sandbox.boltapp.com",
      "description": "The Sandbox URL (Test Data)."
    },
    {
      "url": "https://api-staging.boltapp.com",
      "description": "The Staging URL (Staged Data)."
    }
  ],
  "security": [
    {
      "X-API-Key": []
    },
    {
      "OAuth": [
        "bolt.account.manage",
        "bolt.account.view"
      ]
    }
  ],
  "paths": {
    "/v1/account/addresses/{id}": {
      "post": {
        "description": "Replace an existing address in a shopper's address book.\nThese changes delete the existing address and create a new one.\n",
        "operationId": "replaceAddress",
        "parameters": [
          {
            "$ref": "#/components/parameters/shopper_address_id_path_param"
          },
          {
            "$ref": "#/components/parameters/x-publishable-key"
          },
          {
            "$ref": "#/components/parameters/idempotency_key"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/address_account"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/address_view_account"
                    },
                    {
                      "properties": {
                        "default": {
                          "type": "boolean"
                        }
                      },
                      "type": "object"
                    }
                  ]
                }
              }
            },
            "description": "Address Updated Successfully"
          }
        },
        "security": [
          {
            "OAuth": [
              "bolt.account.manage"
            ],
            "X-API-Key": []
          }
        ],
        "summary": "Replace Address",
        "tags": [
          "Account"
        ]
      }
    }
  },
  "components": {
    "parameters": {
      "shopper_address_id_path_param": {
        "description": "The ID for an address in the shopper's Address Book.",
        "in": "path",
        "name": "id",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "x-publishable-key": {
        "description": "The publicly viewable identifier used to identify a merchant division. This key is found in the Developer > API section of the Bolt Merchant Dashboard [RECOMMENDED].",
        "in": "header",
        "name": "X-Publishable-Key",
        "required": false,
        "schema": {
          "type": "string"
        }
      },
      "idempotency_key": {
        "description": "A key created by merchants that ensures `POST` and `PATCH` requests are only performed once. [Read more about Idempotent Requests here](/developers/references/idempotency/).",
        "in": "header",
        "name": "Idempotency-Key",
        "required": false,
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "address_account": {
        "allOf": [
          {
            "$ref": "#/components/schemas/address"
          },
          {
            "properties": {
              "default": {
                "description": "Set this to true to make this the default shipping address. There can be only one address with default set to true.",
                "type": "boolean"
              },
              "metadata": {
                "$ref": "#/components/schemas/shopper_metadata"
              }
            },
            "type": "object"
          }
        ],
        "type": "object"
      },
      "address": {
        "description": "The Address object is used for billing, shipping, and physical store address use cases.",
        "properties": {
          "company": {
            "description": "The company name associated with this address.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "Bolt"
            ]
          },
          "country": {
            "description": "The name of the country associated with this address.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "United States"
            ]
          },
          "country_code": {
            "description": "The ISO 3166-1 alpha-2 country code associated with this address.",
            "maxLength": 2,
            "minLength": 2,
            "type": "string",
            "examples": [
              "US"
            ]
          },
          "default": {
            "description": "Whether the added address is now the default address.",
            "type": "boolean",
            "examples": [
              true
            ]
          },
          "door_code": {
            "$ref": "#/components/schemas/door_code"
          },
          "email": {
            "description": "The email address associated with this address.",
            "$ref": "#/components/schemas/email"
          },
          "first_name": {
            "description": "The given name of the person associated with this address.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "Alan"
            ]
          },
          "last_name": {
            "description": "The surname of the person associated with this address.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "Watts"
            ]
          },
          "locality": {
            "description": "The city name details associated with this address.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "Brooklyn"
            ]
          },
          "name": {
            "description": "The given and surname of the person associated with this address.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "Alan Watts"
            ]
          },
          "phone": {
            "description": "The phone number associated with this address.",
            "$ref": "#/components/schemas/phone"
          },
          "postal_code": {
            "description": "The the postal or zip code associated with this address.",
            "maxLength": 32,
            "type": "string",
            "examples": [
              "10044"
            ]
          },
          "region": {
            "description": "**Not Required for NON US addresses**. The region details such as state or province associated with this address.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "NY"
            ]
          },
          "region_code": {
            "description": "The ISO 3166-2 region code associated with this address.\n  - * If specified, value must be valid for the `country`.\n  - * If null, value is inferred from the `region`.\n",
            "maxLength": 1024,
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "NY"
            ]
          },
          "street_address1": {
            "description": "The street number and street name of the address.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "888 main street"
            ]
          },
          "street_address2": {
            "description": "Any apartment, floor, or unit details.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "apt 3021"
            ]
          },
          "street_address3": {
            "description": "Any additional street address details.",
            "maxLength": 1024,
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "c/o Alicia Watts"
            ]
          },
          "street_address4": {
            "description": "Any additional street address details.",
            "maxLength": 1024,
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "Bridge Street Apartment Building B"
            ]
          }
        },
        "required": [
          "street_address1",
          "locality",
          "region",
          "country_code",
          "postal_code",
          "email",
          "first_name",
          "last_name"
        ],
        "type": "object"
      },
      "door_code": {
        "description": "The building door code or community gate code.",
        "maxLength": 1024,
        "type": [
          "string",
          "null"
        ],
        "examples": [
          "123456"
        ]
      },
      "email": {
        "description": "An email address.",
        "format": "email",
        "type": "string",
        "maxLength": 255,
        "examples": [
          "alan.watts@example.com"
        ]
      },
      "phone": {
        "description": "A phone number following E164 standards, in its globalized format, i.e. prepended with a plus sign.",
        "maxLength": 16,
        "type": "string",
        "examples": [
          "+12125550199"
        ]
      },
      "shopper_metadata": {
        "description": "A key-value pair object that allows users to store arbitrary information associated with an object. For any individual account object, we allow up to 50 keys. Keys can be up to 40 characters long and values can be up to 500 characters long. Metadata should not contain any sensitive customer information, like PII (Personally Identifiable Information). For more information about metadata, see our [documentation](https://help.boltapp.com/developers/references/embedded-metadata/).\n",
        "properties": {
          "additionalProperties": {
            "type": "string"
          }
        },
        "type": [
          "object",
          "null"
        ],
        "examples": [
          {
            "customer_id": 234
          }
        ]
      },
      "address_view_account": {
        "description": "The address object returned in the response.",
        "allOf": [
          {
            "$ref": "#/components/schemas/address_view"
          },
          {
            "properties": {
              "metadata": {
                "$ref": "#/components/schemas/shopper_metadata"
              }
            }
          }
        ],
        "type": "object"
      },
      "address_view": {
        "description": "The address object returned in the response.",
        "properties": {
          "company": {
            "description": "The company name associated with this address.",
            "type": "string",
            "examples": [
              "Bolt"
            ]
          },
          "country": {
            "description": "The name of the country associated with this address.",
            "type": "string",
            "examples": [
              "United States"
            ]
          },
          "country_code": {
            "description": "The ISO 3166-1 alpha-2 country code associated with this address.",
            "type": "string",
            "examples": [
              "US"
            ]
          },
          "door_code": {
            "$ref": "#/components/schemas/door_code"
          },
          "email_address": {
            "description": "The email address associated with this address.",
            "$ref": "#/components/schemas/email"
          },
          "first_name": {
            "description": "The given name of the person associated with this address.",
            "type": "string",
            "examples": [
              "Alan"
            ]
          },
          "id": {
            "description": "The unique Bolt ID associated with this address.",
            "type": "string"
          },
          "last_name": {
            "description": "The surname of the person associated with this address.",
            "type": "string",
            "examples": [
              "Watts"
            ]
          },
          "locality": {
            "description": "The city name details associated with this address.",
            "type": "string",
            "examples": [
              "Brooklyn"
            ]
          },
          "name": {
            "description": "The given and surname of the person associated with this address.",
            "type": "string",
            "examples": [
              "Alan Watts"
            ]
          },
          "phone_number": {
            "description": "The phone number associated with this address.",
            "$ref": "#/components/schemas/phone"
          },
          "postal_code": {
            "description": "The postal or zip code associated with this address.",
            "maxLength": 32,
            "type": "string",
            "examples": [
              "10044"
            ]
          },
          "priority": {
            "description": "The shopper-indicated priority of this address compared to other addresses on their account.",
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "primary",
              "listed"
            ],
            "examples": [
              "primary"
            ]
          },
          "region": {
            "description": "The region details such as state or province associated with this address.",
            "type": "string",
            "examples": [
              "NY"
            ]
          },
          "region_code": {
            "description": "The the ISO 3166-2 region code associated with this address.",
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "NY"
            ]
          },
          "street_address1": {
            "description": "The street number and street name of the address.",
            "type": "string",
            "examples": [
              "888 main street"
            ]
          },
          "street_address2": {
            "description": "Any apartment, floor, or unit details.",
            "type": "string",
            "examples": [
              "apt 3021"
            ]
          },
          "street_address3": {
            "description": "Any additional street address details.",
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "c/o Alicia Watts"
            ]
          },
          "street_address4": {
            "description": "Any additional street address details.",
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "Bridge Street Apartment Building B"
            ]
          }
        },
        "type": "object"
      }
    },
    "securitySchemes": {
      "OAuth": {
        "description": "Bolt utilizes the OAuth flow that developers can use to attain access to Bolt Account data via APIs.\nFor all APIs that require authorization, please provide your `access_token` returned from `/v1/oauth/token` via the basic auth bearer header `Authorization: bearer ${TOKEN}`.\n[Read more about the OAuth token endpoint.](/api-bolt/#tag/OAuth)\n",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://api.boltapp.com/v1/oauth/authorize",
            "refreshUrl": "https://api.boltapp.com/v1/oauth/token",
            "scopes": {
              "bolt.account.manage": "This scope grants permissions to perform read/edit/delete actions on Bolt Account data",
              "bolt.account.view": "This scope grants permissions to perform read only actions on Bolt Account data",
              "openid": "This scope grants permissions that enable Bolt SSO by granting an id token JWT that stores account data. Not used in v1/account endpoints"
            },
            "tokenUrl": "https://api.boltapp.com/v1/oauth/token"
          }
        },
        "type": "oauth2"
      },
      "X-API-Key": {
        "description": "Admins and Developers can obtain their Bolt API key from the Bolt Merchant Dashboard.",
        "in": "header",
        "name": "X-API-Key",
        "type": "apiKey"
      }
    }
  }
}
```
