Skip to content

Authentication

All AsiliChain API endpoints require authentication via a Bearer token issued to cooperative operators, field agents, or buyer portal users.

Token typeIssued toPermissions
COOPERATIVECooperative manager walletAll endpoints for that cooperative’s batches
AGENTField agents under a cooperativePOST /farmers/register, POST /batch/submit
BUYERCommodity trader buyer portalPOST /purchase-orders, GET /batches (public data)
MFIUGAFODE, ENCOT, aBi FinanceGET /lending/pool-status, GET /loans
ADMINAsiliChain internalAll endpoints

Tokens are issued after KYB (Know Your Business) verification of the cooperative or organisation. Contact team@asilichain.xyz.

Terminal window
# Exchange API key for Bearer token
curl -X POST https://api.asilichain.xyz/auth/token \
-H "Content-Type: application/json" \
-d '{
"api_key": "ask_live_xxxxxxxxxxxxxxxxxxxx",
"cooperative_id": "COOP-MBALE-001"
}'

Response:

{
"access_token": "eyJhbGciOiJIUzI1NiIsInR...",
"token_type": "Bearer",
"expires_in": 86400,
"scope": "COOPERATIVE"
}
Terminal window
# Include in all API requests
curl https://api.asilichain.xyz/batch/BATCH-2026-004821 \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR..."

Tokens expire after 24 hours. Refresh before expiry:

Terminal window
curl -X POST https://api.asilichain.xyz/auth/refresh \
-H "Authorization: Bearer {current_token}"

Incoming Alchemy webhooks are verified using HMAC-SHA256 signature:

import { createHmac } from 'crypto';
function verifyAlchemySignature(body: string, signature: string, secret: string): boolean {
const expected = createHmac('sha256', secret).update(body).digest('hex');
return `0x${expected}` === signature;
}
EnvironmentBase URL
Productionhttps://api.asilichain.xyz
Staging (Sepolia)https://staging-api.asilichain.xyz
Local developmenthttp://localhost:3000
Token typeRate limit
AGENT60 requests/minute
COOPERATIVE120 requests/minute
BUYER60 requests/minute
MFI30 requests/minute

Rate limit headers are returned on every response:

X-RateLimit-Limit: 120
X-RateLimit-Remaining: 117
X-RateLimit-Reset: 1714900800