CCSA
Developer Documentation
API v1 — Live

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 URLhttps://fims.cosmopolitan.edu.ng
API Versionv1
ProtocolHTTPS only
FormatJSON
AuthAPI Key (Bearer or X-API-Key header)
OpenAPI Spechttps://fims.cosmopolitan.edu.ng/api/v1/openapi.json
Supportapi@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..."
To request an API key, submit an access request or email api@cosmopolitan.edu.ng with your organisation name, intended use-case, and the scopes you require (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.

ScopeEndpoints unlocked
farmers:readGET /api/v1/farmers, GET /api/v1/farmers/:id
farms:readGET /api/v1/farms, GET /api/v1/farms/:id
clusters:readGET /api/v1/clusters, GET /api/v1/clusters/:id
analytics:readGET /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.

TierRequests / minuteTypical use
Standard100Research, dashboards, ad-hoc queries
High-Volume Partner500Automated data pipelines, government integrations
CustomConfigured per keyContact 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

⚠️ Privacy notice: By default, identity, financial and contact fields are redacted from all API responses. Only a CCSA administrator can enable sensitive field access on a token, and only for verified internal CCSA products.

Every response includes a meta.sensitiveFieldsExposed boolean and a meta.redactedGroups list so you always know exactly which fields are being withheld.

GroupFieldsDefault
identityninRedacted
financialbvn, bankName, accountNumber, accountNameRedacted
contactphone, email, whatsAppNumberRedacted

Farmers

GET/api/v1/farmersfarmers:read

Returns a paginated list of registered farmers. Supports multiple filters.

Query Parameters

ParameterTypeRequiredDescription
pageintegerNoPage number (default: 1)
limitintegerNoPer-page count, max 200 (default: 50)
searchstringNoSearch by first or last name
statestringNoFilter by state name (case-insensitive)
lgastringNoFilter by local government area
clusterstringNoFilter by cluster ID
statusstringNoEnrolled | FarmCaptured | Validated | Verified | Rejected
startDatedateNoRegistration date from (ISO 8601)
endDatedateNoRegistration 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..."
GET/api/v1/farmers/:idfarmers:read

Fetch 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

GET/api/v1/farmsfarms:read

Returns paginated farm records. Farm boundary polygon data is excluded from public API responses.

Query Parameters

ParameterTypeRequiredDescription
pageintegerNoPage number (default: 1)
limitintegerNoPer-page count, max 200 (default: 50)
farmerIdstringNoFilter by farmer ID
statestringNoFilter by farm state
cropstringNoFilter by primary crop (case-insensitive)
seasonstringNoFilter 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..."
GET/api/v1/farms/:idfarms:read

Fetch 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

GET/api/v1/clustersclusters:read

List all farmer clusters with summary statistics.

Query Parameters

ParameterTypeRequiredDescription
pageintegerNoPage number (default: 1)
limitintegerNoMax 200 (default: 50)
searchstringNoFilter by cluster title
activebooleanNo"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..."
GET/api/v1/clusters/:idclusters:read

Fetch a single cluster with a paginated list of its enrolled farmers.

Query Parameters

ParameterTypeRequiredDescription
pageintegerNoFarmer list page (default: 1)
limitintegerNoFarmers 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

GET/api/v1/analyticsanalytics:read

Aggregated 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

StatusMeaningCommon cause
401UnauthorizedMissing, invalid, expired, or revoked API key
403ForbiddenYour token does not have the required scope for this endpoint
404Not FoundThe requested record does not exist
422Unprocessable EntityInvalid query parameters
429Too Many RequestsRate limit exceeded — check Retry-After header
500Internal Server ErrorServer-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.
© 2026 Centre for Climate Smart Agriculture (CCSA), Cosmopolitan University Abuja. All rights reserved. api@cosmopolitan.edu.ng