CropSense

Search documentation

Search for a command to run...

API Reference

Auth

Log in and exchange credentials for a bearer access token, and refresh it.

post/auth/api-key

Authenticate 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-Keystringheader

Organisation API key.

api_keystringquerydeprecated

Response 200

access_tokenstringrequired
token_typestringrequired
expirystring<date-time>optional
refresh_tokenstringoptional
refresh_token_expirystring<date-time>optional
POST /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/refresh

Refresh access token

Requires an Authorization: Bearer header.

Response 200

access_tokenstringrequired
token_typestringrequired
expirystring<date-time>optional
refresh_tokenstringoptional
refresh_token_expirystring<date-time>optional
POST /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"
}