
FIMS Public API
Programmatic access to farmer registration, farm capture, cluster and analytics data from the CCSA Farmer Information Management System.
Overview
The FIMS API is a read-only REST API that exposes farmer registration, farm capture, cluster and aggregated analytics data. All responses are JSON.
| Base URL | https://fims.cosmopolitan.edu.ng |
| API Version | v1 |
| Protocol | HTTPS only |
| Format | JSON |
| Auth | API Key (Bearer or X-API-Key header) |
| OpenAPI Spec | https://fims.cosmopolitan.edu.ng/api/v1/openapi.json |
| Support | api@cosmopolitan.edu.ng |
Authentication
Every request to /api/v1/* must include a valid API token. Tokens are issued by a CCSA system administrator and take the format fims_live_{64 hex chars}.
Pass your token in one of two ways:
Option A — Authorization header (recommended)
curl https://fims.cosmopolitan.edu.ng/api/v1/farmers \
-H "Authorization: Bearer fims_live_abc123..."Option B — X-API-Key header
curl https://fims.cosmopolitan.edu.ng/api/v1/farmers \
-H "X-API-Key: fims_live_abc123..."farmers:read, farms:read, clusters:read, analytics:read).Scopes
Each API key is granted specific scopes. Calling an endpoint that requires a scope your token does not have returns a 403 Forbidden.
| Scope | Endpoints unlocked |
|---|---|
| farmers:read | GET /api/v1/farmers, GET /api/v1/farmers/:id |
| farms:read | GET /api/v1/farms, GET /api/v1/farms/:id |
| clusters:read | GET /api/v1/clusters, GET /api/v1/clusters/:id |
| analytics:read | GET /api/v1/analytics |
Rate Limits
Rate limits are enforced per API key using a 60-second sliding window. Your token's limit is configured at creation time.
| Tier | Requests / minute | Typical use |
|---|---|---|
| Standard | 100 | Research, dashboards, ad-hoc queries |
| High-Volume Partner | 500 | Automated data pipelines, government integrations |
| Custom | Configured per key | Contact CCSA admin |
When the limit is exceeded the API responds with 429 Too Many Requests and a Retry-After: 60 header. Implement exponential back-off in your client.
Sensitive Fields & Privacy
Every response includes a meta.sensitiveFieldsExposed boolean and a meta.redactedGroups list so you always know exactly which fields are being withheld.
| Group | Fields | Default |
|---|---|---|
| identity | nin | Redacted |
| financial | bvn, bankName, accountNumber, accountName | Redacted |
| contact | phone, email, whatsAppNumber | Redacted |
Farmers
/api/v1/farmersfarmers:readReturns a paginated list of registered farmers. Supports multiple filters.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | integer | No | Page number (default: 1) |
| limit | integer | No | Per-page count, max 200 (default: 50) |
| search | string | No | Search by first or last name |
| state | string | No | Filter by state name (case-insensitive) |
| lga | string | No | Filter by local government area |
| cluster | string | No | Filter by cluster ID |
| status | string | No | Enrolled | FarmCaptured | Validated | Verified | Rejected |
| startDate | date | No | Registration date from (ISO 8601) |
| endDate | date | No | Registration date to (ISO 8601) |
Example Request
curl "https://fims.cosmopolitan.edu.ng/api/v1/farmers?state=Kano&status=Enrolled&limit=20" \
-H "X-API-Key: fims_live_abc123..."/api/v1/farmers/:idfarmers:readFetch a single farmer by their FIMS ID, including their registered farms and cluster.
Example Request
curl "https://fims.cosmopolitan.edu.ng/api/v1/farmers/clxqp8yzf0000..." \
-H "X-API-Key: fims_live_abc123..."Sample response (sensitive fields redacted):
{
"data": {
"id": "clxqp8yzf0000abc",
"firstName": "Aminu",
"middleName": null,
"lastName": "Suleiman",
"gender": "Male",
"state": "Kano",
"lga": "Kano Municipal",
"ward": "Fagge",
"status": "Enrolled",
"registrationDate": "2025-03-01T08:00:00.000Z",
"nin": null,
"bvn": null,
"phone": null,
"email": null,
"cluster": { "id": "clust_001", "title": "Kano North Cluster" },
"farms": [ { "id": "farm_001", "primaryCrop": "Maize", "farmSize": 2.5 } ]
},
"meta": {
"sensitiveFieldsExposed": false,
"redactedGroups": ["identity", "financial", "contact"],
"note": "Identity, financial and contact fields are redacted."
}
}Farms
/api/v1/farmsfarms:readReturns paginated farm records. Farm boundary polygon data is excluded from public API responses.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | integer | No | Page number (default: 1) |
| limit | integer | No | Per-page count, max 200 (default: 50) |
| farmerId | string | No | Filter by farmer ID |
| state | string | No | Filter by farm state |
| crop | string | No | Filter by primary crop (case-insensitive) |
| season | string | No | Filter by farming season |
Example Request
curl "https://fims.cosmopolitan.edu.ng/api/v1/farms?state=Katsina&crop=Sorghum&limit=20" \
-H "X-API-Key: fims_live_abc123..."/api/v1/farms/:idfarms:readFetch a single farm by ID, including basic farmer info (sensitive fields subject to token settings).
Example Request
curl "https://fims.cosmopolitan.edu.ng/api/v1/farms/farm_clxqp001" \
-H "X-API-Key: fims_live_abc123..."Clusters
/api/v1/clustersclusters:readList all farmer clusters with summary statistics.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | integer | No | Page number (default: 1) |
| limit | integer | No | Max 200 (default: 50) |
| search | string | No | Filter by cluster title |
| active | boolean | No | "true" or "false" to filter by active status |
Example Request
curl "https://fims.cosmopolitan.edu.ng/api/v1/clusters?active=true" \
-H "X-API-Key: fims_live_abc123..."/api/v1/clusters/:idclusters:readFetch a single cluster with a paginated list of its enrolled farmers.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | integer | No | Farmer list page (default: 1) |
| limit | integer | No | Farmers per page, max 100 (default: 20) |
Example Request
curl "https://fims.cosmopolitan.edu.ng/api/v1/clusters/clust_001?limit=10" \
-H "X-API-Key: fims_live_abc123..."Analytics
/api/v1/analyticsanalytics:readAggregated summary: total farmers, total farms, farmers by state, farmers by gender, top crops, seasonal breakdown. Cached for 10 minutes. No PII is included.
Example Request
curl "https://fims.cosmopolitan.edu.ng/api/v1/analytics" \
-H "X-API-Key: fims_live_abc123..."{
"data": {
"summary": {
"totalFarmers": 154820,
"totalFarms": 142100,
"totalClusters": 48,
"totalFarmAreaHectares": 289450.5,
"averageFarmSizeHectares": 2.04
},
"farmersByState": [
{ "state": "Kano", "count": 42100 },
{ "state": "Katsina", "count": 31200 }
],
"farmersByGender": [
{ "gender": "Male", "count": 120400 },
{ "gender": "Female", "count": 34420 }
],
"topCrops": [
{ "crop": "Maize", "farmCount": 58000 },
{ "crop": "Sorghum", "farmCount": 41200 }
]
}
}Error Codes
| Status | Meaning | Common cause |
|---|---|---|
| 401 | Unauthorized | Missing, invalid, expired, or revoked API key |
| 403 | Forbidden | Your token does not have the required scope for this endpoint |
| 404 | Not Found | The requested record does not exist |
| 422 | Unprocessable Entity | Invalid query parameters |
| 429 | Too Many Requests | Rate limit exceeded — check Retry-After header |
| 500 | Internal Server Error | Server-side error — contact CCSA support |
All errors follow this envelope:
{
"error": "Forbidden",
"message": "Your API key does not have the \"farms:read\" scope required for this endpoint.",
"yourScopes": ["farmers:read", "analytics:read"]
}Changelog
- 2026-03-24v1.0.0 — Initial release. Farmers, Farms, Clusters, Analytics endpoints. Token-based auth with granular scopes and per-key rate limiting.