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.
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.
https://olaw.in/api.php
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.
| Parameter | Type | Description |
|---|---|---|
| api_key * | String | Your unique API access key. |
a9dcc62d6078b881d318aca0ead65ab5
Retrieve detailed bank branch information using an 11-digit IFSC code.
| Param | Required | Description |
|---|---|---|
| action | Yes | Must be bank-ifsc |
| ifsc | Yes | 11-Digit Alphanumeric IFSC Code |
{
"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"
}
}
Search for post office details and localities associated with a specific 6-digit Pincode.
| Param | Required | Description |
|---|---|---|
| action | Yes | Must be pincode |
| pincode | Yes | 6-Digit Indian Pincode |
Search for GST Goods (HSN) and Services (SAC) classifications and rates.
| Param | Required | Description |
|---|---|---|
| action | Yes | Must be hsn-sac |
| q | Yes | Code or Keyword (e.g. Rice, 1001, Cleaning) |
Locate Passport Seva Kendras (PSK), Post Office Passport Seva Kendras (POPSK), and Regional Passport Offices (RPO).
| Param | Required | Description |
|---|---|---|
| action | Yes | Must be passport |
| q | Yes | Office Name, RPO, or State (e.g. Patna, Bihar, PSK) |
{
"status": "success",
"data": [
{
"name": "PSK PATNA",
"rpo": "PATNA",
"state": "Bihar",
"address": "Gala Diamond Building, Exhibition Road, Patna",
"phone": "0612-1234567"
}
]
}
Easily integrate our data into your website or WordPress blog using the snippets below.
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
$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'];
}
?>
// 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;
}
Our API uses standard response patterns to indicate errors.
{
"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. |