API Reference
Complete reference for all ShambaRecords API endpoints
Base URL
All API requests should be made to:
https://api.shambarecords.com
Common Headers
| Header | Required | Description |
|---|---|---|
| X-API-Key | Yes | Your API key (public or secret) |
| Content-Type | POST/PUT | application/json |
| X-Signature | Secret Key | HMAC signature (required for secret key requests) |
| X-Signature-Timestamp | Secret Key | Unix timestamp (required for secret key requests) |
Response Format
All API responses follow a consistent JSON structure:
Success Response
{
"data": {
// Response data here
},
"meta": {
"page": 1,
"page_size": 20,
"total": 100,
"total_pages": 5
}
}Response Fields:
data- The requested data or resourcemeta- Metadata about the response (pagination info, etc.)
Error Response
{
"error": "bad_request",
"message": "Invalid product UUID format",
"code": "INVALID_UUID",
"details": {
"field": "product_uuid",
"received": "invalid-uuid"
}
}Error Fields:
error- Error category (bad_request, unauthorized, etc.)message- Human-readable error messagecode- Machine-readable error codedetails- Additional context about the error (optional)
Pagination
List endpoints support pagination using query parameters:
| Parameter | Default | Description |
|---|---|---|
| page | 1 | Page number to retrieve |
| page_size | 20 | Number of items per page (max: 100) |
The meta object in the response contains pagination information:
- •
page- Current page number - •
page_size- Items per page - •
total- Total number of items - •
total_pages- Total number of pages
HTTP Status Codes
| Status Code | Meaning |
|---|---|
| 200 OK | Request succeeded |
| 201 Created | Resource created successfully |
| 400 Bad Request | Invalid request parameters or body |
| 401 Unauthorized | Authentication failed or missing credentials |
| 403 Forbidden | Insufficient permissions for requested resource |
| 404 Not Found | Requested resource does not exist |
| 429 Too Many Requests | Rate limit exceeded |
| 500 Internal Server Error | Server error occurred |
| 503 Service Unavailable | Service temporarily unavailable |
API Endpoints
Explore detailed documentation for each API resource:
Prices API
Search, retrieve, and analyze agricultural commodity prices
Products API
List and search agricultural products and commodities
Markets API
Access information about agricultural markets and trading centers
Counties API
Get county and sub-county information across Kenya
Crops & Reference Data API
Access crop categories, units of measurement, and reference data