API reference

A read-only JSON API for the daily petrol and diesel prices in PPAC’s metro table. No key, no signup, CORS open to every origin. Base URL: https://india-petroleum-api.vercel.app

Conventions

  • Every success answer is { "success": true, "data": …, "meta": … }. meta always has attribution, source_posted_date (the date printed on PPAC’s table) and latest_fetched_at (when this service last downloaded it).
  • Every error answer is { "success": false, "error": { "code": …, "message": … } }, with the HTTP status shown in the table below. Unknown paths under /v1 answer JSON, never HTML.
  • Rate limit: 100 requests per 15 minutes per IP address, counted separately on each server instance. Past it, that instance answers 429 RATE_LIMITED. The count is not shared between instances, so treat the limit as approximate.
  • Answers come from files stored with the service, so they do not wait on PPAC. Responses are cacheable by a CDN for five minutes. The API checks the repository for newer data about every ten minutes, so a new day appears within roughly fifteen minutes of the daily job committing it.

Newest prices

GET /v1/prices/latest

The newest day in the stored data: all four cities, petrol and diesel.

Request
curl "https://india-petroleum-api.vercel.app/v1/prices/latest"
Response from the build
{
  "success": true,
  "data": {
    "date": "2026-11-03",
    "petrol": {
      "delhi": 102.12,
      "mumbai": 111.21,
      "chennai": 107.77,
      "kolkata": 113.51
    },
    "diesel": {
      "delhi": 95.2,
      "mumbai": 97.83,
      "chennai": 99.55,
      "kolkata": 99.82
    }
  },
  "meta": {
    "count": 1,
    "last_change": {
      "petrol": {
        "delhi": {
          "date": "2026-05-25",
          "from": 99.51,
          "to": 102.12
        },
  …

Prices over a date range

GET /v1/prices

One row per calendar day between from and to, both included. Every day has a row, including days on which no price moved.

ParameterValuesRequiredNotes
fromYYYY-MM-DDyesFirst day. Dates before 2017-06-16 have no rows.
toYYYY-MM-DDyesLast day. The range may span at most 3,660 days.
citydelhi | mumbai | chennai | kolkatanoLimit the answer to one city. Left out, all four cities are returned. Any other value is a 404 UNKNOWN_CITY that lists the valid ones.
fuelpetrol | dieselnoLimit the answer to one fuel. Left out, both fuels are returned. Any other value is a 404 UNKNOWN_FUEL that lists the valid ones.
Request
curl "https://india-petroleum-api.vercel.app/v1/prices?city=delhi&from=2026-10-28&to=2026-11-03"
Response from the build
{
  "success": true,
  "data": [
    {
      "date": "2026-10-28",
      "petrol": {
        "delhi": 102.12
      },
      "diesel": {
        "delhi": 95.2
      }
    },
    {
      "date": "2026-10-29",
      "petrol": {
        "delhi": 102.12
      },
      "diesel": {
        "delhi": 95.2
      }
    },
    {
      "date": "2026-10-30",
      "petrol": {
        "delhi": 102.12
      },
  …

Price changes

GET /v1/prices/changes

Only the moves: one row for each date on which a price changed, with the price before and after.

ParameterValuesRequiredNotes
fromYYYY-MM-DDnoFirst day. Defaults to 365 days before to.
toYYYY-MM-DDnoLast day. Defaults to the newest date in the data.
citydelhi | mumbai | chennai | kolkatanoLimit the answer to one city. Left out, all four cities are returned. Any other value is a 404 UNKNOWN_CITY that lists the valid ones.
fuelpetrol | dieselnoLimit the answer to one fuel. Left out, both fuels are returned. Any other value is a 404 UNKNOWN_FUEL that lists the valid ones.
Request
curl "https://india-petroleum-api.vercel.app/v1/prices/changes?city=delhi&fuel=petrol&from=2025-11-04&to=2026-11-03"
Response from the build
{
  "success": true,
  "data": [
    {
      "date": "2026-05-15",
      "fuel": "petrol",
      "city": "delhi",
      "from": 94.77,
      "to": 97.77
    },
    {
      "date": "2026-05-19",
      "fuel": "petrol",
      "city": "delhi",
      "from": 97.77,
      "to": 98.64
    },
    {
      "date": "2026-05-23",
      "fuel": "petrol",
      "city": "delhi",
      "from": 98.64,
      "to": 99.51
    },
    {
      "date": "2026-05-25",
  …

Cities

GET /v1/cities

The four cities the table covers, with the slug to use in the city parameter.

Request
curl "https://india-petroleum-api.vercel.app/v1/cities"
Response from the build
{
  "success": true,
  "data": [
    {
      "slug": "delhi",
      "name": "Delhi"
    },
    {
      "slug": "mumbai",
      "name": "Mumbai"
    },
    {
      "slug": "chennai",
      "name": "Chennai"
    },
    {
      "slug": "kolkata",
      "name": "Kolkata"
    }
  ],
  "meta": {
    "count": 4,
    "attribution": "Source: Petroleum Planning & Analysis Cell (PPAC), Ministry of Petroleum and Natural Gas, Government of India",
    "source_posted_date": "2026-11-03",
    "latest_fetched_at": "2026-11-03T11:03:49.734Z"
  }
  …

Data provenance and freshness

GET /v1/meta

Where the stored data came from and how current it is: the PPAC file URL and its SHA-256, when it was downloaded, the first and last date, and days_behind.

Request
curl "https://india-petroleum-api.vercel.app/v1/meta"
Response from the build
{
  "success": true,
  "data": {
    "source": "PPAC",
    "attribution": "Source: Petroleum Planning & Analysis Cell (PPAC), Ministry of Petroleum and Natural Gas, Government of India",
    "source_url": "https://ppac.gov.in/uploads/page-images/1793687501_PP_9_a_DailyPriceMSHSD_Metro_03.11.2026.pdf",
    "source_posted_date": "2026-11-03",
    "sha256": "7717e11a64c2c5e91f8bfc20e79646a555214682e932ff6e457c7922b665f934",
    "fetched_at": "2026-11-03T11:03:49.734Z",
    "first_date": "2017-06-16",
    "last_date": "2026-11-03",
    "day_count": 3428,
    "fuels": [
      "petrol",
      "diesel"
    ],
    "days_behind": 0,
    "data_source": "bundled",
    "checked_at": null,
    "refresh_error": null
  },
  "meta": {
    "attribution": "Source: Petroleum Planning & Analysis Cell (PPAC), Ministry of Petroleum and Natural Gas, Government of India",
    "source_posted_date": "2026-11-03",
    "latest_fetched_at": "2026-11-03T11:03:49.734Z"
  }
  …

Health

GET /health

Returns 200 with the API name, coverage and the endpoint list while the service is up. Never cached.

Request
curl "https://india-petroleum-api.vercel.app/health"
Response from the build
{
  "success": true,
  "data": {
    "name": "India Petroleum API (PPAC fuel prices)",
    "description": "Free, keyless REST API for official daily retail petrol and diesel prices in Delhi, Mumbai, Chennai and Kolkata since 16 June 2017, from PPAC.",
    "coverage": {
      "first_date": "2017-06-16",
      "last_date": "2026-11-03"
    },
    "data_source": "bundled",
    "endpoints": [
      "GET /health",
      "GET /v1/prices/latest",
      "GET /v1/prices?from=YYYY-MM-DD&to=YYYY-MM-DD[&city=][&fuel=]",
      "GET /v1/prices/changes[?from=&to=&city=&fuel=]",
      "GET /v1/cities",
      "GET /v1/meta"
    ],
    "rate_limit": "100 requests per 15 minutes per IP address, counted on each server instance",
    "status": "operational"
  },
  "meta": {
    "attribution": "Source: Petroleum Planning & Analysis Cell (PPAC), Ministry of Petroleum and Natural Gas, Government of India",
    "source_posted_date": "2026-11-03",
    "latest_fetched_at": "2026-11-03T11:03:49.734Z"
  }
  …

Errors

StatusCodeMeaning
400MISSING_PARAMA required parameter is missing. The message names it.
400INVALID_DATEfrom or to is not a real calendar date in YYYY-MM-DD form.
400INVALID_RANGEfrom is after to.
400RANGE_TOO_LARGEThe range spans more than 3,660 days. Ask for several ranges.
404UNKNOWN_CITYcity is not one of the four slugs. valid_values lists them.
404UNKNOWN_FUELfuel is not petrol or diesel. valid_values lists them.
404NOT_FOUNDNo such route.
429RATE_LIMITEDMore than 100 requests from one IP address in 15 minutes on one server instance.
500INTERNAL_ERRORAn unexpected failure on the server.
A missing parameter
curl "https://india-petroleum-api.vercel.app/v1/prices?city=delhi"
Answer, HTTP 400
{
  "success": false,
  "error": {
    "code": "MISSING_PARAM",
    "message": "Missing required query parameter(s): from, to. Dates are YYYY-MM-DD."
  }
}
An unknown fuel
curl "https://india-petroleum-api.vercel.app/v1/prices?city=delhi&fuel=kerosene&from=2026-10-30&to=2026-11-03"
Answer, HTTP 404
{
  "success": false,
  "error": {
    "code": "UNKNOWN_FUEL",
    "message": "Unknown fuel 'kerosene'. Valid values: petrol, diesel.",
    "valid_values": [
      "petrol",
      "diesel"
    ]
  }
}

Dates and prices

  • date is PPAC’s Date of Revision, copied as printed. A note under PPAC’s table says a daily price change applies from 6:00 AM; the API does not claim what a pump charged at a given hour.
  • Prices are rupees per litre with two decimals. A footnote on the table says they are Indian Oil Corporation’s retail selling prices.
  • There is a row for every day from 16 June 2017, whether or not a price moved. Use /v1/prices/changes to list only the days that did.
  • days_behind in /v1/meta counts calendar days in India between today and the newest price date. The example above shows the value on the day the site was built.

Source: PPAC’s table, reused under PPAC’s terms: free of charge if reproduced accurately and with the source prominently acknowledged. Keep meta.attribution next to the figures you show.