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 with CustomerAddressPermission or Admin
  • Permission Code: 1422
  • 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 lookup results by (first_name, last_name, postal_code, address, country__name, country__code, state__name, state__code, city__name, mobile_number)
orderingstring-created_atOrder results by (id, country, state, city, created_at, updated_at, default)
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
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

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())

Response Fields

FieldTypeDescription
countIntegerTotal number of categories
nextStringURL for the next page of results
previousStringURL for the previous page of results
resultsArray[Object]Array of CustomerAddress objects

CustomerAddress Object Structure

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.
addressStringthe text of the address
postal_codeStringPostal/ZIP code (valid iranian postal code)
first_nameStringFirst name on the address
last_nameStringLast name on the address
national_codeStringNational identification code (nullable)
mobile_numberStringMobile phone number for this address (valid iraninan mobile number)
textStringAddress full text (computed value from country, state, city and 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

Example Response

{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 4,
"default": true,
"country_data": {
"id": 1,
"name": "ایران",
"code": "IR"
},
"state_data": {
"id": 1,
"name": "آذربایجان شرقی",
"code": "EA"
},
"city_data": {
"id": 1,
"name": "اسکو"
},
"address": "19964 Hermiston Manors",
"postal_code": "8651989917",
"first_name": "پیروز",
"last_name": "رضوی",
"national_code": null,
"mobile_number": "09492909354",
"text": "ایران-آذربایجان شرقی-اسکو-19964 Hermiston Manors",
"created_at": "2025-12-22T09:36:04.136157Z",
"updated_at": "2025-12-22T09:36:04.136165Z"
}
]
}