# Wholesale prices API (`/v1/agri`)

Daily wholesale prices from Punjab's mandis, from the Punjab **AMIS**. About the data: [Wholesale (mandi) prices](https://pakdatahub.com/docs/data-agri-prices.md).

## `GET /v1/agri/markets` - public

Every market, with `market_id`, `name`, `slug`, `is_major` (updated every evening) and the dates it has prices for.

## `GET /v1/agri/commodities` - public

Every commodity, with `commodity_id`, `name`, `slug`, `category` (`Grains`, `Vegetables`, `Fruits`) and `unit` (`pkr_per_100kg`, or `pkr_per_dozen` for bananas).

## `GET /v1/agri/prices` (key required)

A commodity's daily prices in one market, or in every market if you leave `market` out.

| Param | Notes |
|---|---|
| `commodity` | Required. AMIS id or slug, e.g. `onion`, `1` (wheat) |
| `market` | AMIS id or slug, e.g. `lahore`. Leave it out for every market |
| `from`, `to` | Date range (`YYYY-MM-DD`). Clamped to your plan's history window |
| `limit` | 1-10000 (default 1000) |
| `sort` | `desc` (default) or `asc` |
| `format` | `json` or `csv` |

```json
{
  "success": true,
  "commodity": { "commodity_id": 1, "name": "Wheat", "slug": "wheat", "category": "Grains", "unit": "pkr_per_100kg" },
  "market": { "market_id": 2, "name": "Faisalabad", "slug": "faisalabad" },
  "source": "AMIS Punjab (Directorate of Agriculture, Economics & Marketing)",
  "data": [
    { "date": "2026-10-05", "market": "Faisalabad", "market_id": 2, "commodity": "Wheat", "commodity_id": 1,
      "min": 11500.0, "max": 12000.0, "fqp": 11750.0, "quantity": null, "unit": "pkr_per_100kg" }
  ],
  "count": 1
}
```

`fqp` is the fair-quality price, the representative one. `min` and `max` are the day's range; for dates before October 2026 they are `null`, because the history carries the fair-quality price only.

## `GET /v1/agri/latest` (key required)

The most recent price (within the last 30 days) of one commodity in every market that reported it. It's built for a "today's mandi rates" table. Params: `commodity` (required), `format`.

## Errors

`404` for an unknown commodity or market, `401` without a key, `422` for a bad parameter. Same envelope as the rest of the API ([errors](https://pakdatahub.com/docs/errors-rate-limits.md)).

---
Source: https://pakdatahub.com/docs/api-agri - PakDataHub docs index: https://pakdatahub.com/docs/llms.txt
