PIN Code API for developers

Auto-fill district and state from a pincode, and list the post offices behind it — as JSON.

The PIN Code API returns the district, state and every post office for any 6-digit Indian PIN code — office name, head/sub/branch office type, whether it delivers mail, postal division and circle. It also lists all states and districts and every PIN code in a district. The data is India Post's All India Pincode Directory from data.gov.in, the same data behind this website.

Get a free API key on RapidAPI →

What you can build with it

  • Auto-fill city, district and state when a customer types a pincode at checkout
  • Validate pincodes in address forms before saving an order
  • Build serviceable-area lists by district or state
  • Show the post offices for a pincode in logistics and KYC tools

Endpoints

Base URL: https://india-pin-code-lookup-api.p.rapidapi.com. Every request needs your X-RapidAPI-Key and X-RapidAPI-Host headers, which RapidAPI gives you when you subscribe (the free plan needs no card).

MethodPathReturns
GET/pincode/{pincode}District, state and all post offices for a PIN code (400 for a bad format, 404 if it does not exist)
GET/statesAll states and union territories with their districts
GET/district?state=delhi&district=new-delhiEvery PIN code and post office in a district

Example request

cURL

curl "https://india-pin-code-lookup-api.p.rapidapi.com/pincode/110001" \
  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
  -H "X-RapidAPI-Host: india-pin-code-lookup-api.p.rapidapi.com"

JavaScript (fetch)

const res = await fetch('https://india-pin-code-lookup-api.p.rapidapi.com/pincode/110001', {
  headers: {
    'X-RapidAPI-Key': process.env.RAPIDAPI_KEY,
    'X-RapidAPI-Host': 'india-pin-code-lookup-api.p.rapidapi.com'
  }
});
const json = await res.json();
console.log(json.data);

Python (requests)

import requests

res = requests.get(
    "https://india-pin-code-lookup-api.p.rapidapi.com/pincode/110001",
    headers={"X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY", "X-RapidAPI-Host": "india-pin-code-lookup-api.p.rapidapi.com"},
)
print(res.json()["data"])

Response

{
  "ok": true,
  "data": {
    "pincode": "110001",
    "district": "New Delhi",
    "state": "Delhi",
    "state_id": "delhi",
    "district_id": "new-delhi",
    "office_count": 23,
    "offices": [
      {
        "name": "New Delhi GPO",
        "type": "HO",
        "type_name": "Head Post Office",
        "delivery": true,
        "division": "New Delhi GPO Division",
        "region": null,
        "circle": "Delhi Circle",
        "district": "New Delhi",
        "state": "Delhi"
      },
      {
        "name": "Sansad Marg",
        "type": "HO",
        "type_name": "Head Post Office",
        "delivery": false,
        "division": "New Delhi Central Division",
        "region": null,
        "circle": "Delhi Circle",
        "district": "New Delhi",
        "state": "Delhi"
      }
    ]
  },
  "meta": {
    "source": "India Post All India Pincode Directory, data.gov.in (Government Open Data License - India)",
    "data_version": "May 2024 release"
  }
}

Errors come back as JSON too: {"ok":false,"error":"..."} with status 400 (bad input) or 404 (not found).

Plans

PlanPrice a monthRequests a month
BasicFree100
Pro$510,000
Ultra$151,00,000
Mega$4910,00,000

Billing, keys and usage are handled by RapidAPI. Get a free API key on RapidAPI →

Data

India Post "All India Pincode Directory" on data.gov.in (Government Open Data License – India). Data version: May 2024 release. The API is served from Cloudflare's edge network.

Frequently asked questions

Is the pincode API free?

Yes. The Basic plan on RapidAPI is free for 100 requests a month. Paid plans start at $5 a month for 10,000 requests.

How do I get the city and state from a pincode?

Call GET /pincode/{PIN}. The response has district and state at the top level, and each post office in the offices list.

Why does one PIN code have several post offices?

A PIN code covers a delivery area served by one head or sub post office and often several branch offices. The API returns all of them, with a delivery flag for each.

Where does the PIN code data come from?

From India Post's All India Pincode Directory published on data.gov.in. The response includes meta.data_version.