Update an address

How to update an existing address via API

To update an existing address, send a PATCH request to the /api/addresses/:id endpoint, where id is the ID of the resource that you want to update.

Here below the list of all the possible arguments that you can pass with the request body.

Request

PATCH https://yourdomain.commercelayer.io/api/addresses/:id

Arguments

Body Parameter
Type
Required

type

string

Required

id

string

Required

attributes.business

boolean

Optional

attributes.first_name

string

Optional

attributes.last_name

string

Optional

attributes.company

string

Optional

attributes.line_1

string

Optional

attributes.line_2

string

Optional

attributes.city

string

Optional

attributes.zip_code

string

Optional

attributes.state_code

string

Optional

attributes.country_code

string

Optional

attributes.phone

string

Optional

attributes.email

string

Optional

attributes.notes

string

Optional

attributes.lat

float

Optional

attributes.lng

float

Optional

attributes.billing_info

string

Optional

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

relationships.geocoder

object

Optional

relationships.tags

array

Optional

Example

The following request updates the address identified by the ID "xYZkjABcde":

curl -g -X PATCH \
  'https://yourdomain.commercelayer.io/api/addresses/xYZkjABcde' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "addresses",
    "id": "xYZkjABcde",
    "attributes": {
      "line_2": "Apt.23"
    },
    "relationships": {
      "geocoder": {
        "data": {
          "type": "geocoders",
          "id": "ABCRtyUpBa"
        }
      }
    }
  }
}'

Last updated