Docs › Places and transport
States API
States and union territories with their codes.
All 28 states and 8 union territories with the two-letter code, GST state code and vehicle registration prefixes. The other APIs accept these codes in their state filter.
All states and union territories
GET/v1/states
curl
curl "https://api.dharun.dev/v1/states"JavaScript
const response = await fetch("https://api.dharun.dev/v1/states");
const body = await response.json();
if (!response.ok) throw new Error(body.error.message);
console.log(body.data);Python
import requests
response = requests.get("https://api.dharun.dev/v1/states", timeout=10)
body = response.json()
if not response.ok:
raise RuntimeError(body["error"]["message"])
print(body["data"])Response, with lists and long text shortened
{
"data": [
{
"code": "AN",
"name": "Andaman and Nicobar Islands",
"type": "union_territory",
"gstCode": "35",
"vehicleCodes": [
"AN"
]
},
{
"code": "AP",
"name": "Andhra Pradesh",
"type": "state",
"gstCode": "37",
"vehicleCodes": [
"AP"
]
},
{
"code": "AR",
"name": "Arunachal Pradesh",
"type": "state",
"gstCode": "12",
"vehicleCodes": [
"AR"
]
}
],
"meta": {
"total": 36
}
}One state
GET/v1/states/{code}
| Parameter | Description |
|---|---|
codepath, required | State code, vehicle prefix or name. |
curl
curl "https://api.dharun.dev/v1/states/TN"JavaScript
const response = await fetch("https://api.dharun.dev/v1/states/TN");
const body = await response.json();
if (!response.ok) throw new Error(body.error.message);
console.log(body.data);Python
import requests
response = requests.get("https://api.dharun.dev/v1/states/TN", timeout=10)
body = response.json()
if not response.ok:
raise RuntimeError(body["error"]["message"])
print(body["data"])Response
{
"data": {
"code": "TN",
"name": "Tamil Nadu",
"type": "state",
"gstCode": "33",
"vehicleCodes": [
"TN"
]
},
"meta": {}
}Guides
Using an AI assistant? Connect the MCP server and it can call this API by itself.