📡 Pincode API Documentation

Base URL

https://geoloc.in/api/pincode

📋 Methods Supported

  • GET - Simple query parameters
  • POST - With JSON body (recommended)

🔐 Authentication Methods

Method 1: Authorization Header (Recommended)
Authorization: Bearer YOUR_API_KEY
Most secure, works with Postman and all HTTP clients.
Method 2: Query Parameter
?api_key=YOUR_API_KEY
Simple, works with GET requests.
Method 3: JSON Body
{ "pincode": "395007", }
For POST requests with JSON body.

🚀 Example Requests

cURL - POST with Header (Recommended)
curl -X POST "https://geoloc.in/api/pincode" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{"pincode": "395007"}'
cURL - GET Request
curl -X GET "https://geoloc.in/api/pincode?pincode=395007&api_key=YOUR_API_KEY"
PHP Code
$curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => 'https://geoloc.in/api/pincode', CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode(['pincode' => '395007']), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Authorization: Bearer YOUR_API_KEY' ], ]); $response = curl_exec($curl); curl_close($curl); echo $response;
JavaScript Fetch
fetch('https://geoloc.in/api/pincode', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' }, body: JSON.stringify({pincode: '395007'}) }) .then(response => response.json()) .then(data => console.log(data));

📊 Response Format

Success Response
{ "status": "success", "count": 1, "data": [ { "statename": "Gujarat", "cityname": "Surat", "areaname": "Athwa", "pincode": "395007", "latitude": "21.1827", "longitude": "72.8305" } ] }
Error Response
{ "status": "error", "message": "Invalid or unverified API key" }
📝 Notes
  • Guests: 2 free searches (no API key needed)
  • Verified Users: Unlimited searches with API key
  • Get API Key: Register, verify email, check dashboard