Middleware API

Overview

The Colmeia middleware provides a unified API for accessing agricultural data from connected providers. Each tenant has a bearer secret that authenticates all data requests.

Base URL: https://colmeia.mt2data.cloud/api

Authentication

All data routes require a tenant bearer secret in the Authorization header:

Authorization: Bearer <tenant-secret>

Tenant secrets are provisioned by MT2Data and can be rotated through the dashboard. Contact support if you need a new secret.


Connection Status

GET /api/data/:tenantId/connections

Returns the connection state for all providers configured for your tenant. Use this as a pre-flight check before making data requests.

curl https://colmeia.mt2data.cloud/api/data/YOUR_TENANT_ID/connections \
  -H "Authorization: Bearer YOUR_TENANT_SECRET"

Response:

{
  "success": true,
  "data": {
    "tenant_id": "your-tenant-id",
    "connections": [
      { "provider": "john_deere", "connected": true, "expired": false, "expires_at": 1714086400, "auto_renew": true },
      { "provider": "syngenta",   "connected": true, "expired": false },
      { "provider": "solinftec",  "connected": true, "expired": false, "expires_at": 2092433279, "auto_renew": true },
      { "provider": "datalake",   "connected": true, "expired": false, "expires_at": 1714090000, "auto_renew": true },
      { "provider": "pims",       "connected": true, "expired": false, "custom": true, "client_slug": "<your_pims_slug>",     "display_name": "<your_pims_label>" },
      { "provider": "protheus",   "connected": true, "expired": false, "custom": true, "client_slug": "<your_protheus_slug>", "display_name": "<your_protheus_label>" },
      { "provider": "farmtell",   "connected": true, "expired": false, "custom": true, "client_slug": "<your_farmtell_slug>", "display_name": "<your_farmtell_label>" },
      { "provider": "solinftec",  "connected": true, "expired": false, "snowflake": true, "source_id": "solinftec", "enabled": true, "data_path": "/api/sn/data/your-tenant-id/solinftec/query" }
    ]
  }
}

A connected: false provider means that integration has not been configured for your tenant yet. Contact MT2Data to enable it.

Entries with "custom": true represent custom SQL integrations (PIMS, Protheus, Farmtell, ...). provider is the integration type, client_slug is the per-tenant routing slug used by the data endpoint (/api/<client_slug>/data/<tenant_id>/query). A custom integration only appears here when it is enabled for your tenant.

Entries with "snowflake": true are Snowflake-routed connectors. source_id is the catalog slug for the external system reached over Snowflake (solinftec, …); data_path is the full URL to POST queries against — see snowflake.md. The provider field equals source_id, which can collide with a fixed-provider id (e.g. solinftec is also a first-class provider mounted under /api/sl/data/...). Both rows can appear in the same payload — they represent two distinct integrations and agents disambiguate by the snowflake: true flag plus the data_path URL.


Route Discovery

GET /api/

Returns the full list of available routes. No auth required.

curl https://colmeia.mt2data.cloud/api/

Response Envelope

All endpoints return a consistent JSON envelope:

{ "success": true,  "data": { ... } }
{ "success": false, "error": "snake_case_error_code" }

Client-facing error codes

CodeHTTPMeaning
unauthorized401Missing or invalid tenant bearer secret
unsupported_provider400Unknown provider ID
phone_not_linked404Phone number not provisioned to any tenant