K
Kifly/Developer Docs
Sign up →
Reference

Error Reference

All Kifly agent endpoints return structured JSON errors:

{
  "error": "error_code",
  "message": "Human-readable explanation",
  "details": {}
}

details contains context specific to the error (e.g., the delivery zones that rejected the address).


HTTP status codes

StatusMeaningWhat to do
400Bad request — missing or invalid fieldFix the request body; do not retry as-is
401Missing or invalid API keyCheck your Authorization: Bearer kfa_live_… header
402Payment requiredFollow the MPP challenge-response flow
403Forbidden — resource belongs to a different tokenDo not retry
409Idempotency conflict — same key, different request bodyUse a new Idempotency-Key
422Validation error — semantically invalidRead details for the specific field
429Rate limit exceededWait for retry-after seconds
503Upstream dependency temporarily unavailableRetry after retry_after_seconds

Error codes

Authentication

CodeDescription
invalid_api_keyThe Bearer token is not recognized
api_key_revokedThe token exists but has been revoked by the seller

Cart

CodeDescription
cart_not_foundNo cart with the given ID under your token
cart_lockedCheckout is already in progress; wait and retry
cart_already_completedThe cart was already purchased; create a new cart
missing_idempotency_keyIdempotency-Key header is required
idempotency_conflictSame key used with a different request body

Checkout / Payment

CodeDescription
shipping_address_requiredCall set_shipping_address before checkout
delivery_not_availableBuyer's address is outside the seller's delivery zones
payment_failedSPT verification or Stripe settlement failed
x402_not_configuredX-Payment sent but x402 is not enabled

Upstream

CodeDescription
upstream_unavailableA required upstream service is temporarily down
checkout_engine_unavailableCommerce engine unreachable; cart state is safe, retry checkout

Retry strategy

For 503 responses, use exponential backoff starting at the retry_after_seconds value in the body:

{
  "error": "upstream_unavailable",
  "retry_after_seconds": 30
}

For 429 responses, wait for the value in the Retry-After header. For all other errors, fix the request before retrying.

Always reuse the same Idempotency-Key when retrying the same logical operation — this guarantees exactly-once semantics even if the network drops after the server commits.


Rate limits

EndpointLimit
/api/mcp120 req / 60 s per token
/api/agent/*60 req / 60 s per token
/api/agent/feedback10 req / 60 s per token

Responses include x-ratelimit-limit, x-ratelimit-remaining, and x-ratelimit-reset headers on every request.