India Post Pincode

Free Postal PIN Code API

High-speed, key-less JSON API for Indian PIN codes and post offices — no registration, no rate limits, HTTPS secured, and CORS-enabled for web & mobile apps.

?? Usage Terms & Attribution Requirement

This API is provided 100% free of charge for commercial and non-commercial projects under the Creative Commons Attribution (CC BY 4.0) license. There are no rate limits for standard usage.

Attribution Required: In exchange for free access, you must place a visible, clickable link back to https://searchpincode.in in your application's footer, "Credits", or "About Us" page. (e.g., "PIN Code Data powered by SearchPincode.in").

⚡ Looking for an HTTPS Replacement for api.postalpincode.in?

Fix browser "Mixed Content" blocked errors in React, Next.js, Angular, Flutter, and HTTPS-hosted sites. Simply replace api.postalpincode.in with searchpincode.in/api in your code — 100% drop-in compatible JSON response with zero code changes!

🧪 Interactive API Playground

Test the live endpoint with any 6-digit Indian PIN code:
CORS ENABLED
Endpoint: https://searchpincode.in/api/pincode/560001
// Click "Send Test Request" above to view live JSON response...

1-Click Code Snippets for Projects

Copy-paste ready implementation examples for engineering college projects, checkout forms, and mobile apps:

<!-- HTML & Vanilla JS: Auto-fill City & State when 6 digits are typed -->
<input type="text" id="pincode" placeholder="Enter 6-digit PIN" maxlength="6">
<input type="text" id="district" placeholder="District / City" readonly>
<input type="text" id="state" placeholder="State" readonly>

<script>
document.getElementById('pincode').addEventListener('input', function(e) {
  const pin = e.target.value.trim();
  if (pin.length === 6) {
    fetch(`https://searchpincode.in/api/pincode/${pin}`)
      .then(res => res.json())
      .then(data => {
        if (data[0] && data[0].Status === 'Success') {
          const po = data[0].PostOffice[0];
          document.getElementById('district').value = po.District;
          document.getElementById('state').value = po.State;
        } else {
          alert('Invalid PIN code');
        }
      })
      .catch(err => console.error('API Error:', err));
  }
});
</script>
// React / Next.js: Auto-fill Address Form Component
import React, { useState } from 'react';

export default function PincodeAddressForm() {
  const [pin, setPin] = useState('');
  const [district, setDistrict] = useState('');
  const [state, setState] = useState('');
  const [loading, setLoading] = useState(false);

  const handlePincodeChange = async (e) => {
    const val = e.target.value;
    setPin(val);

    if (val.length === 6) {
      setLoading(true);
      try {
        const res = await fetch(`https://searchpincode.in/api/pincode/${val}`);
        const data = await res.json();
        if (data[0]?.Status === 'Success') {
          const office = data[0].PostOffice[0];
          setDistrict(office.District);
          setState(office.State);
        }
      } catch (err) {
        console.error('Failed to lookup PIN code:', err);
      } finally {
        setLoading(false);
      }
    }
  };

  return (
    <div className="address-form">
      <input 
        type="text" 
        value={pin} 
        onChange={handlePincodeChange} 
        placeholder="Enter 6-digit PIN" 
        maxLength={6} 
      />
      <input type="text" value={district} placeholder="District" readOnly />
      <input type="text" value={state} placeholder="State" readOnly />
      {loading && <span>Fetching address details...</span>}
    </div>
  );
}
# Python: Lookup Post Offices & District by PIN code
import requests

def get_pincode_details(pincode):
    url = f"https://searchpincode.in/api/pincode/{pincode}"
    response = requests.get(url)
    
    if response.status_code == 200:
        data = response.json()
        if data[0]["Status"] == "Success":
            offices = data[0]["PostOffice"]
            print(f"District: {offices[0]['District']}, State: {offices[0]['State']}")
            for po in offices:
                print(f" - {po['Name']} ({po['BranchType']}, {po['DeliveryStatus']})")
        else:
            print("PIN code not found.")
    else:
        print(f"HTTP Error: {response.status_code}")

# Example lookup
get_pincode_details("560001")
// Flutter / Dart: Postal API Service for Mobile Apps
import 'dart:convert';
import 'package:http/http.dart' as http;

class PincodeService {
  static Future<Map<String, String>?> getDetails(String pincode) async {
    final url = Uri.parse('https://searchpincode.in/api/pincode/$pincode');
    final response = await http.get(url);

    if (response.statusCode == 200) {
      final List<dynamic> data = json.decode(response.body);
      if (data.isNotEmpty && data[0]['Status'] == 'Success') {
        final office = data[0]['PostOffice'][0];
        return {
          'district': office['District'],
          'state': office['State'],
          'office': office['Name'],
        };
      }
    }
    return null;
  }
}
// Node.js: Quick fetch helper
async function lookupPincode(pincode) {
  const res = await fetch(`https://searchpincode.in/api/pincode/${pincode}`);
  const [data] = await res.json();
  
  if (data?.Status === 'Success') {
    return data.PostOffice.map(po => ({
      name: po.Name,
      branchType: po.BranchType,
      district: po.District,
      state: po.State
    }));
  }
  return [];
}

// Test
lookupPincode('110001').then(console.log);

Drop-in Compatible Endpoints

These match the exact response format of api.postalpincode.in so existing software continues working without modifications:

1. Search by PIN code

GET https://searchpincode.in/api/pincode/{PINCODE}
curl "https://searchpincode.in/api/pincode/500001"
[
  {
    "Message": "Number of Post office(s) found: 3",
    "Status": "Success",
    "PostOffice": [
      {
        "Name": "Hyderabad G.P.O.",
        "Description": "",
        "BranchType": "Head Post Office",
        "DeliveryStatus": "Delivery",
        "Circle": "Telangana Circle",
        "District": "Hyderabad",
        "Division": "Hyderabad GPO Division",
        "Region": "Hyderabad City Region",
        "State": "Telangana",
        "Country": "India"
      }
    ]
  }
]

2. Search by post office branch name

GET https://searchpincode.in/api/postoffice/{NAME}

Items in this response also carry an official PINCode field.

Richer v1 Endpoints

Lowercase JSON, strict HTTP status codes, and enhanced metadata including coordinates, map links, and canonical directory URLs:

EndpointReturns
GET /api/v1/pincode/{PINCODE} Post offices, district slugs, coordinates, map + canonical URLs
GET /api/v1/search?q={NAME}&limit=50 Post offices matching a name prefix
GET /api/v1/states All 36 States & UTs with PIN code and post-office counts
GET /api/v1/state/{STATE} Districts under a state
GET /api/v1/district/{STATE}/{DISTRICT} PIN codes and offices of a district

🎓 Using in a College Project or GitHub Repo?

If you are using this API in your engineering project, hackathon app, or e-commerce website, add our badge to your GitHub README.md:

SearchPinCode API Badge
[![Postal API](https://img.shields.io/badge/Postal%20API-SearchPinCode.in-blue)](https://searchpincode.in/api)

Developer Notes & Rate Limits

  • 100% Free: No API key and no account required. Please cache responses on your server for repeat requests.
  • CORS Enabled: Direct browser calls allowed with Access-Control-Allow-Origin: *.
  • Database Size: Covers 165,574 post offices and 19,586 unique PIN codes across all 36 States & UTs.
  • Edge Cached: Served directly from Cloudflare Edge Caching with response times of 20ms – 50ms.