Skip to content
DDataNest

Location · 4 min read

How to use the Pincode API in Python & JavaScript

Location lookups should be one call, not a dataset to host. Here's how to do it with the Pincode API API.

By DataNest · Published May 2026

What the Pincode API API does

Lookup any of 155,000+ Indian PIN codes: post office, district, state, search, validation, and bulk resolution. Responses are JSON, the API runs behind the RapidAPI gateway for auth and rate limiting, and there's a free tier for prototyping.

When to use it

e-commerce checkout
logistics routing
KYC verification

The example request

GET https://pincode-api-by-datanest2.p.rapidapi.com/pincode/110001?pincode=110001

Example JSON response

An illustrative response body — run the live demo for the real thing.

{
  "pincode": "110001",
  "results": [
    {
      "postOffice": "Connaught Place",
      "city": "New Delhi",
      "district": "Central Delhi",
      "state": "Delhi",
      "deliveryStatus": "Delivery"
    }
  ]
}

Common parameters

Every request also needs your RapidAPI auth headers.

ParameterInRequiredExample
x-rapidapi-keyheaderYesYOUR_RAPIDAPI_KEY
x-rapidapi-hostheaderYespincode-api-by-datanest2.p.rapidapi.com

Step by step

1. Subscribe and get your key

Open the Pincode API API on RapidAPI, subscribe to the free BASIC plan, and copy your X-RapidAPI-Key.

2. Call the endpoint

The example call for this API is shown above. The quick-start snippets below send exactly that request in cURL, Python and Node so you get a real response on the first try.

3. Try it without code first

The Pincode API page has a live "Try it" panel — change the input, run it, and inspect the real JSON before you integrate.

4. Integrate and cache

Call it from your backend and cache responses where it makes sense. Most responses change slowly, so even a daily cache keeps you well within the free tier.

Quick-start code

curl --request GET \
  --url 'https://pincode-api-by-datanest2.p.rapidapi.com/pincode/110001' \
  --header 'x-rapidapi-host: pincode-api-by-datanest2.p.rapidapi.com' \
  --header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY'

What you can build

Checkout autofill

Auto-populate state, city and district from a PIN code.

Coverage check

Verify a courier delivers to a given PIN before accepting an order.

KYC address verify

Cross-check a submitted address against official postal data.

Wrapping up

If your project needs e-commerce checkout, the Pincode API API removes the part nobody enjoys building. It's one of 23 in the DataNest collection — grab a free key and make your first call.

Pincode API updates

New Pincode API guides and endpoint updates, occasionally.