CustomerAddress

A customer address resource instance represents one of the many addresses a customer may have

For more information about Customers, see the Customer API Documentation

What you can do with CustomerAddress

The Shopify API lets you do the following with the CustomerAddress resource. More detailed versions of these general actions may be available:

CustomerAddress properties

address1
"address1": "1 Rue des Carrieres"

address2
"address2": "Suite 1234"

city
"city": "Montreal"

company
"company": "Fancy Co."

Company name associated with address (optional)

first_name
"first_name": "Samuel"

last_name
"last_name": "de Champlain"

phone
"phone": "819-555-5555"

province
"province": "Quebec"

country
"country": "Canada"

zip
"zip": "G1R 4P5"

name
"name": "Samuel de Champlain"

province_code
"province_code": "QC"

country_code
"country_code": "CA"

Country Code in ISO 3166-1 (alpha-2) format. See Current ISO Codes

country_name
"country_name": "Canada"

Endpoints

GET /admin/customers/207119551/addresses.json
Retrieve all addresses for a customer

Get all of a customer's addresses

GET /admin/customers/#{id}/addresses.json
View Response
HTTP/1.1 200 OK
{
  "addresses": [
    {
      "id": 207119551,
      "first_name": null,
      "last_name": null,
      "company": null,
      "address1": "Chestnut Street 92",
      "address2": "",
      "city": "Louisville",
      "province": "Kentucky",
      "country": "United States",
      "zip": "40202",
      "phone": "555-625-1199",
      "name": "",
      "province_code": "KY",
      "country_code": "US",
      "country_name": "United States",
      "default": true
    }
  ]
}

Get a limited number of addresses for a customer

GET /admin/customers/#{id}/addresses.json?limit=1&page=1
View Response
HTTP/1.1 200 OK
{
  "addresses": [
    {
      "id": 207119551,
      "first_name": null,
      "last_name": null,
      "company": null,
      "address1": "Chestnut Street 92",
      "address2": "",
      "city": "Louisville",
      "province": "Kentucky",
      "country": "United States",
      "zip": "40202",
      "phone": "555-625-1199",
      "name": "",
      "province_code": "KY",
      "country_code": "US",
      "country_name": "United States",
      "default": true
    }
  ]
}
GET /admin/customers/207119551/addresses/207119551.json
Retrieve details for one of a customers addresses

Get a single customers address

GET /admin/customers/#{id}/addresses/#{id}.json
View Response
HTTP/1.1 200 OK
{
  "customer_address": {
    "id": 207119551,
    "first_name": null,
    "last_name": null,
    "company": null,
    "address1": "Chestnut Street 92",
    "address2": "",
    "city": "Louisville",
    "province": "Kentucky",
    "country": "United States",
    "zip": "40202",
    "phone": "555-625-1199",
    "name": "",
    "province_code": "KY",
    "country_code": "US",
    "country_name": "United States",
    "default": true
  }
}
POST /admin/customers/207119551/addresses.json
Creates a new address for a customer

Creating a new address for a customer

POST /admin/customers/#{id}/addresses.json
{
  "address": {
    "address1": "1 Rue des Carrieres",
    "address2": "Suite 1234",
    "city": "Montreal",
    "company": "Fancy Co.",
    "first_name": "Samuel",
    "last_name": "de Champlain",
    "phone": "819-555-5555",
    "province": "Quebec",
    "country": "Canada",
    "zip": "G1R 4P5",
    "name": "Samuel de Champlain",
    "province_code": "QC",
    "country_code": "CA",
    "country_name": "Canada"
  }
}
View Response
HTTP/1.1 201 Created
{
  "customer_address": {
    "id": 1053317309,
    "first_name": "Samuel",
    "last_name": "de Champlain",
    "company": "Fancy Co.",
    "address1": "1 Rue des Carrieres",
    "address2": "Suite 1234",
    "city": "Montreal",
    "province": "Quebec",
    "country": "Canada",
    "zip": "G1R 4P5",
    "phone": "819-555-5555",
    "name": "Samuel de Champlain",
    "province_code": "QC",
    "country_code": "CA",
    "country_name": "Canada",
    "default": false
  }
}
PUT /admin/customers/207119551/addresses/207119551.json
Updates the values on an existing customer address

Updating a customers postal code

PUT /admin/customers/#{id}/addresses/#{id}.json
{
  "address": {
    "id": 207119551,
    "zip": "90210"
  }
}
View Response
HTTP/1.1 200 OK
{
  "customer_address": {
    "id": 207119551,
    "first_name": null,
    "last_name": null,
    "company": null,
    "address1": "Chestnut Street 92",
    "address2": "",
    "city": "Louisville",
    "province": "Kentucky",
    "country": "United States",
    "zip": "90210",
    "phone": "555-625-1199",
    "name": "",
    "province_code": "KY",
    "country_code": "US",
    "country_name": "United States",
    "default": true
  }
}
DELETE /admin/customers/207119551/addresses/207119551.json
Removes an address from the customers address list

Trying to remove a customers default address results in a failure

DELETE /admin/customers/#{id}/addresses/#{id}.json
View Response
HTTP/1.1 422 Unprocessable Entity
{
  "errors": {
    "base": [
      "Cannot delete the customers default address"
    ]
  }
}

Removing a customers address

DELETE /admin/customers/#{id}/addresses/#{id}.json
View Response
HTTP/1.1 200 OK
{}
PUT /admin/customers/207119551/addresses/set.json

destroying multiple customer addresses

PUT /admin/customers/#{id}/addresses/set.json?address_ids[]=1053317310&operation=destroy
View Response
HTTP/1.1 200 OK
{}
PUT /admin/customers/207119551/addresses/1053317308/default.json

assigning a new default address to a customer

PUT /admin/customers/#{id}/addresses/#{id}/default.json
View Response
HTTP/1.1 200 OK
{
  "customer_address": {
    "id": 1053317308,
    "first_name": "Bob",
    "last_name": "Norman",
    "company": null,
    "address1": "Chestnut Street 92",
    "address2": "",
    "city": "Louisville",
    "province": "Kentucky",
    "country": "United States",
    "zip": "40202",
    "phone": "555-625-1199",
    "name": "Bob Norman",
    "province_code": "KY",
    "country_code": "US",
    "country_name": "United States",
    "default": true
  }
}