Update Address
Update an existing address for the authenticated user.
Endpoint
Authentication
Required (User role)
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
integer | Yes | Address ID |
Request Body
Parameters
| Field | Type | Required | Description | Validation |
|---|---|---|---|---|
city_id |
integer | No | City ID | Must exist (if provided) |
zip_code |
string | No | Postal/ZIP code | - |
address |
string | No | Street address | - |
phone |
string | No | Phone number for this address | Valid phone format (if provided) |
Response
Success (200 OK)
{
"id": 1,
"user_id": 1,
"user": {
"id": 1,
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"phone": "+994501234567",
"profile_photo": "",
"preferred_language": "AZERBAIJANI",
"role": "1",
"created": "2025-01-15T10:30:00Z"
},
"city_id": 2,
"city": {
"id": 2,
"name": "Ganja",
"country_id": 1,
"country": {
"id": 1,
"name": "Azerbaijan",
"created": "2025-01-15T10:30:00Z"
},
"created": "2025-01-15T10:30:00Z"
},
"zip_code": "AZ2000",
"address": "456 New Street",
"phone": "+994509876543",
"created": "2025-01-15T10:30:00Z"
}
Error Responses
Address Not Found (404)
City Not Found (404)
Example Request
curl -X PUT "https://api.luxmart.site/v1/accounts/address/?id=1" \
-H "Authorization: Token your_access_token" \
-H "Content-Type: application/json" \
-d '{
"city_id": 2,
"zip_code": "AZ2000",
"address": "456 New Street",
"phone": "+994509876543"
}'
Notes
- Only provided fields are updated
- Address must belong to the authenticated user
- City must exist and not be deleted if city_id is provided