Skip to content

Errors

All AsiliChain API errors return a consistent JSON structure with a machine-readable code and a human-readable message.

{
"error": {
"code": "BATCH_NOT_ELIGIBLE",
"message": "Batch BATCH-2026-004821 must be at GRADED stage or above to generate a DDS. Current stage: DELIVERED.",
"docs": "https://docs.asilichain.xyz/api-reference/errors#BATCH_NOT_ELIGIBLE",
"request_id": "req_01HXYZ..."
}
}
StatusMeaning
200 OKRequest succeeded
201 CreatedResource created (farmer registered, batch submitted)
202 AcceptedRequest received, processing async (MAAIF fallback pending GPS)
400 Bad RequestInvalid request body or parameters
401 UnauthorizedMissing or invalid Bearer token
403 ForbiddenValid token but insufficient permissions (e.g. AGENT token on COOPERATIVE endpoint)
404 Not FoundResource not found (farmer ID, batch ID, loan ID)
409 ConflictDuplicate resource (farmer already registered, batch already active loan)
422 UnprocessableValid format but business logic rejection (GFW check failed, stage out of order)
429 Too Many RequestsRate limit exceeded
500 Internal Server ErrorUnexpected server error — contact support with request_id
503 Service UnavailableMantle RPC or Hedera HCS temporarily unavailable
CodeHTTP StatusTriggerResolution
FARMER_NOT_REGISTERED404MAAIF farmer ID not in FarmerRegistryRegister farmer first via POST /farmers/register
FARMER_ALREADY_REGISTERED409MAAIF farmer ID already existsUse GET /farmers/{id} to retrieve
GFW_CHECK_FAILED422Farm polygon failed deforestation checkFarm ineligible — log for manual review
GFW_API_UNAVAILABLE503GFW API timeout after 3 retriesRetry after 5 minutes; if persistent, contact support
MAAIF_API_UNAVAILABLE202MAAIF NTS not respondingFallback to agent GPS walk
BATCH_NOT_ELIGIBLE422Batch stage too low for operationCheck current stage via GET /batch/{id}
BATCH_HAS_ACTIVE_LOAN409BatchToken already locked as collateralResolve existing loan before originating new
STAGE_OUT_OF_ORDER422Attempted to skip a stageStages must advance sequentially
INVALID_GRADE400Grade not in accepted setAccepted: screen18, screen15, FAQ, PB
PO_NOT_CONFIRMED422PurchaseOrder exists but not confirmedCooperative must confirm PO before COMMITTED stage
LOAN_NOT_FOUND404No active loan for this batchBatch has no current loan
STALE_PRICE_FEED503Chainlink feed >1 hour oldLoan origination paused — retry when feed updates
INVALID_SIGNATURE401Alchemy webhook signature mismatchCheck ALCHEMY_WEBHOOK_SECRET configuration
PAYOUT_FAILED500Kotani Pay API returned errorFarmer payout queued for retry; batch still settled
DDS_TRACES_PENDING202DDS generated but TRACES filing in retry queueDDS available at ipfs_url; TRACES reference pending
COOPERATIVE_NOT_FOUND404Cooperative ID not recognisedVerify cooperative is onboarded
INSUFFICIENT_COLLATERAL422BatchToken value below minimum loan thresholdMinimum loan: $50 USDC

Some operations are async — they return 202 Accepted immediately and complete in the background. Poll the resource to check status:

Terminal window
# Submit batch (returns 202 if Mantle tx is pending)
POST /batch/submit { "job_id": "job_01HXYZ...", "status": "PENDING" }
# Poll for completion
GET /jobs/job_01HXYZ... { "status": "COMPLETE", "batch_id": "BATCH-2026-004821", "tx_hash": "0x..." }

Webhook-based integrations receive a push notification instead of needing to poll.