Skip to main content

Get User Addresses

curl -X GET "https://api.example.com/api/user/address" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json"
Retrieves all active addresses for the authenticated user, sorted by default status and creation date.

Headers

Authorization
string
required
Bearer token for authentication

Query Parameters

platform
string
Platform identifier (e.g., ‘web’, ‘mobile’)

Response

Returns an array of address objects.
id
integer
Unique address identifier
user_id
integer
User ID who owns this address
firstname
string
First name for delivery
lastname
string
Last name for delivery
address1
string
Primary address line
address2
string
Secondary address line (apartment, suite, etc.)
address3
string
Landmark
address4
string
Additional address information
flat
string
Flat/apartment number
city
string
City name
postcode
integer
Postal/ZIP code
zone_id
integer
State/province ID
state
string
State/province name
country_id
integer
Country ID
country_code
string
Country calling code (default: ‘91’)
phone_no
integer
Contact phone number
address_type
string
Address type: ‘HOME’, ‘WORK’, or ‘OTHER’
is_default
integer
Default address flag (1 = default, 0 = not default)
is_active
integer
Active status (1 = active, 0 = deleted)
latitude
string
Geographic latitude (up to 6 decimals)
longitude
string
Geographic longitude (up to 6 decimals)
created_at
string
Address creation timestamp
updated_at
string
Last update timestamp
[
  {
    "id": 567,
    "user_id": 12345,
    "firstname": "John",
    "lastname": "Doe",
    "address1": "123 Main Street",
    "address2": "Apt 4B",
    "address3": "Near Central Park",
    "address4": null,
    "flat": "4B",
    "city": "Mumbai",
    "postcode": 400001,
    "zone_id": 45,
    "state": "Maharashtra",
    "country_id": 99,
    "country_code": "91",
    "phone_no": 9876543210,
    "address_type": "HOME",
    "is_default": 1,
    "is_active": 1,
    "latitude": "19.075983",
    "longitude": "72.877655",
    "created_at": "2025-01-15T10:30:00",
    "updated_at": "2025-01-15T10:30:00"
  },
  {
    "id": 568,
    "user_id": 12345,
    "firstname": "John",
    "lastname": "Doe",
    "address1": "456 Business Plaza",
    "address2": "Floor 12",
    "address3": "Opposite Metro Station",
    "city": "Mumbai",
    "postcode": 400051,
    "zone_id": 45,
    "state": "Maharashtra",
    "country_id": 99,
    "country_code": "91",
    "phone_no": 9876543210,
    "address_type": "WORK",
    "is_default": 0,
    "is_active": 1,
    "latitude": null,
    "longitude": null,
    "created_at": "2025-02-20T14:20:00",
    "updated_at": "2025-02-20T14:20:00"
  }
]

Get Single Address

curl -X GET "https://api.example.com/api/user/address/567" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json"
Retrieves a specific address by ID. Only returns addresses belonging to the authenticated user.

Path Parameters

address_id
integer
required
Unique identifier of the address

Response

Returns a single address object with same fields as the list response.
{
  "id": 567,
  "user_id": 12345,
  "firstname": "John",
  "lastname": "Doe",
  "address1": "123 Main Street",
  "address2": "Apt 4B",
  "address3": "Near Central Park",
  "city": "Mumbai",
  "postcode": 400001,
  "zone_id": 45,
  "state": "Maharashtra",
  "country_id": 99,
  "country_code": "91",
  "phone_no": 9876543210,
  "address_type": "HOME",
  "is_default": 1,
  "is_active": 1,
  "latitude": "19.075983",
  "longitude": "72.877655",
  "created_at": "2025-01-15T10:30:00",
  "updated_at": "2025-01-15T10:30:00"
}

Create Address

curl -X POST "https://api.example.com/api/user/address" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "firstname": "John",
    "lastname": "Doe",
    "address1": "123 Main Street",
    "address2": "Apt 4B",
    "address3": "Near Central Park",
    "flat": "4B",
    "city": "Mumbai",
    "postcode": "400001",
    "zone_id": 45,
    "country_id": 99,
    "country_code": "91",
    "phone_no": "9876543210",
    "address_type": "HOME",
    "is_default": true,
    "location": {
      "latitude": 19.075983,
      "longitude": 72.877655
    }
  }'
Creates a new delivery address for the user. Validates phone number and postal code before saving.

Body Parameters

firstname
string
required
First name for delivery
lastname
string
required
Last name for delivery (use ’.’ if only one name)
address1
string
required
Primary address line
address2
string
required
Secondary address line
address3
string
required
Landmark
address4
string
Additional address details
flat
string
Flat/apartment number
city
string
required
City name
postcode
string
required
Valid postal code for the country
zone_id
integer
required
State/province ID (must be > 20)
country_id
integer
required
Country ID (must be > 0)
country_code
string
default:"91"
Country calling code
phone_no
string
required
Valid 10-digit phone number
address_type
string
default:"HOME"
Address type: ‘HOME’, ‘WORK’, or ‘OTHER’
is_default
boolean
required
Set as default address (unsets other defaults)
location
object
Geographic coordinates
latitude
number
Latitude (up to 6 decimal places)
longitude
number
Longitude (up to 6 decimal places)
is_new_user
boolean
Set to true if creating address during user registration
email
string
Required if is_new_user is true
gender
string
Required if is_new_user is true

Response

Returns array of all user addresses after creation.
[
  {
    "id": 569,
    "user_id": 12345,
    "firstname": "John",
    "lastname": "Doe",
    "address1": "123 Main Street",
    "address2": "Apt 4B",
    "address3": "Near Central Park",
    "flat": "4B",
    "city": "Mumbai",
    "postcode": 400001,
    "zone_id": 45,
    "state": "Maharashtra",
    "country_id": 99,
    "country_code": "91",
    "phone_no": 9876543210,
    "address_type": "HOME",
    "is_default": 1,
    "is_active": 1,
    "latitude": "19.075983",
    "longitude": "72.877655",
    "created_at": "2026-03-08T11:45:00",
    "updated_at": "2026-03-08T11:45:00"
  }
]

Update Address

curl -X POST "https://api.example.com/api/user/address" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "put",
    "address_id": 567,
    "firstname": "John",
    "lastname": "Doe",
    "address1": "123 Main Street Updated",
    "address2": "Apt 4B",
    "address3": "Near Central Park",
    "city": "Mumbai",
    "postcode": "400001",
    "zone_id": 45,
    "country_id": 99,
    "country_code": "91",
    "phone_no": "9876543210",
    "address_type": "HOME",
    "is_default": true
  }'
Updates an existing address. If the address is used in past orders and content changes, the old address is soft-deleted and a new one is created to preserve order history.

Body Parameters

action
string
required
Must be “put” for update operation
address_id
integer
required
ID of address to update
All other parameters are the same as create address (firstname, lastname, address1, etc.)

Response

Returns array of all user addresses after update.
[
  {
    "id": 567,
    "user_id": 12345,
    "firstname": "John",
    "lastname": "Doe",
    "address1": "123 Main Street Updated",
    "address2": "Apt 4B",
    "address3": "Near Central Park",
    "city": "Mumbai",
    "postcode": 400001,
    "zone_id": 45,
    "state": "Maharashtra",
    "country_id": 99,
    "country_code": "91",
    "phone_no": 9876543210,
    "address_type": "HOME",
    "is_default": 1,
    "is_active": 1,
    "created_at": "2025-01-15T10:30:00",
    "updated_at": "2026-03-08T12:00:00"
  }
]

Delete Address

curl -X POST "https://api.example.com/api/user/address?address_id=567" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "delete"
  }'
Deletes an address by setting it as inactive. Addresses used in past orders are soft-deleted to preserve order history.

Body Parameters

action
string
required
Must be “delete” for delete operation

Query Parameters

address_id
integer
required
ID of address to delete

Response

Returns array of remaining active addresses.
[
  {
    "id": 568,
    "user_id": 12345,
    "firstname": "John",
    "lastname": "Doe",
    "address1": "456 Business Plaza",
    "address2": "Floor 12",
    "address3": "Opposite Metro Station",
    "city": "Mumbai",
    "postcode": 400051,
    "zone_id": 45,
    "state": "Maharashtra",
    "country_id": 99,
    "country_code": "91",
    "phone_no": 9876543210,
    "address_type": "WORK",
    "is_default": 0,
    "is_active": 1,
    "created_at": "2025-02-20T14:20:00",
    "updated_at": "2025-02-20T14:20:00"
  }
]

Validate Pincode

curl -X GET "https://api.example.com/api/pincode/400001" \
  -H "Content-Type: application/json"
Checks if delivery is available to a specific pincode and provides estimated delivery dates.

Path Parameters

pincode
string
required
Postal code to validate

Query Parameters

product_id
integer
Product ID for warehouse-specific delivery estimates

Response

success
boolean
Whether the pincode is serviceable
status_code
integer
200 if serviceable, 201 if not
data
object
Delivery information
serviceability
integer
1 if serviceable, 0 if not
check_cod
boolean
Whether COD is available
min_estimated_days
integer
Minimum delivery days
max_estimated_days
integer
Maximum delivery days
min_estimated_date
string
Earliest delivery date (DD/MM/YYYY)
max_estimated_date
string
Latest delivery date (DD/MM/YYYY)
zone
string
Delivery zone (e.g., “ZONE A”, “ZONE B”)
warehouse_name
string
Nearest warehouse (if product_id provided)
distance_in_km
number
Distance from warehouse in kilometers
{
  "success": true,
  "status_code": 200,
  "data": {
    "serviceability": 1,
    "check_cod": true,
    "min_estimated_days": 3,
    "max_estimated_days": 5,
    "min_estimated_date": "11/03/2026",
    "max_estimated_date": "13/03/2026",
    "zone": "ZONE A",
    "warehouse_name": "Mumbai Warehouse",
    "distance_in_km": 12.5
  }
}

Build docs developers (and LLMs) love