API access
The GrainLink API is available on Pro plans and above. It’s a straightforward REST API that returns JSON.
Authentication
API requests authenticate with a bearer token. Generate one under Settings → API tokens. Tokens are scoped to your organization and inherit the role of the user who created them.
Authorization: Bearer gl_live_••••••Base URL
https://api.grainlink.com/v1Common endpoints
| Method | Path | Purpose |
|---|---|---|
GET | /locations | List all locations in your org |
GET | /locations/:id/bins | List bins at a location |
GET | /bins/:id | Current state of a bin |
GET | /bins/:id/readings?from=...&to=... | Time-series sensor data |
POST | /bins/:id/fan | Set fan mode (auto, on, off) |
Rate limits
60 requests per minute per token. Bulk historical queries should use the Reports export endpoints rather than polling /readings in a loop.
Webhooks
Instead of polling, you can configure webhooks under Settings → Webhooks. We will POST a JSON payload to your endpoint for any of: alert fired, alert resolved, device offline, device online, fan state changed.
Full schemas and example payloads are available in the dashboard under Settings → API → Documentation.