Skip to main content

Update An Address

Update an existing profile address

HTTP Request

Update Address:

PATCH/api/shop/customers/me/addresses/:id

Authorization

Authorization

  • Required: Yes
  • Permission: Authenticated Customer
  • Authentication: Token-based (`Authorization: Token <your_api_key>`)

Path Parameters

ParameterTypeRequiredDescription
idIntegerYesUnique ID of the address

Request Body (PATCH only)

FieldTypeRequiredDescription
defaultBooleanNoSet as default address
countryIntegerNoCountry ID
stateIntegerNoState ID
cityIntegerNoCity ID
addressStringNoDetailed address
postal_codeStringNoPostal/ZIP code
first_nameStringNoRecipient's first name
last_nameStringNoRecipient's last name
national_codeStringNoNational identification code
mobile_numberStringNoRecipient's mobile number

Example Requests

1import requests
2
3# Update address
4response = requests.patch('http://www.example.com/api/shop/customers/me/addresses/123', 
5  json={
6      'default': True,
7      'postal_code': '54321'
8  },
9  headers={'Authorization': 'Token <your_api_key>'}
10)
11print(response.json())

Response Fields

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

{
"id": 7,
"default": true,
"country_data": {
"id": 1,
"name": "ایران",
"code": "IR"
},
"state_data": {
"id": 17,
"name": "فارس",
"code": "FA"
},
"city_data": {
"id": 642,
"name": "ششده"
},
"address": "7687 Barney Burgs",
"postal_code": "6934169688",
"first_name": "آرمان",
"last_name": "علی‌زاده",
"national_code": "12343456",
"mobile_number": "09522101669",
"text": "ایران-فارس-ششده-7687 Barney Burgs",
"created_at": "2025-12-30T10:09:51.354368Z",
"updated_at": "2025-12-30T10:16:17.324191Z"
}

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