Returns all addresses in the customer address book
import { createSpreeClient } from '@spree/sdk'
const client = createSpreeClient({
baseUrl: 'https://your-store.com',
publishableKey: '<api-key>',
})
const addresses = await client.store.customer.addresses.list({}, {
bearerToken: '<token>',
}){
"data": [
{
"id": "addr_EfhxLZ9ck8",
"firstname": "John",
"lastname": "Doe",
"full_name": "John Doe",
"address1": "3 Lovely Street",
"address2": "Northwest",
"city": "Herndon",
"zipcode": "35005",
"phone": "555-555-0199",
"company": "Company",
"country_name": "NAME_1",
"country_iso": "I1",
"state_text": "STATE_ABBR_1",
"state_abbr": "STATE_ABBR_1",
"quick_checkout": false,
"state_name": "STATE_NAME_1"
},
{
"id": "addr_gbHJdmfrXB",
"firstname": "John",
"lastname": "Doe",
"full_name": "John Doe",
"address1": "2 Lovely Street",
"address2": "Northwest",
"city": "Herndon",
"zipcode": "35005",
"phone": "555-555-0199",
"company": "Company",
"country_name": "United States of America",
"country_iso": "US",
"state_text": "STATE_ABBR_3",
"state_abbr": "STATE_ABBR_3",
"quick_checkout": false,
"state_name": "STATE_NAME_3"
},
{
"id": "addr_UkLWZg9DAJ",
"firstname": "John",
"lastname": "Doe",
"full_name": "John Doe",
"address1": "1 Lovely Street",
"address2": "Northwest",
"city": "Herndon",
"zipcode": "35005",
"phone": "555-555-0199",
"company": "Company",
"country_name": "United States of America",
"country_iso": "US",
"state_text": "STATE_ABBR_2",
"state_abbr": "STATE_ABBR_2",
"quick_checkout": false,
"state_name": "STATE_NAME_2"
}
],
"meta": {
"page": 1,
"limit": 25,
"count": 3,
"pages": 1,
"from": 1,
"to": 3,
"in": 3,
"previous": null,
"next": null
}
}Publishable API key for store access
JWT token for authenticated customers
Was this page helpful?
import { createSpreeClient } from '@spree/sdk'
const client = createSpreeClient({
baseUrl: 'https://your-store.com',
publishableKey: '<api-key>',
})
const addresses = await client.store.customer.addresses.list({}, {
bearerToken: '<token>',
}){
"data": [
{
"id": "addr_EfhxLZ9ck8",
"firstname": "John",
"lastname": "Doe",
"full_name": "John Doe",
"address1": "3 Lovely Street",
"address2": "Northwest",
"city": "Herndon",
"zipcode": "35005",
"phone": "555-555-0199",
"company": "Company",
"country_name": "NAME_1",
"country_iso": "I1",
"state_text": "STATE_ABBR_1",
"state_abbr": "STATE_ABBR_1",
"quick_checkout": false,
"state_name": "STATE_NAME_1"
},
{
"id": "addr_gbHJdmfrXB",
"firstname": "John",
"lastname": "Doe",
"full_name": "John Doe",
"address1": "2 Lovely Street",
"address2": "Northwest",
"city": "Herndon",
"zipcode": "35005",
"phone": "555-555-0199",
"company": "Company",
"country_name": "United States of America",
"country_iso": "US",
"state_text": "STATE_ABBR_3",
"state_abbr": "STATE_ABBR_3",
"quick_checkout": false,
"state_name": "STATE_NAME_3"
},
{
"id": "addr_UkLWZg9DAJ",
"firstname": "John",
"lastname": "Doe",
"full_name": "John Doe",
"address1": "1 Lovely Street",
"address2": "Northwest",
"city": "Herndon",
"zipcode": "35005",
"phone": "555-555-0199",
"company": "Company",
"country_name": "United States of America",
"country_iso": "US",
"state_text": "STATE_ABBR_2",
"state_abbr": "STATE_ABBR_2",
"quick_checkout": false,
"state_name": "STATE_NAME_2"
}
],
"meta": {
"page": 1,
"limit": 25,
"count": 3,
"pages": 1,
"from": 1,
"to": 3,
"in": 3,
"previous": null,
"next": null
}
}