📚 API Documentation

Integrate MKisan data into your applications

🔐 Authentication

All API requests require authentication using an API key. Include your API key in the request header:

HTTP Header
X-API-Key: your_api_key_here

Example Request

JavaScript
const response = await fetch('https://mkisan.net/wp-json/mkisan/v1/mandi-bhav', {
    headers: {
        'X-API-Key': 'mk_xxxxxxxxxxxx'
    }
});
const data = await response.json();
cURL
curl -X GET "https://mkisan.net/wp-json/mkisan/v1/mandi-bhav" \
  -H "X-API-Key: mk_xxxxxxxxxxxx"
Python
import requests

headers = {'X-API-Key': 'mk_xxxxxxxxxxxx'}
response = requests.get(
    'https://mkisan.net/wp-json/mkisan/v1/mandi-bhav',
    headers=headers
)
data = response.json()

⚡ Rate Limits

API rate limits vary by plan:

Plan Daily Requests Monthly Requests
Free 100 1,000
Starter 1,000 25,000
Professional 10,000 250,000
Enterprise Unlimited Unlimited
⚠️ Rate Limit Headers Check response headers for rate limit info: X-RateLimit-Remaining, X-RateLimit-Reset

❌ Error Handling

API uses standard HTTP status codes:

Code Description
200 Success
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid or missing API key
429 Too Many Requests - Rate limit exceeded
500 Server Error
Error Response Example:
JSON
{
    "success": false,
    "code": "rate_limit_exceeded",
    "message": "Daily rate limit exceeded. Resets at midnight IST."
}

🌾 Mandi Bhav API

Get real-time commodity prices from agricultural markets across India.

GET /wp-json/mkisan/v1/mandi-bhav

Get mandi prices with optional filters

Query Parameters

Parameter Type Description
state string Filter by state code (e.g., UP, MP)
commodity string Filter by commodity name
date string Date in YYYY-MM-DD format
limit integer Number of results (default: 50, max: 500)
Response Example:
JSON
{
    "success": true,
    "data": [
        {
            "state": "Uttar Pradesh",
            "district": "Agra",
            "market": "Agra",
            "commodity": "Wheat",
            "variety": "Lokwan",
            "min_price": 2100,
            "max_price": 2350,
            "modal_price": 2250,
            "date": "2025-12-01"
        }
    ],
    "meta": {
        "total": 150,
        "page": 1,
        "limit": 50
    }
}

🥚 Egg Rates API

Get daily NECC egg rates for cities across India.

GET /wp-json/mkisan/v1/egg-rates

Get egg rates by city or date

Query Parameters

Parameter Type Description
city string City name (e.g., delhi, mumbai)
date string Date in YYYY-MM-DD format
Response Example:
JSON
{
    "success": true,
    "data": {
        "city": "Delhi",
        "rate": 5.85,
        "rate_per_100": 585,
        "rate_per_tray": 175.50,
        "change": 0.10,
        "date": "2025-12-01"
    }
}

🤝 Deals API

Access buy/sell deals posted by farmers and traders.

GET /wp-json/mkisan/v1/deals

Get active deals with filters

💡 Tip Deals API is available in Starter plan and above. Free plan has limited access.

📍 Locations API

Get states, districts, and mandi location data.

GET /wp-json/mkisan/v1/locations/states

Get all Indian states

GET /wp-json/mkisan/v1/locations/districts/{state_code}

Get districts by state