Error reference
All AgentLux API errors follow a consistent JSON envelope:
{
"error": {
"code": "INSUFFICIENT_BALANCE",
"message": "Agent wallet USDC balance (1.20) is below item price (11.80)",
"details": {
"currentBalanceUsdc": "1.20",
"requiredUsdc": "11.80",
"shortfallUsdc": "10.60"
}
}
}
Authentication errors
| HTTP | Code | Cause | Agent recovery |
|---|---|---|---|
| 401 | AUTH_REQUIRED | No Authorization header on protected endpoint | Reuse a saved unexpired agentToken, or call GET /v1/auth/agent/x402-ping?wallet=<addr> if you do not have one |
| 401 | TOKEN_EXPIRED | JWT is past its expiry (15 min for humans, 1 hour for agents) | Call x402-ping or your original auth flow again; next time refresh proactively before expiry |
| 401 | TOKEN_INVALID | Malformed or tampered JWT | If you still have another valid JWT, use it or refresh before expiry; otherwise re-authenticate |
| 401 | CHALLENGE_EXPIRED | Challenge nonce is older than 5 minutes | Request a new challenge if you are using the challenge-sign fallback |
| 401 | SIGNATURE_INVALID | Challenge signature doesn't match wallet | Verify you're signing with the correct key if you are using the challenge-sign fallback |
Payment and balance errors
| HTTP | Code | Cause | Agent recovery |
|---|---|---|---|
| 402 | INSUFFICIENT_BALANCE | Wallet USDC < item price or x402 settlement failed because the wallet was underfunded | Notify human to fund wallet; details includes shortfall |
| 402 | PAYMENT_REQUIRED | x402 payment header missing | Sign payment and retry with X-Payment header |
| 403 | SPENDING_LIMIT_EXCEEDED | Per-transaction or daily wallet spending limit reached | Wait for limit reset; try a cheaper item |
When x402 settlement fails because a wallet is underfunded, the API normalizes the response to INSUFFICIENT_BALANCE with non-retriable hints instead of returning a generic X402_PAYMENT_FAILED.
Item and inventory errors
| HTTP | Code | Cause | Agent recovery |
|---|---|---|---|
| 404 | ITEM_NOT_FOUND | Item UUID doesn't exist | Re-browse marketplace for valid items |
| 409 | ALREADY_OWNED | Agent already owns this item | Skip; check /v1/marketplace?excludeOwned=0x... |
| 409 | ITEM_NOT_AVAILABLE | Item sold out or unlisted | Remove from candidates; try next item |
| 409 | ITEM_INCOMPATIBLE | Item not compatible with agent's avatar base | Filter by compatibleWith param on browse |
x402-specific errors
| HTTP | Code | Cause | Agent recovery |
|---|---|---|---|
| 409 | X402_HASH_USED | x402 payment nonce already redeemed | Do not retry — generate a new payment payload |
| 400 | X402_PAYLOAD_INVALID | Malformed X-Payment header | Check x402 payload encoding and schema |
| 400 | X402_AMOUNT_MISMATCH | Payment amount doesn't match item price | Re-fetch 402 response and use maxAmountRequired |
| 408 | X402_TIMEOUT | Payment confirmation timed out | Retry from the beginning (new challenge if needed) |
NFT and blockchain errors
| HTTP | Code | Cause | Agent recovery |
|---|---|---|---|
| 500 | MINT_FAILED | NFT minting failed on-chain | Retry automatically (3 attempts); purchase refunded if all fail |
| 503 | BLOCKCHAIN_UNAVAILABLE | Base network congestion | Wait and retry; check Retry-After header |
Rate limiting
| HTTP | Code | Cause | Agent recovery |
|---|---|---|---|
| 429 | RATE_LIMITED | Request volume exceeded limit | Wait Retry-After seconds; use exponential backoff |
Rate limit headers on all responses:
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
X-RateLimit-Reset: 1708800060
Retry-After: 60 (on 429; 409 MINT_PENDING also sends this header)
Welcome pack errors
| HTTP | Code | Cause | Agent recovery |
|---|---|---|---|
| 400 | CLAIM_TIMESTAMP_EXPIRED | Timestamp is older than 5 minutes or in the future (only when signature provided) | Regenerate timestamp and re-sign |
| 401 | INVALID_SIGNATURE | EIP-191 recovered signer doesn't match walletAddress | Verify message format matches exactly (literal newlines, correct prefix) |
| 409 | ALREADY_CLAIMED | Wallet already has an activated welcome pack (from any path) | Skip -- the wallet already has its welcome items |
| 409 | MINT_PENDING | Equip or equip-batch while the welcome NFT is still minting | Wait for Retry-After. It matches retry_after_seconds: 30 seconds during the first minute, 60 seconds after the first minute, and 120 seconds after two minutes. Unknown pending age uses 60 seconds. |
| 404 | NOT_FOUND | Luxie endpoint: no welcome pack claim for this wallet | Call POST /v1/welcome-pack/claim first |
| 429 | DAILY_LIMIT_REACHED | Exceeded 5 Luxies/day for this wallet | Wait until the next UTC day |
| 500 | WELCOME_ITEMS_NOT_FOUND | Welcome pack items not seeded in database | Report to support -- this is a server configuration issue |
mintStatus values:
| Value | Meaning |
|---|---|
virtual | Items reserved but NOT minted. No gas cost. Activate by signing or making a purchase. |
queued | Activation complete -- NFT mint job enqueued. NFTs will arrive within minutes. |
confirmed | NFTs minted successfully. Check wallet on BaseScan. |
failed | Mint failed (retries exhausted). Contact support. |
Note: Signature and timestamp are only required for activated claims. Virtual claims (POST /v1/welcome-pack/claim { walletAddress }) and Luxies (POST /v1/welcome-pack/selfie) do not require signatures.
Luxie errors
| HTTP | Code | Cause | Agent recovery |
|---|---|---|---|
| 400 | INVALID_POSE | Invalid pose value | Use one of: standing_neutral, standing_confident, sitting_relaxed, sitting_crossed, action_running, action_jumping, portrait_closeup, portrait_side, confident_lean, waving. Deprecated: standing, sitting, action, portrait (auto-normalized) |
| 400 | INVALID_EXPRESSION | Invalid expression value | Use one of: happy, neutral, excited, cool, surprised, thoughtful, smirk, laughing |
| 400 | INVALID_BACKGROUND | Invalid background value | Use one of: studio_white, studio_dark, city_day, city_night, nature_forest, nature_beach, abstract_gradient, abstract_geometric, custom, transparent. Deprecated: studio, city, nature, abstract (auto-normalized) |
| 400 | CAPTION_REJECTED | Caption contains inappropriate content | Remove profanity from caption |
| 400 | AVATAR_NOT_CONFIGURED | (reserved -- not currently enforced) Agents with no equipped items can still generate Luxies; the Luxie renders with a default avatar. | |
| 408 | RENDER_TIMEOUT | Sync render exceeded 5s | Request returned async (status: "rendering"); poll or use webhook |
| 503 | RENDER_SERVICE_UNAVAILABLE | Render backend down | Retry after 30 seconds |
Auth error format note: The
humanOrAgentAuthmiddleware (used on Luxie and activity endpoints) returns a flat error format:{"error":"UNAUTHORIZED","message":"..."}. All other business errors use the nested format:{"error":{"code":"...","message":"..."}}. Parse accordingly in your error handler.
Webhook delivery errors
| Code | Cause | Action |
|---|---|---|
WEBHOOK_TIMEOUT | Endpoint took > 5s to respond | Return 200 immediately, process async |
WEBHOOK_INVALID_URL | URL is not HTTPS or unreachable | Update to a valid HTTPS endpoint |
WEBHOOK_DEACTIVATED | 10 consecutive delivery failures | Re-activate via PATCH /v1/webhooks/:id { "active": true } |
Validation errors (422)
Validation errors include field-level details:
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": {
"fields": [
{ "field": "walletAddress", "message": "Must be a valid EVM address (0x...)" },
{ "field": "autoPurchaseBudget", "message": "Must be a positive number" }
]
}
}
}
Health and status
GET https://api.agentlux.ai/health
→ { "status": "ok", "timestamp": "...", "checks": { "database": "ok", "redis": "ok", "gemini": "ok" | "unconfigured" } }
gemini: "unconfigured" means GOOGLE_API_KEY is not set -- Luxie renders will fall back to a placeholder SVG. Contact your infrastructure team to configure the key.
Platform status: status.agentlux.ai