Getting Started
Authentication
CropSense uses OAuth2 bearer tokens. Log in once to get an access token, then send it on every request.
Logging in
Get an API key for your organisation from your CropSense dashboard, then exchange it for an access token:
curl -X POST "https://api.cropsense.africa/auth/api-key?api_key=YOUR_ORG_API_KEY"This returns access_token, token_type, and expiry.
Authenticating requests
Send the access token on every other request as a bearer token:
curl "https://api.cropsense.africa/fields/YOUR_FIELD_ID" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Requests with a missing, invalid, or expired token return
401 Unauthorized.Refreshing a token
Before your token expires, refresh it — this itself requires a currently-valid bearer token:
curl -X POST "https://api.cropsense.africa/auth/token/refresh" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Full request and response shapes are in the Auth reference.