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
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | Integer | Yes | Unique ID of the customer |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| limit | integer | 10 | Number of results to return per page |
| offset | integer | 0 | Number of results to skip before returning results |
| search | string | — | Search term to lookup results by (first_name, last_name, postal_code, address, country__name, country__code, state__name, state__code, city__name, mobile_number) |
| ordering | string | -created_at | Order results by (id, country, state, city, created_at, updated_at, default) |
| id_min | integer | — | Minimum ID filter |
| id_max | integer | — | Maximum ID filter |
| created_date | string | — | Filter by creation date (e.g., 2023-01-01) |
| updated_date | string | — | Filter by last updated date (e.g., 2023-01-01) |
| created_from | string | — | Filter by creation date range start |
| created_to | string | — | Filter by creation date range end |
| updated_from | string | — | Filter by last updated date range start |
| updated_to | string | — | Filter by last updated date range end |
| country_in | string | — | Filter by multiple country IDs (comma-separated: 1,2,3) |
| state_in | string | — | Filter by multiple state IDs (comma-separated: 1,2,3) |
| city_in | string | — | Filter by multiple city IDs (comma-separated: 1,2,3) |
| country_id | integer | — | Filter by specific country ID |
| state_id | integer | — | Filter by specific state ID |
| city_id | integer | — | Filter by specific city ID |
| has_national_code | boolean | — | Filter addresses with/without national code |
Example Requests
- 🐍 Python
- 🌐 Curl
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())1# List all addresses for customer
2curl "http://www.example.com/api/customers/123/addresses" -H "Authorization: Token <your_api_key>"
3
4# Search with filters
5curl "http://www.example.com/api/customers/123/addresses?search=john&country_id=1&has_national_code=true&ordering=-created_at&limit=20" \
6-H "Authorization: Token <your_api_key>"
7
8# Filter by location
9curl "http://www.example.com/api/customers/123/addresses?country_in=1,2,3&state_id=5&created_from=2023-01-01" \
10-H "Authorization: Token <your_api_key>"Response Fields
| Field | Type | Description |
|---|---|---|
| count | Integer | Total number of categories |
| next | String | URL for the next page of results |
| previous | String | URL for the previous page of results |
| results | Array[Object] | Array of CustomerAddress objects |
CustomerAddress Object Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the address |
| default | Boolean | Whether this is the customer's default address |
| country_data | Object | Country information with id, name, etc. |
| state_data | Object | State information with id, name, etc. |
| city_data | Object | City information with id, name, etc. |
| address | String | the text of the address |
| postal_code | String | Postal/ZIP code (valid iranian postal code) |
| first_name | String | First name on the address |
| last_name | String | Last name on the address |
| national_code | String | National identification code (nullable) |
| mobile_number | String | Mobile phone number for this address (valid iraninan mobile number) |
| text | String | Address full text (computed value from country, state, city and address) |
| created_at | String (ISO 8601) | Timestamp when address was created |
| updated_at | String (ISO 8601) | Timestamp when address was last updated |
Country Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the country |
| name | String | Name of the country |
| code | String | ISO country code (e.g., US, CA) |
State Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the state |
| name | String | Name of the state |
| code | String | State code (if applicable) |
City Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the city |
| name | String | Name 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"
}
]
}