Integration Guide for Partners
Authenticate with API keys, subscribe to real-time webhook events, and build integrations that respond to farm activity as it happens.
Quick Start
Four steps to start receiving events from AgricVue.
- 1
Create an API Key
In the AgricVue dashboard go to Settings → API Keys. Create a key with the "webhooks" scope.
- 2
Authenticate
Include the key in every request as X-API-Key header.
- 3
Create a Webhook Subscription
POST to /api/v1/webhooks with your URL and the event types you want. Save the signing_secret returned in the response.
- 4
Receive Events
AgricVue will POST JSON payloads to your URL with HMAC-SHA256 signatures for verification.
Authentication
All API requests require an X-API-Key header.
curl -H "X-API-Key: agr_sk_your_key_here" \
https://api.agricvue.com/api/v1/farmsScopes
| Scope | Access |
|---|---|
farms | Create, read, update, delete farms |
analyses | Trigger and view suitability analyses |
reports | Generate and download reports |
monitoring | Vegetation monitoring and disease detection |
billing | Subscription and payment management |
credit-scoring | Credit score computation and access |
webhooks | Webhook subscription management |
Rate Limits: Default is 1,000 requests/hour per key. Contact us to increase limits for high-volume integrations.
Webhook Setup
Create a Subscription
curl -X POST https://api.agricvue.com/api/v1/webhooks \
-H "X-API-Key: agr_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-server.com/webhooks/agricvue",
"event_types": ["farm.created", "monitoring.completed", "harvest.ready"],
"description": "Production webhook"
}'Response includes a signing_secret shown only once. Store it securely for verifying incoming payloads.
Manage Subscriptions
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/webhooks | Create subscription |
| GET | /api/v1/webhooks | List subscriptions |
| GET | /api/v1/webhooks/{id} | Get details + delivery logs |
| PATCH | /api/v1/webhooks/{id} | Update URL, events, or status |
| DELETE | /api/v1/webhooks/{id} | Delete subscription |
| POST | /api/v1/webhooks/{id}/test | Send test ping |
Event Types Reference
Subscribe to one or more of these events.
farm.createdA new farm is registered{
"event": "farm.created",
"event_id": "uuid",
"timestamp": "2026-03-19T10:00:00Z",
"data": {
"farm_id": "uuid",
"name": "Adekunle Rice Farm",
"area_hectares": 12.5,
"location": "Kebbi State",
"country": "Nigeria"
}
}farm.updatedFarm details are modified{
"event": "farm.updated",
"event_id": "uuid",
"timestamp": "2026-03-19T10:00:00Z",
"data": {
"farm_id": "uuid",
"name": "Adekunle Rice Farm",
"changes": ["farm_name", "current_use"]
}
}monitoring.completedVegetation monitoring finishes for a farm{
"event": "monitoring.completed",
"event_id": "uuid",
"timestamp": "2026-03-19T10:00:00Z",
"data": {
"farm_id": "uuid",
"result_id": "uuid",
"ndvi": 0.72,
"health_status": "healthy",
"trend": "improving"
}
}harvest.readyHarvest readiness score >= 75%{
"event": "harvest.ready",
"event_id": "uuid",
"timestamp": "2026-03-19T10:00:00Z",
"data": {
"farm_id": "uuid",
"score": 82,
"crop": "rice",
"estimated_date": "2026-04-15"
}
}disease.detectedDisease detection completes{
"event": "disease.detected",
"event_id": "uuid",
"timestamp": "2026-03-19T10:00:00Z",
"data": {
"farm_id": "uuid",
"disease": "Rice Blast",
"confidence": 0.94,
"severity": "moderate"
}
}weather.advisoryDaily weather advisory generated{
"event": "weather.advisory",
"event_id": "uuid",
"timestamp": "2026-03-19T10:00:00Z",
"data": {
"farm_id": "uuid",
"advisory_id": "uuid",
"severity": "warning",
"summary": "Heavy rainfall expected (45mm) in next 24h..."
}
}analysis.completedSuitability analysis finishes{
"event": "analysis.completed",
"event_id": "uuid",
"timestamp": "2026-03-19T10:00:00Z",
"data": {
"farm_id": "uuid",
"analysis_id": "uuid",
"score": 78.5,
"class": "suitable"
}
}credit_score.updatedCredit score is computed for a farm{
"event": "credit_score.updated",
"event_id": "uuid",
"timestamp": "2026-03-19T10:00:00Z",
"data": {
"farm_id": "uuid",
"score": 72,
"risk_class": "good"
}
}Webhook Security
Every webhook delivery includes an X-AgricVue-Signature header containing an HMAC-SHA256 signature of the payload body. Always verify this before processing.
Headers Sent
| Header | Value |
|---|---|
| X-AgricVue-Signature | sha256=<hex_digest> |
| X-AgricVue-Event | Event type (e.g. farm.created) |
| X-AgricVue-Delivery | Unique delivery UUID (for idempotency) |
Verification Examples
Python
import hmac, hashlib
def verify_webhook(payload_bytes: bytes, secret: str, signature_header: str) -> bool:
expected = hmac.new(
secret.encode("utf-8"), payload_bytes, hashlib.sha256
).hexdigest()
received = signature_header.removeprefix("sha256=")
return hmac.compare_digest(expected, received)Node.js
const crypto = require("crypto");
function verifyWebhook(body, secret, signatureHeader) {
const expected = crypto
.createHmac("sha256", secret)
.update(body)
.digest("hex");
const received = signatureHeader.replace("sha256=", "");
return crypto.timingSafeEqual(
Buffer.from(expected), Buffer.from(received)
);
}Go
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"strings"
)
func VerifyWebhook(body []byte, secret, sigHeader string) bool {
mac := hmac.New(sha256.New, []byte(secret))
mac.Write(body)
expected := hex.EncodeToString(mac.Sum(nil))
received := strings.TrimPrefix(sigHeader, "sha256=")
return hmac.Equal([]byte(expected), []byte(received))
}Delivery & Retries
1st attempt
Immediate
Sent as soon as the event fires
2nd attempt
+5 minutes
First retry after a failed delivery
3rd attempt
+30 minutes
Final retry attempt
- Success:Any 2xx HTTP status code
- Timeout:10 seconds per attempt
- Payload limit:Response body is truncated to 2,000 characters in logs
Error Handling
The API returns standard HTTP status codes with JSON error bodies.
{
"detail": "API key does not have the 'webhooks' scope"
}| Status | Meaning |
|---|---|
400 | Invalid request body or parameters |
401 | Missing or invalid API key |
403 | API key lacks required scope |
404 | Resource not found |
422 | Validation error (e.g. invalid event types) |
429 | Rate limit exceeded |
500 | Internal server error |
Testing
Use the test endpoint to send a ping event to your webhook URL without waiting for a real event to fire.
curl -X POST https://api.agricvue.com/api/v1/webhooks/{id}/test \
-H "X-API-Key: agr_sk_your_key_here"The test endpoint sends a synchronous request and returns the result immediately:
{
"success": true,
"status_code": 200,
"error": null
}Tip: Use webhook.site to get a temporary URL for testing during development.
Lender Portfolio Monitoring
Continuous visibility into crop health across your entire loan book. Authenticated via X-API-Key (lender API keys, format: agr_live_...).
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/lender/portfolio/summary | Aggregated portfolio: avg score, risk distribution, farms needing attention |
| GET | /api/v1/lender/portfolio/farms | All farms with scores, deltas, health. Filterable by risk_class, score range |
| GET | /api/v1/lender/portfolio/watchlist | Farms below score floor or with critical health |
| GET | /api/v1/lender/portfolio/alerts | Score deterioration alerts with severity and context |
| GET | /api/v1/lender/portfolio/analytics | Risk reduction proof: intervention rates, recovery, trajectory, insurance absorption |
| GET | /api/v1/lender/portfolio/advisories | Advisory delivery metrics across portfolio |
| GET | /api/v1/lender/portfolio/farms/{id}/timeline | 26-week score + NDVI + health sparkline data |
| GET | /api/v1/lender/portfolio/farms/{id}/advisories | Advisory history for a single farm |
| GET | /api/v1/lender/portfolio/settings | Get alert threshold configuration |
| POST | /api/v1/lender/portfolio/settings | Configure score floor, drop threshold, webhook URL, email recipients |
Parametric Insurance Data API
Weekly crop stress indices, risk profiles, and automatic claim triggering for insurers. Authenticated via X-API-Key (insurer keys, format: agr_ins_...).
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/insurance/data/farms/{id}/stress-indices | Weekly crop stress: NDVI, flood score, rainfall, temperature, disease |
| GET | /api/v1/insurance/data/farms/{id}/risk-profile | Aggregated risk profile for underwriting |
| GET | /api/v1/insurance/data/farms/{id}/triggers | Check parametric triggers against policy thresholds |
| POST | /api/v1/insurance/data/policies | Create insurance policy for a farm |
| GET | /api/v1/insurance/data/policies/{id}/claims | List claims for a policy |
| GET | /api/v1/insurance/claims/{id} | Full claim detail with satellite evidence |
| GET | /api/v1/insurance/claims/{id}/evidence | Satellite evidence package for a claim |
| POST | /api/v1/insurance/claims/{id}/approve | Approve claim with adjuster notes |
| POST | /api/v1/insurance/claims/{id}/reject | Reject claim with reason |
| POST | /api/v1/insurance/claims/{id}/mark-paid | Mark approved claim as paid |
Parametric Triggers
Claims auto-trigger when satellite data crosses these thresholds (configurable per policy):
| Trigger | Default Threshold | Data Source |
|---|---|---|
| Drought | NDVI < 0.2 for 3 consecutive weeks | Sentinel-2 / Sentinel-1 radar |
| Flood | Flood score >= 0.55 | Sentinel-1 radar backscatter |
| Pest/Disease | Severity >= severe | Disease detection AI |
| Excess Rain | Rainfall >= 200mm in 7 days | Open-Meteo / NASA POWER |
| Heat Stress | Temperature >= 40C for 3 days | Open-Meteo weather data |
Farm Verification & Compliance Reports
Fraud detection scores, satellite-verified land use proof, and regulatory compliance exports.
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/verification/farms/{id}/verification | Farm verification score + fraud flags + boundary history |
| GET | /api/v1/verification/portfolio/verification | Portfolio-wide verification scores, filterable |
| POST | /api/v1/compliance/reports | Generate CBN, DFI impact, or land use verification report |
| GET | /api/v1/compliance/reports | List generated compliance reports |
| GET | /api/v1/compliance/reports/{id}/download | Download report CSV |
| GET | /api/v1/verify/{certificate_number} | Public certificate verification (no auth, for QR codes) |
Verification Score Components
| Component | Weight | What It Checks |
|---|---|---|
| Crop Presence | 30% | Satellite-detected crop pixels vs registered boundary |
| Boundary Consistency | 20% | Has boundary changed since registration? |
| Monitoring Continuity | 15% | Regular satellite observations or suspicious gaps? |
| Data Quality | 15% | Cloud cover, valid pixel percentage |
| Claim Consistency | 10% | Do claims match satellite data? |
| Identity | 10% | Farm age, management events, activity level |
Fraud Flag Types
phantom_farmCrop pixel fraction < 15% for 3+ monitoring cycles
boundary_changedBoundary modified >20% from registration snapshot
claim_contradicts_satelliteClaim filed when certificate shows healthy crop
excessive_claimsMore than 5 claims on same farm
suspicious_areaArea changed >50% from original
data_quality_insufficientClaim triggers based on degraded satellite data
Compliance Report Types
cbn_portfolioCBN Portfolio
Land use proof, loan performance, risk distribution, fraud summary. CSV export.
dfi_impactDFI Impact
NDVI trends, predicted vs actual yield, insurance enrollment, claims paid.
land_use_verificationLand Use Verification
Per-farm satellite evidence: certificate, verification score, monitoring readings.
Community Alerts, Insurance & Certificates
Farmer-facing endpoints for disease alerts, insurance enrollment, and harvest certificates. Authenticated via JWT or tenant API key.
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/community/farms/{id}/alerts | Disease alerts within 75km of farm |
| POST | /api/v1/community/alerts/{id}/confirm | Confirm, dismiss, or mark 'not seen' |
| GET | /api/v1/community/outbreaks/heatmap | Outbreak clusters + GeoJSON for map |
| POST | /api/v1/insurance/farms/{id}/enroll | One-tap insurance enrollment |
| GET | /api/v1/insurance/farms/{id}/policies | List insurance policies |
| GET | /api/v1/insurance/farms/{id}/claims | List insurance claims |
| POST | /api/v1/farms/{id}/certificates | Issue a harvest certificate |
| GET | /api/v1/farms/{id}/certificates | List certificates for a farm |
| POST | /api/v1/farms/{id}/harvest-outcomes | Record actual post-harvest yield |