GET
/
store
/
customers
/
me
/
addresses
import Medusa from "@medusajs/js-sdk"

let MEDUSA_BACKEND_URL = "http://localhost:9000"

if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
  MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}

export const sdk = new Medusa({
  baseUrl: MEDUSA_BACKEND_URL,
  debug: process.env.NODE_ENV === "development",
  publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})

sdk.store.customer.listAddress()
.then(({ addresses, count, offset, limit }) => {
  console.log(addresses)
})
{
"limit": 123,
"offset": 123,
"count": 123,
"addresses": [
{
"id": "<string>",
"address_name": "<string>",
"is_default_shipping": true,
"is_default_billing": true,
"customer_id": "<string>",
"company": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"country_code": "usd",
"province": "us-ca",
"postal_code": "<string>",
"phone": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"estimate_count": 123
}

Authorizations

connect.sid
string
cookie
required

Headers

x-publishable-api-key
string
required

Publishable API Key created in the Medusa Admin.

Query Parameters

fields
string

Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields. This API route restricts the fields that can be selected. Learn how to override the retrievable fields in the Retrieve Custom Links documentation.

offset
number

The number of items to skip when retrieving a list.

limit
number

Limit the number of items returned in the list.

order
string

The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.

city

Filter by the address's city. Filter by a city.

postal_code

Filter by the address's postal code. Filter by a postal code.

country_code

Filter by the address's country code. Filter by a country code.

q
string

Search term to filter the address's searchable properties.

with_deleted
boolean

Whether to include deleted records in the result.

Response

200
application/json

OK

The paginated list of customer addresses.