DairyStash API

Access your farm data securely as JSON or CSV.

The DairyStash API allows authorized clients to retrieve farm data from DairyStash in a consistent, secure, and read-only way. It supports JSON responses for integrations and CSV export for analysts, Excel, and BI tools.

  • Read-only

    No create/update/delete allowed
  • JSON / CSV

    Optimized for integrations & exports
  • API Keys

    Per-farm authentication & access control

What the API can do

  • Retrieve data by farm

    Each request includes a farm code in the URL, and the API key must match that farm.
  • Export as JSON

    Best for applications, dashboards, integrations, or automation.
  • Export as CSV

    Best for Excel/Power BI and analysts who prefer tabular exports.
  • Filter and paginate

    Use query parameters for limits, offsets, ordering, fields, and filters (as allowed).

Security model

  • Per-farm API keys

    Keys are scoped to a single farm. If the farm code in the URL does not match the key, the request is rejected.
  • Read-only access

    The API only exposes safe SELECT endpoints. No write operations are available.
  • Controlled exposure

    Only approved tables/events and fields are exposed. Sensitive columns can be blocked.

Base URL & endpoints

Use the base URL below for your integrations. Your API key must be included in every request (except /health).

  • Health check

    GET /health (no API key required)
  • Verify your key

    GET /whoami (returns the farm code associated with your key)
  • Query farm data

    GET /farms/<farm_code>/events/<event_name>

Header required: X-API-Key: FARM.<farm_code>.<kid>.<signature>

Quick examples

Example: JSON

curl -H "X-API-Key: FARM.<farm_code>.k1.<signature>" \
"https://dairystash.com/api/v1/farms/<farm_code>/events/inventory?format=json&limit=100"

Example: CSV

curl -H "X-API-Key: FARM.<farm_code>.k1.<signature>" \
"https://dairystash.com/api/v1/farms/<farm_code>/events/inventory?format=csv&limit=1000" \
-o data.csv

For full details (filters, fields, ordering, limits), open: API Documentation