Locations API

The Locations API provides read-only reference data for States, Cities, and Pincodes (Postal Codes). It is primarily used to auto-populate location dropdowns and resolve pin codes to their corresponding city and state values during property creation or lead capture.

Endpoints

All endpoints are authenticated using standard Admin API tokens.

1. List States

Retrieve a list of all available states.

Endpoint: GET /admin/locations/states/

Response:

[
  {
    "id": 1,
    "name": "TELANGANA"
  },
  {
    "id": 2,
    "name": "MAHARASHTRA"
  }
]

2. List Cities

Retrieve a list of cities. You can filter by state ID.

Endpoint: GET /admin/locations/cities/?state=<state_id>

Query Parameters: - state (optional): The ID of the state to filter by. - state_name (optional): The exact name of the state (case-insensitive).

Response:

[
  {
    "id": 10,
    "name": "KUMURAM BHEEM ASIFABAD",
    "state": 1,
    "state_name": "TELANGANA"
  }
]

3. Pincode Lookup

Retrieve the city and state associated with a specific 6-digit pincode.

Endpoint: GET /admin/locations/pincode/<code>/

Response (200 OK):

{
  "code": "504273",
  "city_name": "KUMURAM BHEEM ASIFABAD",
  "state_name": "TELANGANA",
  "latitude": "19.363868",
  "longitude": "79.537665"
}

Response (404 Not Found):

{
  "detail": "Not found."
}