Skip to main content

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)

ParameterTypeDefaultDescription
limitinteger10Number of results to return per page
offsetinteger0Number of results to skip
searchstringSearch in `first_name`, `last_name`, `postal_code`, `address`, `country__name`, `country__code`, `state__name`, `state__code`, `city__name`, `mobile_number`
orderingstringOrder results by (`id`, `country`, `state`, `city`, `created_at`, `updated_at`, `default`)
country_instringFilter by multiple country IDs (comma-separated)
state_instringFilter by multiple state IDs (comma-separated)
city_instringFilter by multiple city IDs (comma-separated)
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
updated_datestringFilter by last updated date
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 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())

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 customer address objects

CustomerAddress Object Data Structure

FieldTypeDescription
idIntegerUnique ID of the address
defaultBooleanWhether this is the default address
country_dataObjectCountry details (read-only)
state_dataObjectState details (read-only)
city_dataObjectCity details (read-only)
addressStringDetailed address
postal_codeStringPostal/ZIP code
first_nameStringRecipients first name
last_nameStringRecipients last name
national_codeStringNational identification code
mobile_numberStringRecipients mobile number
textStringAdditional notes
created_atString (ISO 8601)Timestamp when address was created
updated_atString (ISO 8601)Timestamp when address was last updated

Country/State Data Structure:

FieldTypeDescription
idIntegerUnique ID
nameStringName of the country/state
codeStringCode (e.g., ISO code for country)

City Data Structure:

FieldTypeDescription
idIntegerUnique ID
nameStringName 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