--- title: Customer Address description: >- Manage the customer addresses for a store. Customers can have multiple addresses, one of which is the default address that's used to calculate taxes and shipping charges. api_version: 2024-10 api_name: admin_rest api_type: rest source_url: html: 'https://shopify.dev/docs/api/admin-rest/2024-10/resources/customer-address' md: >- https://shopify.dev/docs/api/admin-rest/2024-10/resources/customer-address.txt --- ![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg) The REST Admin API is a legacy API as of October 1, 2024. Starting April 1, 2025, all new public apps must be built exclusively with the [GraphQL Admin API](https://shopify.dev/docs/api/admin-graphql). For details and migration steps, visit our [migration guide](https://shopify.dev/docs/apps/build/graphql/migrate). # Customer Address Requires `customers` access scope. Requires access to [protected customer data](https://shopify.dev/apps/store/data-protection/protected-customer-data). The Customer Address resource represents addresses that a customer has added. Each customer can have multiple addresses associated with them. For more information about the Customer resource, see [*Customer*](https://shopify.dev/docs/admin-api/rest/reference/customers/customer). \# ## Endpoints * [post](https://shopify.dev/docs/api/admin-rest/2024-10/resources/customer-address.txt#post-customers-customer-id-addresses) [/admin/api/2024-10/customers/{customer\_​id}/addresses.​json](https://shopify.dev/docs/api/admin-rest/2024-10/resources/customer-address.txt#post-customers-customer-id-addresses) Creates a new address for a customer [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerUpdate?example=creates-a-new-address-for-a-customer) [customerUpdate](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerUpdate?example=creates-a-new-address-for-a-customer) * [get](https://shopify.dev/docs/api/admin-rest/2024-10/resources/customer-address.txt#get-customers-customer-id-addresses?limit=1) [/admin/api/2024-10/customers/{customer\_​id}/addresses.​json?limit=1](https://shopify.dev/docs/api/admin-rest/2024-10/resources/customer-address.txt#get-customers-customer-id-addresses?limit=1) Retrieves a list of addresses for a customer [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/queries/customer?example=retrieves-a-list-of-addresses-for-a-customer) [customer](https://shopify.dev/docs/api/admin-graphql/latest/queries/customer?example=retrieves-a-list-of-addresses-for-a-customer) * [get](https://shopify.dev/docs/api/admin-rest/2024-10/resources/customer-address.txt#get-customers-customer-id-addresses-address-id) [/admin/api/2024-10/customers/{customer\_​id}/addresses/{address\_​id}.​json](https://shopify.dev/docs/api/admin-rest/2024-10/resources/customer-address.txt#get-customers-customer-id-addresses-address-id) Retrieves details for a single customer address [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/queries/customer) [customer](https://shopify.dev/docs/api/admin-graphql/latest/queries/customer) * [put](https://shopify.dev/docs/api/admin-rest/2024-10/resources/customer-address.txt#put-customers-customer-id-addresses-address-id) [/admin/api/2024-10/customers/{customer\_​id}/addresses/{address\_​id}.​json](https://shopify.dev/docs/api/admin-rest/2024-10/resources/customer-address.txt#put-customers-customer-id-addresses-address-id) Updates an existing customer address [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerUpdateDefaultAddress?example=updates-an-existing-customer-address) [customerUpdateDefaultAddress](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerUpdateDefaultAddress?example=updates-an-existing-customer-address) * [put](https://shopify.dev/docs/api/admin-rest/2024-10/resources/customer-address.txt#put-customers-customer-id-addresses-address-id-default) [/admin/api/2024-10/customers/{customer\_​id}/addresses/{address\_​id}/default.​json](https://shopify.dev/docs/api/admin-rest/2024-10/resources/customer-address.txt#put-customers-customer-id-addresses-address-id-default) Sets the default address for a customer [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerUpdateDefaultAddress?example=sets-the-default-address-for-a-customer) [customerUpdateDefaultAddress](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerUpdateDefaultAddress?example=sets-the-default-address-for-a-customer) * [put](https://shopify.dev/docs/api/admin-rest/2024-10/resources/customer-address.txt#put-customers-customer-id-addresses-set?address-ids\[]=1053317311\&operation=destroy) [/admin/api/2024-10/customers/{customer\_​id}/addresses/set.​json?address\_​ids\[\]=1053317311\&operation=destroy](https://shopify.dev/docs/api/admin-rest/2024-10/resources/customer-address.txt#put-customers-customer-id-addresses-set?address-ids\[]=1053317311\&operation=destroy) Performs bulk operations for multiple customer addresses [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerUpdate?example=performs-bulk-operations-for-multiple-customer-addresses) [customerUpdate](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerUpdate?example=performs-bulk-operations-for-multiple-customer-addresses) * [del](https://shopify.dev/docs/api/admin-rest/2024-10/resources/customer-address.txt#delete-customers-customer-id-addresses-address-id) [/admin/api/2024-10/customers/{customer\_​id}/addresses/{address\_​id}.​json](https://shopify.dev/docs/api/admin-rest/2024-10/resources/customer-address.txt#delete-customers-customer-id-addresses-address-id) Removes an address from a customer’s address list *** ## The Customer Address resource ### Properties *** address1 -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.address1) [address1](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.address1) The customer's mailing address *** address2 -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.address2) [address2](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.address2) An additional field for the customer's mailing address. *** city -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.city) [city](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.city) The customer's city, town, or village. *** country -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.country) [country](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.country) The customer's country. *** country\_code read-only -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.countryCodeV2) [countryCodeV2](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.countryCodeV2) The two-letter country code corresponding to the customer's country. *** country\_name -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.country) [country](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.country) The customer’s normalized country name. *** company -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.company) [company](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.company) The customer’s company. *** customer\_id deprecated The unique identifier for the customer. *** first\_name -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.firstName) [firstName](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.firstName) The customer’s first name. *** id read-only -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.id) [id](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.id) The unique identifier for the address. *** last\_name -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.lastName) [lastName](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.lastName) The customer’s last name. *** name -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.name) [name](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress#field-MailingAddress.fields.name) The customer’s first and last names. *** {} ## The Customer Address resource ```json { "address1": "1 Rue des Carrieres", "address2": "Suite 1234", "city": "Montreal", "country": "Canada", "country_code": "CA", "country_name": "Canada", "company": "Fancy Co.", "customer_id": { "id": 1073339470 }, "first_name": "Samuel", "id": 207119551, "last_name": "de Champlain", "name": "Samuel de Champlain", "phone": "819-555-5555", "province": "Quebec", "province_code": "QC", "zip": "G1R 4P5" } ``` *** ## postCreates a new address for a customer [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerUpdate?example=creates-a-new-address-for-a-customer) [customerUpdate](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerUpdate?example=creates-a-new-address-for-a-customer) Creates a new address for a customer. ### Parameters *** api\_version string required *** customer\_id string required *** ### Examples Create a new address for a customer Path parameters customer\_​id=​207119551 string required post ## /admin/api/2024-10/customers/207119551/addresses.​json ```bash curl -d '{"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"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` {} ## Response JSON ```json HTTP/1.1 201 Created { "customer_address": { "id": 1053317309, "customer_id": 207119551, "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 } } ``` ### examples * #### Create a new address for a customer ##### ```curl curl -d '{"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"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const customer_address = new admin.rest.resources.CustomerAddress({session: session}); customer_address.customer_id = 207119551; customer_address.address1 = "1 Rue des Carrieres"; customer_address.address2 = "Suite 1234"; customer_address.city = "Montreal"; customer_address.company = "Fancy Co."; customer_address.first_name = "Samuel"; customer_address.last_name = "de Champlain"; customer_address.phone = "819-555-5555"; customer_address.province = "Quebec"; customer_address.country = "Canada"; customer_address.zip = "G1R 4P5"; customer_address.name = "Samuel de Champlain"; customer_address.province_code = "QC"; customer_address.country_code = "CA"; customer_address.country_name = "Canada"; await customer_address.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session customer_address = ShopifyAPI::CustomerAddress.new(session: test_session) customer_address.customer_id = 207119551 customer_address.address1 = "1 Rue des Carrieres" customer_address.address2 = "Suite 1234" customer_address.city = "Montreal" customer_address.company = "Fancy Co." customer_address.first_name = "Samuel" customer_address.last_name = "de Champlain" customer_address.phone = "819-555-5555" customer_address.province = "Quebec" customer_address.country = "Canada" customer_address.zip = "G1R 4P5" customer_address.name = "Samuel de Champlain" customer_address.province_code = "QC" customer_address.country_code = "CA" customer_address.country_name = "Canada" customer_address.save! ``` ##### ```node // Session is built by the OAuth process const customer_address = new shopify.rest.CustomerAddress({session: session}); customer_address.customer_id = 207119551; customer_address.address1 = "1 Rue des Carrieres"; customer_address.address2 = "Suite 1234"; customer_address.city = "Montreal"; customer_address.company = "Fancy Co."; customer_address.first_name = "Samuel"; customer_address.last_name = "de Champlain"; customer_address.phone = "819-555-5555"; customer_address.province = "Quebec"; customer_address.country = "Canada"; customer_address.zip = "G1R 4P5"; customer_address.name = "Samuel de Champlain"; customer_address.province_code = "QC"; customer_address.country_code = "CA"; customer_address.country_name = "Canada"; await customer_address.save({ update: true, }); ``` #### response ```json HTTP/1.1 201 Created{"customer_address":{"id":1053317309,"customer_id":207119551,"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}} ``` *** ## getRetrieves a list of addresses for a customer [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/queries/customer?example=retrieves-a-list-of-addresses-for-a-customer) [customer](https://shopify.dev/docs/api/admin-graphql/latest/queries/customer?example=retrieves-a-list-of-addresses-for-a-customer) Retrieves a list of addresses for a customer. **Note:** This endpoint implements pagination by using links that are provided in the response header. To learn more, refer to [Make paginated requests to the REST Admin API](https://shopify.dev/api/usage/pagination-rest). ### Parameters *** api\_version string required *** customer\_id string required *** ### Examples Retrieve a limited number of addresses for a customer Query parameters Retrieve all of a customer’s addresses get ## /admin/api/2024-10/customers/207119551/addresses.​json?limit=​1 ```bash curl -X GET "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses.json?limit=1" \ -H "X-Shopify-Access-Token: {access_token}" ``` {} ## Response JSON ```json HTTP/1.1 200 OK { "addresses": [ { "id": 207119551, "customer_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 } ] } ``` ### examples * #### Retrieve a limited number of addresses for a customer ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses.json?limit=1" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.CustomerAddress.all({ session: session, customer_id: 207119551, limit: "1", }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::CustomerAddress.all( session: test_session, customer_id: 207119551, limit: "1", ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.CustomerAddress.all({ session: session, customer_id: 207119551, limit: "1", }); ``` #### response ```json HTTP/1.1 200 OK{"addresses":[{"id":207119551,"customer_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}]} ``` * #### Retrieve all of a customer’s addresses ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.CustomerAddress.all({ session: session, customer_id: 207119551, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::CustomerAddress.all( session: test_session, customer_id: 207119551, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.CustomerAddress.all({ session: session, customer_id: 207119551, }); ``` #### response ```json HTTP/1.1 200 OK{"addresses":[{"id":207119551,"customer_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}]} ``` *** ## getRetrieves details for a single customer address [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/queries/customer) [customer](https://shopify.dev/docs/api/admin-graphql/latest/queries/customer) Retrieves details for a single customer address. ### Parameters *** address\_id string required *** api\_version string required *** customer\_id string required *** ### Examples Retrieve a single customer address get ## /admin/api/2024-10/customers/207119551/addresses/207119551.​json ```bash curl -X GET "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses/207119551.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` {} ## Response JSON ```json HTTP/1.1 200 OK { "customer_address": { "id": 207119551, "customer_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 } } ``` ### examples * #### Retrieve a single customer address ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses/207119551.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.CustomerAddress.find({ session: session, customer_id: 207119551, id: 207119551, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::CustomerAddress.find( session: test_session, customer_id: 207119551, id: 207119551, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.CustomerAddress.find({ session: session, customer_id: 207119551, id: 207119551, }); ``` #### response ```json HTTP/1.1 200 OK{"customer_address":{"id":207119551,"customer_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}} ``` *** ## putUpdates an existing customer address [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerUpdateDefaultAddress?example=updates-an-existing-customer-address) [customerUpdateDefaultAddress](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerUpdateDefaultAddress?example=updates-an-existing-customer-address) Updates an existing customer address. ### Parameters *** address\_id string required *** api\_version string required *** customer\_id string required *** ### Examples Update the postal code of a customer address Update the street address of a customer address put ## /admin/api/2024-10/customers/207119551/addresses/207119551.​json ```bash curl -d '{"address":{"id":207119551,"zip":"90210"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses/207119551.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` {} ## Response JSON ```json HTTP/1.1 200 OK { "customer_address": { "customer_id": 207119551, "zip": "90210", "country": "United States", "province": "Kentucky", "city": "Louisville", "address1": "Chestnut Street 92", "address2": "", "first_name": null, "last_name": null, "company": null, "phone": "555-625-1199", "id": 207119551, "name": "", "province_code": "KY", "country_code": "US", "country_name": "United States", "default": true } } ``` ### examples * #### Update the postal code of a customer address ##### ```curl curl -d '{"address":{"id":207119551,"zip":"90210"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses/207119551.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const customer_address = new admin.rest.resources.CustomerAddress({session: session}); customer_address.customer_id = 207119551; customer_address.id = 207119551; customer_address.zip = "90210"; await customer_address.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session customer_address = ShopifyAPI::CustomerAddress.new(session: test_session) customer_address.customer_id = 207119551 customer_address.id = 207119551 customer_address.zip = "90210" customer_address.save! ``` ##### ```node // Session is built by the OAuth process const customer_address = new shopify.rest.CustomerAddress({session: session}); customer_address.customer_id = 207119551; customer_address.id = 207119551; customer_address.zip = "90210"; await customer_address.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"customer_address":{"customer_id":207119551,"zip":"90210","country":"United States","province":"Kentucky","city":"Louisville","address1":"Chestnut Street 92","address2":"","first_name":null,"last_name":null,"company":null,"phone":"555-625-1199","id":207119551,"name":"","province_code":"KY","country_code":"US","country_name":"United States","default":true}} ``` * #### Update the street address of a customer address ##### ```curl curl -d '{"address":{"id":207119551,"address1":"Apartment 23","address2":"Chestnut Street 92"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses/207119551.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const customer_address = new admin.rest.resources.CustomerAddress({session: session}); customer_address.customer_id = 207119551; customer_address.id = 207119551; customer_address.address1 = "Apartment 23"; customer_address.address2 = "Chestnut Street 92"; await customer_address.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session customer_address = ShopifyAPI::CustomerAddress.new(session: test_session) customer_address.customer_id = 207119551 customer_address.id = 207119551 customer_address.address1 = "Apartment 23" customer_address.address2 = "Chestnut Street 92" customer_address.save! ``` ##### ```node // Session is built by the OAuth process const customer_address = new shopify.rest.CustomerAddress({session: session}); customer_address.customer_id = 207119551; customer_address.id = 207119551; customer_address.address1 = "Apartment 23"; customer_address.address2 = "Chestnut Street 92"; await customer_address.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"customer_address":{"customer_id":207119551,"address1":"Apartment 23","address2":"Chestnut Street 92","country":"United States","province":"Kentucky","zip":"40202","city":"Louisville","first_name":null,"last_name":null,"company":null,"phone":"555-625-1199","id":207119551,"name":"","province_code":"KY","country_code":"US","country_name":"United States","default":true}} ``` *** ## putSets the default address for a customer [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerUpdateDefaultAddress?example=sets-the-default-address-for-a-customer) [customerUpdateDefaultAddress](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerUpdateDefaultAddress?example=sets-the-default-address-for-a-customer) Sets the default address for a customer. ### Parameters *** address\_id string required *** api\_version string required *** customer\_id string required *** ### Examples Set a default address for a customer put ## /admin/api/2024-10/customers/207119551/addresses/1053317312/default.​json ```bash curl -X PUT "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses/1053317312/default.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` {} ## Response JSON ```json HTTP/1.1 200 OK { "customer_address": { "id": 1053317312, "customer_id": 207119551, "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 } } ``` ### examples * #### Set a default address for a customer ##### ```curl curl -X PUT "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses/1053317312/default.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const customer_address = new admin.rest.resources.CustomerAddress({session: session}); customer_address.customer_id = 207119551; customer_address.id = 1053317312; await customer_address.default({}); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session customer_address = ShopifyAPI::CustomerAddress.new(session: test_session) customer_address.customer_id = 207119551 customer_address.id = 1053317312 customer_address.default( session: test_session, ) ``` ##### ```node // Session is built by the OAuth process const customer_address = new shopify.rest.CustomerAddress({session: session}); customer_address.customer_id = 207119551; customer_address.id = 1053317312; await customer_address.default({}); ``` #### response ```json HTTP/1.1 200 OK{"customer_address":{"id":1053317312,"customer_id":207119551,"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}} ``` *** ## putPerforms bulk operations for multiple customer addresses [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerUpdate?example=performs-bulk-operations-for-multiple-customer-addresses) [customerUpdate](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerUpdate?example=performs-bulk-operations-for-multiple-customer-addresses) Performs bulk operations for multiple customer addresses. ### Parameters *** address\_ids\[] required Performs bulk operations on a list of customer address IDs. Format: `address_ids[]=1&address_ids[]=2&address_ids[]=3`. *** api\_version string required *** customer\_id string required *** operation required Operation to perform by keyword (for example, destroy) *** ### Examples Destroy multiple customer addresses Query parameters address\_​ids\[]=​1053317311 required Performs bulk operations on a list of customer address IDs. Format: `address_ids[]=1&address_ids[]=2&address_ids[]=3`. operation=​destroy required Operation to perform by keyword (for example, destroy) put ## /admin/api/2024-10/customers/207119551/addresses/set.​json?address\_​ids\[]=​1053317311\&operation=​destroy ```bash curl -X PUT "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses/set.json?address_ids%5B%5D=1053317311&operation=destroy" \ -H "X-Shopify-Access-Token: {access_token}" ``` {} ## Response JSON ```json HTTP/1.1 200 OK {} ``` ### examples * #### Destroy multiple customer addresses ##### ```curl curl -X PUT "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses/set.json?address_ids%5B%5D=1053317311&operation=destroy" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const customer_address = new admin.rest.resources.CustomerAddress({session: session}); customer_address.customer_id = 207119551; await customer_address.set({ address_ids: ["1053317311"], operation: "destroy", }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session customer_address = ShopifyAPI::CustomerAddress.new(session: test_session) customer_address.customer_id = 207119551 customer_address.set( session: test_session, address_ids: ["1053317311"], operation: "destroy", ) ``` ##### ```node // Session is built by the OAuth process const customer_address = new shopify.rest.CustomerAddress({session: session}); customer_address.customer_id = 207119551; await customer_address.set({ address_ids: ["1053317311"], operation: "destroy", }); ``` #### response ```json HTTP/1.1 200 OK{} ``` *** ## delRemoves an address from a customer’s address list Removes an address from a customer’s address list. ### Parameters *** address\_id string required *** api\_version string required *** customer\_id string required *** ### Examples Remove a customer address Removing a customer’s default address fails and returns an error del ## /admin/api/2024-10/customers/207119551/addresses/1053317310.​json ```bash curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses/1053317310.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` {} ## Response JSON ```json HTTP/1.1 200 OK {} ``` ### examples * #### Remove a customer address ##### ```curl curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses/1053317310.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.CustomerAddress.delete({ session: session, customer_id: 207119551, id: 1053317310, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::CustomerAddress.delete( session: test_session, customer_id: 207119551, id: 1053317310, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.CustomerAddress.delete({ session: session, customer_id: 207119551, id: 1053317310, }); ``` #### response ```json HTTP/1.1 200 OK{} ``` * #### Removing a customer’s default address fails and returns an error ##### ```curl curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2024-10/customers/207119551/addresses/207119551.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.CustomerAddress.delete({ session: session, customer_id: 207119551, id: 207119551, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::CustomerAddress.delete( session: test_session, customer_id: 207119551, id: 207119551, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.CustomerAddress.delete({ session: session, customer_id: 207119551, id: 207119551, }); ``` #### response ```json HTTP/1.1 422 Unprocessable Entity{"errors":{"base":["Cannot delete the customer’s default address"]}} ```