Introduction

Welcome to the Online Law REST API. Our API provides developers with programmatic access to comprehensive datasets including Bank IFSC codes, Indian Post Office Pincodes, and GST HSN/SAC classifications.

35+
Requests Served
2+
Active Developers

All API responses are returned in standard JSON format. The API is designed to be easy to integrate into your existing applications, websites, or business workflows.

Base Endpoint: https://olaw.in/api.php

Authentication

To access the API, you must include your API Key in every request as a query parameter. You can track your usage in real-time below.

Check Your API Usage
Parameter Type Description
api_key * String Your unique API access key.
DEFAULT PUBLIC KEY: a9dcc62d6078b881d318aca0ead65ab5

Bank IFSC API

Retrieve detailed bank branch information using an 11-digit IFSC code.

GET https://olaw.in/api.php?api_key=...&action=bank-ifsc&ifsc=SBIN0000001
Request Parameters
Param Required Description
action Yes Must be bank-ifsc
ifsc Yes 11-Digit Alphanumeric IFSC Code
Sample Response
JSON
{
  "status": "success",
  "data": {
    "bank": "STATE BANK OF INDIA",
    "ifsc": "SBIN0000001",
    "branch": "ADONI",
    "address": "P.B.NO.20, CHHABI COMPLEX, STATION ROAD, ADONI 518301",
    "city1": "ADONI",
    "city2": "KURNOOL",
    "state": "ANDHRA PRADESH",
    "phone": "220133"
  }
}
                        

Pincode API

Search for post office details and localities associated with a specific 6-digit Pincode.

GET https://olaw.in/api.php?api_key=...&action=pincode&pincode=841301
Request Parameters
Param Required Description
action Yes Must be pincode
pincode Yes 6-Digit Indian Pincode

GST HSN/SAC API

Search for GST Goods (HSN) and Services (SAC) classifications and rates.

GET https://olaw.in/api.php?api_key=...&action=hsn-sac&q=1001
Request Parameters
Param Required Description
action Yes Must be hsn-sac
q Yes Code or Keyword (e.g. Rice, 1001, Cleaning)

Passport Office API

Locate Passport Seva Kendras (PSK), Post Office Passport Seva Kendras (POPSK), and Regional Passport Offices (RPO).

GET https://olaw.in/api.php?api_key=...&action=passport&q=Patna
Request Parameters
Param Required Description
action Yes Must be passport
q Yes Office Name, RPO, or State (e.g. Patna, Bihar, PSK)
Sample Response
JSON
{
  "status": "success",
  "data": [
    {
      "name": "PSK PATNA",
      "rpo": "PATNA",
      "state": "Bihar",
      "address": "Gala Diamond Building, Exhibition Road, Patna",
      "phone": "0612-1234567"
    }
  ]
}
                        

Integration Examples

Easily integrate our data into your website or WordPress blog using the snippets below.

JavaScript (Fetch)
const apiKey = 'YOUR_API_KEY';
const ifsc = 'SBIN0000001';

fetch(`https://olaw.in/api.php?api_key=${apiKey}&action=pincode&pincode=${pin}`)
  .then(response => response.json())
  .then(data => {
    if(data.status === 'success') {
      console.log('Office Name:', data.data[0].office_name);
      console.log('District:', data.data[0].district_name);
    } else {
      console.error('Error:', data.message);
    }
  });
                                
PHP (cURL)
<?php
$apiKey = 'YOUR_API_KEY';
$url = "https://olaw.in/api.php?api_key=$apiKey&action=pincode&pincode=800001";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
if ($data['status'] === 'success') {
    echo "Office: " . $data['data'][0]['office_name'];
}
?>
                                
WordPress (wp_remote_get)
// Add this to your functions.php or a custom plugin
function get_legal_data_from_olaw($pincode) {
    $api_key = 'YOUR_API_KEY';
    $url = "https://olaw.in/api.php?api_key=$api_key&action=pincode&pincode=$pincode";
    
    $response = wp_remote_get($url);
    if (is_wp_error($response)) return false;
    
    $body = wp_remote_retrieve_body($response);
    $data = json_decode($body, true);
    
    return ($data['status'] === 'success') ? $data['data'] : false;
}
                                

Error Codes

Our API uses standard response patterns to indicate errors.

Error Example
{
  "status": "error",
  "message": "Invalid API Key"
}
                        
Status Message Description
Invalid API Key The provided API key is incorrect or missing.
No record found No data matches your query parameters.
Invalid action The action parameter doesn't match a supported endpoint.