CropWatch Logo
CropWatch API
Data Integrations
Industrial-Ready IoT

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.

Developer quickstart

Base URL and headers you’ll use on every call.

https://your-api-host
Authorization: Bearer <jwt>
x-api-key: <api-key>
Rate limit: 2 requests / 2 seconds (5s block).
Platform

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.

Security

Authentication & access

Dual credentials

Every call supplies a Bearer token in Authorization and an x-api-key header. Tokens are validated by JwtAuthGuard and requests without both are rejected.

Rate limits

ThrottlerGuard enforces 2 requests per 2 seconds (5s block). Design batch jobs to respect this cadence or space retries with jitter.

Transport

Serve over TLS in production. Add the JWT and api key per request; avoid embedding keys in client-side apps.

Coverage

Core endpoints

GET
/air/{dev_eui}?start&end&timezone

Returns air telemetry for a device. Defaults to the last 24h ending now. start/end expect ISO 8601.

GET
/soil/{dev_eui}?start&end&timezone

Pull soil moisture/temperature readings with optional timezone shift for reporting.

GET
/water/{dev_eui}?start&end&timezone

Fetch water quality/level metrics for a device across the selected window.

GET
/power/{dev_eui}?start&end&timezone

Retrieve power telemetry to validate uptime and load profiles.

GET
/traffic/{dev_eui}?start&end&timezone

Access traffic sensor counts and flow metrics for monitored corridors.

GET
/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.

Usage

Make your first call

cURL

Replace placeholders with your credentials and device id.

curl -X GET \
              "https://your-api-host/air/DEV_EUI?start=2025-01-01T00:00:00Z&end=2025-01-02T00:00:00Z" \
              -H "Authorization: Bearer <jwt>" \
              -H "x-api-key: <api-key>"
            

Expect an array of readings shaped per module DTOs (see /docs for schema).

Common parameters

  • start/end: ISO 8601; defaults to the last 24h.
  • timezone: IANA zone (e.g., America/Chicago); defaults to UTC.
  • dev_eui: required device identifier for all telemetry endpoints.

Explore interactively

Visit /docs to try operations, inspect schemas, and copy snippets.