Data Integration
The CropWatch API delivers secure, rate-limited access to a RESTful data transfer system. Using our API, you can move data between your existing systems and applications that support API integrations such as Microsoft Excel, Power BI, Tableau, and more.
Base URL and headers you’ll use on every call.
What the CropWatch API delivers
Unified sensor streams
One schema for air, soil, water, power, and traffic telemetry. Query by device dev_eui with precise time windows and optional IANA timezone alignment.
Defense-in-depth
Bearer JWT for identity + header-based API key for workload gating. Helmet middleware and rate limits (2 req / 2s, 5s block) resist spikes and abuse.
Documentation ready
Interactive Swagger UI at /docs ships with live schemas, sample responses, and tagged operations for every module.
Static assets on edge
Prebuilt static artifacts and swagger theme are served directly from the API, keeping onboarding close to the data plane.
Getting Started with Authentication
Authentication Methods
Authentication may be done via Bearer JWT and/or header-based API key.
JWT is the most common, and recommended method of authentication, as it provides a secure and flexible way to authenticate users. API keys are also supported for additional security and workload gating.
API Keys are available upon request; contact CropWatch support to provision keys for your account.
Rate limits
ThrottlerGuard enforces 2 requests per 2 seconds (5s block). Design batch jobs to respect this cadence or space retries with jitter.
If you have a need to change the rate-limit on your account, please contact support to discuss available options.
Getting Authenticated now.
Serve over TLS in production. Add the JWT and api key per request; avoid embedding keys in client-side apps.
curl -X GET \
curl -X 'POST' \
'https://api.cropwatch.io/auth/login' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"email": "user@example.com",
"password": "StrongPassword123!"
}'
async function login() {
const response = await fetch('https://api.cropwatch.io/auth/login', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
email: 'user@example.com',
password: 'StrongPassword123!',
}),
});
if (!response.ok) {
// Non-2xx = failure
const text = await response.text();
throw new Error(`Login failed (${response.status}): ${text}`);
}
const data = await response.json();
return data;
}
A successful login returns a JSON object containing a JWT token. The object returned will contain a "access_token", this will be your bearer token for subsequent requests. It will also contain an "expires_in" field indicating the token's validity period in seconds, use this to determine when a JWT refresh is needed.
Core endpoints
/air/{dev_eui}?start&end&timezone
Returns air telemetry for a device. Defaults to the last 24h ending now. start/end expect ISO 8601.
/soil/{dev_eui}?start&end&timezone
Pull soil moisture/temperature readings with optional timezone shift for reporting.
/water/{dev_eui}?start&end&timezone
Fetch water quality/level metrics for a device across the selected window.
/power/{dev_eui}?start&end&timezone
Retrieve power telemetry to validate uptime and load profiles.
/traffic/{dev_eui}?start&end&timezone
Access traffic sensor counts and flow metrics for monitored corridors.
/realtime/{dev_eui}?start&end&timezone
Live-friendly endpoint for rapid polling or websockets via the realtime module.
Tip: all read endpoints accept ISO timestamps; when omitted, the API defaults to the previous 24 hours ending at now.