Learn how to authenticate with the ILAL API
Every protected ILAL endpoint accepts either of these two methods. You only need one per request.
X-API-Key: ilal_live_...Best for backend services, SDKs, and CI/CD pipelines. Create keys in the API Keys dashboard.
Authorization: Bearer eyJhbG...Best for browser-based apps and the ILAL Dashboard. Obtain a token via POST /auth/login.
curl -X POST https://ilal-mvp-production.up.railway.app/api/v1/defi/swap \
-H "X-API-Key: ilal_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{"tokenIn":"0x...","tokenOut":"0x...","amount":"1000","zeroForOne":true,"userAddress":"0x..."}'curl -X GET https://ilal-mvp-production.up.railway.app/api/v1/usage/stats \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
-H "Content-Type: application/json"X-API-Key header is present, the server uses API Key auth exclusively.X-API-Key is absent, it falls back to Authorization: Bearer (JWT).authMethod: "api_key" or "jwt" so you can verify which path was used.All API Key errors include a machine-readable code field for programmatic handling:
API_KEY_FORMAT_INVALIDKey doesn't match ilal_{test|live}_{48 hex}API_KEY_PREFIX_NOT_FOUNDNo key with this prefix exists in the databaseAPI_KEY_HASH_MISMATCHKey found but hash verification failedAPI_KEY_INACTIVEKey has been deactivatedAPI_KEY_EXPIREDKey is past its expiration dateAPI_KEY_SCOPE_MISSINGKey lacks a required permission{
"error": "Unauthorized",
"code": "API_KEY_HASH_MISMATCH",
"message": "API Key hash verification failed",
"hint": "Ensure you are using the exact key returned at creation time"
}# .env file
ILAL_API_KEY=ilal_live_1234567890abcdef...
# In your code
const apiKey = process.env.ILAL_API_KEY;You can create, view, and revoke API Keys from the Dashboard.
Go to API Keys Management