Create Address
Create a new shipping address for the authenticated user.
Endpoint
Authentication
Required (User role)
Request Body
Parameters
| Field | Type | Required | Description | Validation |
|---|---|---|---|---|
city_id |
integer | Yes | City ID | Must exist |
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": 1,
"city": {
"id": 1,
"name": "Baku",
"country_id": 1,
"country": {
"id": 1,
"name": "Azerbaijan",
"created": "2025-01-15T10:30:00Z"
},
"created": "2025-01-15T10:30:00Z"
},
"zip_code": "AZ1000",
"address": "123 Main Street",
"phone": "+994501234567",
"created": "2025-01-15T10:30:00Z"
}
Error Responses
City Not Found (404)
Validation Error (400)
If phone is provided and invalid:
Example Request
curl -X POST "https://api.luxmart.site/v1/accounts/address/" \
-H "Authorization: Token your_access_token" \
-H "Content-Type: application/json" \
-d '{
"city_id": 1,
"zip_code": "AZ1000",
"address": "123 Main Street",
"phone": "+994501234567"
}'
Notes
- Address is automatically associated with the authenticated user
- City must exist and not be deleted
- Address can be used for order shipping