List All Addresses
List all addresses with full CRUD operations.
HTTP Request
List Addresses:
GET/api/shop/customers/me/addresses
Authorization
Authorization
- Required: Yes
- Permission: Authenticated Customer
- Authentication: Token-based (`Authorization: Token <your_api_key>`)
Query Parameters (GET only)
| Parameter | Type | Default | Description |
|---|---|---|---|
| limit | integer | 10 | Number of results to return per page |
| offset | integer | 0 | Number of results to skip |
| search | string | — | Search in `first_name`, `last_name`, `postal_code`, `address`, `country__name`, `country__code`, `state__name`, `state__code`, `city__name`, `mobile_number` |
| ordering | string | — | Order results by (`id`, `country`, `state`, `city`, `created_at`, `updated_at`, `default`) |
| country_in | string | — | Filter by multiple country IDs (comma-separated) |
| state_in | string | — | Filter by multiple state IDs (comma-separated) |
| city_in | string | — | Filter by multiple city IDs (comma-separated) |
| 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 |
| id_min | integer | — | Minimum ID filter |
| id_max | integer | — | Maximum ID filter |
| created_date | string | — | Filter by creation date |
| updated_date | string | — | Filter by last updated date |
| 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 |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3# List customer addresses
4response = requests.get('http://www.example.com/api/shop/customers/me/addresses',
5 params={
6 'ordering': '-created_at',
7 'limit': 20,
8 'search': 'john'
9 },
10 headers={'Authorization': 'Token <your_api_key>'}
11)
12print(response.json())1# List customer addresses with filters
2curl "http://www.example.com/api/shop/customers/me/addresses?ordering=-created_at&limit=20&country_id=1" -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 customer address objects |
CustomerAddress Object Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the address |
| default | Boolean | Whether this is the default address |
| country_data | Object | Country details (read-only) |
| state_data | Object | State details (read-only) |
| city_data | Object | City details (read-only) |
| address | String | Detailed address |
| postal_code | String | Postal/ZIP code |
| first_name | String | Recipients first name |
| last_name | String | Recipients last name |
| national_code | String | National identification code |
| mobile_number | String | Recipients mobile number |
| text | String | Additional notes |
| created_at | String (ISO 8601) | Timestamp when address was created |
| updated_at | String (ISO 8601) | Timestamp when address was last updated |
Country/State Data Structure:
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID |
| name | String | Name of the country/state |
| code | String | Code (e.g., ISO code for country) |
City Data Structure:
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID |
| name | String | Name of the city |
Example Response
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 2,
"default": false,
"country_data": {
"id": 1,
"name": "ایران",
"code": "IR"
},
"state_data": {
"id": 11,
"name": "خراسان رضوی",
"code": "RK"
},
"city_data": {
"id": 443,
"name": "مشهد"
},
"address": "بلوار معلم",
"postal_code": "",
"first_name": "",
"last_name": "",
"national_code": null,
"mobile_number": "09150207215",
"text": "ایران-خراسان رضوی-مشهد-بلوار معلم",
"created_at": "2025-11-22T13:20:32.785821Z",
"updated_at": "2025-11-22T13:20:32.785825Z"
},
{
"id": 1,
"default": false,
"country_data": {
"id": 1,
"name": "ایران",
"code": "IR"
},
"state_data": {
"id": 11,
"name": "خراسان رضوی",
"code": "RK"
},
"city_data": {
"id": 443,
"name": "مشهد"
},
"address": "بلوار اندیشه",
"postal_code": "",
"first_name": "",
"last_name": "",
"national_code": null,
"mobile_number": "09308744204",
"text": "ایران-خراسان رضوی-مشهد-بلوار اندیشه",
"created_at": "2025-11-22T13:19:31.288646Z",
"updated_at": "2025-11-22T13:20:32.784635Z"
}
]
}
Notes
- Geographic Validation: State must belong to the specified country, and city must belong to the specified state
- Access Control: Customers can only access their own addresses
- Default Address: Only one address can be set as default per customer