API Reference
Auth
Log in and exchange credentials for a bearer access token, and refresh it.
post
/auth/api-keyAuthenticate using an organisation API key
Exchange an organisation API key for a JWT with organization_id embedded. Send the key in the X-API-Key header. The api_key query parameter still works for existing integrations but is deprecated; when both are sent the header wins.
Parameters
X-API-KeystringheaderOrganisation API key.
api_keystringquerydeprecatedResponse 200
access_tokenstringrequiredtoken_typestringrequiredexpirystring<date-time>optionalrefresh_tokenstringoptionalrefresh_token_expirystring<date-time>optionalPOST /auth/api-key
curl -X POST "https://api.cropsense.africa/auth/api-key" \
-H "X-API-Key: YOUR_ORG_API_KEY"Example response · 200
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "bearer",
"expiry": "2026-06-15T09:30:00Z",
"refresh_token": "refresh_token",
"refresh_token_expiry": "2026-06-15T09:30:00Z"
}post
/auth/token/refreshRefresh access token
Requires an
Authorization: Bearer header.Response 200
access_tokenstringrequiredtoken_typestringrequiredexpirystring<date-time>optionalrefresh_tokenstringoptionalrefresh_token_expirystring<date-time>optionalPOST /auth/token/refresh
curl -X POST "https://api.cropsense.africa/auth/token/refresh" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Example response · 200
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "bearer",
"expiry": "2026-06-15T09:30:00Z",
"refresh_token": "refresh_token",
"refresh_token_expiry": "2026-06-15T09:30:00Z"
}