Skip to main content

List Customer Addresses

Retrieves a list of all addresses for a specific customer with filtering, searching, and ordering capabilities.

HTTP Request

GET/api/customers/:id/addresses

Authorization

Authorization

  • Required: Yes
  • Permission: Staff or Admin
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Path Parameters

ParameterTypeRequiredDescription
idIntegerYesUnique ID of the customer

Query Parameters

ParameterTypeDefaultDescription
limitinteger10Number of results to return per page
offsetinteger0Number of results to skip before returning results
searchstringSearch term to filter results by first_name, last_name, postal_code, address
orderingstringField to order results by (id, country, state, city, created_at, updated_at, default)
country_instringFilter by multiple country IDs (comma-separated: 1,2,3)
state_instringFilter by multiple state IDs (comma-separated: 1,2,3)
city_instringFilter by multiple city IDs (comma-separated: 1,2,3)
country_idintegerFilter by specific country ID
state_idintegerFilter by specific state ID
city_idintegerFilter by specific city ID
has_national_codebooleanFilter addresses with/without national code
id_minintegerMinimum ID filter
id_maxintegerMaximum ID filter
created_datestringFilter by creation date (e.g., 2023-01-01)
updated_datestringFilter by last updated date (e.g., 2023-01-01)
created_fromstringFilter by creation date range start
created_tostringFilter by creation date range end
updated_fromstringFilter by last updated date range start
updated_tostringFilter by last updated date range end

Example Requests

1import requests
2
3# List all addresses for customer
4response = requests.get('http://www.example.com/api/customers/123/addresses', 
5  headers={'Authorization': 'Token <your_api_key>'}
6)
7print(response.json())
8
9# Search for addresses with filters
10response = requests.get('http://www.example.com/api/customers/123/addresses', params={
11  'search': 'john',
12  'country_id': 1,
13  'has_national_code': True,
14  'ordering': '-created_at',
15  'limit': 20
16}, headers={'Authorization': 'Token <your_api_key>'})
17print(response.json())
18
19# Filter by location
20response = requests.get('http://www.example.com/api/customers/123/addresses', params={
21  'country_in': '1,2,3',
22  'state_id': 5,
23  'created_from': '2023-01-01'
24}, headers={'Authorization': 'Token <your_api_key>'})
25print(response.json())

Status Codes

CodeDescription
200Customer addresses retrieved successfully
401Unauthorized — authentication required
403Forbidden — insufficient permissions
404Customer not found
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the address
defaultBooleanWhether this is the customer's default address
country_dataObjectCountry information with id, name, etc.
state_dataObjectState information with id, name, etc.
city_dataObjectCity information with id, name, etc.
addressStringStreet address
postal_codeStringPostal/ZIP code
first_nameStringFirst name on the address
last_nameStringLast name on the address
national_codeStringNational identification code
mobile_numberStringMobile phone number for this address
textStringAdditional text/notes for the address
created_atString (ISO 8601)Timestamp when address was created
updated_atString (ISO 8601)Timestamp when address was last updated

Country Data Structure

FieldTypeDescription
idIntegerUnique ID of the country
nameStringName of the country
codeStringISO country code (e.g., US, CA)

State Data Structure

FieldTypeDescription
idIntegerUnique ID of the state
nameStringName of the state
codeStringState code (if applicable)

City Data Structure

FieldTypeDescription
idIntegerUnique ID of the city
nameStringName of the city