Country State City API

Base URL: https://country-state-city.xcelet.com. All endpoints are GET requests and return JSON. The where parameter is a JSON object; URL-encode it if your client does not. A JSON version of this page is at /docs.json.

Countries

GET /country/get

List countries, newest first.

Query parameters

NameRequiredDescription
whereNoJSON filter on the fields listed below, e.g. {"code":"IN"}
pageNoPage number, default 1
limitNoItems per page, default 25

Filterable fields: name, code

Example

https://country-state-city.xcelet.com/country/get?where={"code":"IN"}

Response

{
  "data": [
    "...records..."
  ],
  "page": 1,
  "totalPages": 1,
  "totalItems": 1
}

States

GET /state/get

List states. Filter by countryCode to get the states of one country.

Query parameters

NameRequiredDescription
whereNoJSON filter on the fields listed below, e.g. {"code":"IN"}
pageNoPage number, default 1
limitNoItems per page, default 25

Filterable fields: name, code, countryCode, countryId

Example

https://country-state-city.xcelet.com/state/get?where={"countryCode":"IN"}&limit=50

Response

{
  "data": [
    "...records..."
  ],
  "page": 1,
  "totalPages": 1,
  "totalItems": 1
}

Cities

GET /city/get

List cities. Filter by countryCode and stateCode to get the cities of one state.

Query parameters

NameRequiredDescription
whereNoJSON filter on the fields listed below, e.g. {"code":"IN"}
pageNoPage number, default 1
limitNoItems per page, default 25

Filterable fields: name, stateCode, countryCode, state, country

Example

https://country-state-city.xcelet.com/city/get?where={"countryCode":"IN","stateCode":"MH"}

Response

{
  "data": [
    "...records..."
  ],
  "page": 1,
  "totalPages": 1,
  "totalItems": 1
}

Pincode

GET /pincode/get

Look up an Indian pincode. Returns the first post office found for it.

Query parameters

NameRequiredDescription
whereYesJSON with a 6 digit pincode, e.g. {"pincode":"411033"}

Filterable fields: pincode

Example

https://country-state-city.xcelet.com/pincode/get?where={"pincode":"411033"}

Response

{
  "status": true,
  "message": "Pincode Fetched Successfully",
  "data": {
    "Name": "Chinchwadgaon",
    "BranchType": "Sub Post Office",
    "DeliveryStatus": "Delivery",
    "District": "Pune",
    "State": "Maharashtra",
    "Country": "India",
    "Pincode": "411033"
  },
  "error": ""
}

Errors