Get Address from PIN

svelte logo

Want to build a Svelte/SvelteKit site? Hire Me.

I manage a shopify site for a client of mine. I observed that shopify checkout gets pin code from the city name we provide.

I also had seen - in another website - getting city and state from PIN. But they were using a dataset they hardcoded to a file.

IndiaPost has an API which does it for us for free. You can read about it here

The response would look like this.

{
  "Message": "Number of Post office(s) found: 21",
  "Status": "Success",
  "PostOffice": [
    {
      "Name": "Baroda House",
      "Description": "",
      "BranchType": "Sub Post Office",
      "DeliveryStatus": "Non-Delivery",
      "Circle": "New Delhi",
      "District": "Central Delhi",
      "Division": "New Delhi Central",
      "Region": "Delhi",
      "State": "Delhi",
      "Country": "India"
    }
  ]
}

Get City and State from PIN

Here is a REPL I created which gets City and State from PIN code. This can be useful if you want a better UX for e-commerce checkout page.

Get address from PIN

Find related articles

Let's discuss on Twitter