Create An Address
Create an address for the current authenticated profile
HTTP Request
Create Address:
POST/api/shop/customers/me/addresses
Authorization
Authorization
- Required: Yes
- Permission: Authenticated Customer
- Authentication: Token-based (`Authorization: Token <your_api_key>`)
Request Body (POST only)
| Field | Type | Required | Description |
|---|---|---|---|
| default | Boolean | No | Set as default address |
| country | Integer | Yes | Country ID |
| state | Integer | Yes | State ID |
| city | Integer | Yes | City ID |
| address | String | Yes | Detailed address |
| postal_code | String | Yes | Postal/ZIP code (Valid iranian postal code) |
| first_name | String | Yes | Recipient's first name |
| last_name | String | Yes | Recipient's last name |
| national_code | String | No | National identification code |
| mobile_number | String | Yes | Recipient's mobile number (valid iranian mobile number) |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3# Create new address
4response = requests.post('http://www.example.com/api/shop/customers/me/addresses',
5 json={
6 'default': True,
7 'country': 1,
8 'state': 5,
9 'city': 15,
10 'address': '123 Main Street, Apt 4B',
11 'postal_code': '9865478565',
12 'first_name': 'John',
13 'last_name': 'Doe',
14 'mobile_number': '09125536565'
15 },
16 headers={'Authorization': 'Token <your_api_key>'}
17)
18print(response.json())1# Create new address
2curl -X POST "http://www.example.com/api/shop/customers/me/addresses" -H "Authorization: Token <your_api_key>" -H "Content-Type: application/json" -d '{
3 "default": true,
4 "country": 1,
5 "state": 5,
6 "city": 15,
7 "address": "123 Main Street, Apt 4B",
8 "postal_code": "8991286953",
9 "first_name": "John",
10 "last_name": "Doe",
11 "mobile_number": "09362686548"
12}'Response Fields
| 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
{
"id": 7,
"default": true,
"country_data": {
"id": 1,
"name": "ایران",
"code": "IR"
},
"state_data": {
"id": 17,
"name": "فارس",
"code": "FA"
},
"city_data": {
"id": 642,
"name": "ششده"
},
"address": "713 Wiza Fords",
"postal_code": "6934169688",
"first_name": "پژمان",
"last_name": "اعتماد",
"national_code": null,
"mobile_number": "09501223992",
"text": "ایران-فارس-ششده-713 Wiza Fords",
"created_at": "2025-12-30T10:09:51.354368Z",
"updated_at": "2025-12-30T10:09:51.354376Z"
}
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