K
KiflyDeveloper 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 coverage that rejected the address, or the maximum allowed value that was exceeded).


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 (Rail 3)
403Forbidden — resource mismatch or insufficient scopeDo not retry; check token scopes
404Resource not foundConfirm IDs are correct and owned by this token
409Idempotency conflict — same key, different request bodyUse a new Idempotency-Key
422Validation error — semantically invalidRead details for the specific field
429Rate limit exceededWait for the value in Retry-After
503Upstream dependency temporarily unavailableRetry after retry_after_seconds

Error codes

Authentication

CodeStatusDescription
invalid_api_key401The Bearer token is not recognized
api_key_revoked401The token exists but has been revoked
missing_idempotency_key400Idempotency-Key header is required on mutating endpoints
idempotency_conflict409Same key used with a different request body
scope_insufficient403Token lacks the required scope (e.g. checkout:write)

Cart

CodeStatusDescription
cart_not_found404No cart with the given ID under your token
cart_locked409Checkout is already in progress; wait and retry
cart_already_completed409The cart was already purchased; create a new cart
item_not_found404No line item with the given ID in this cart
quantity_exceeds_limit400Requested quantity exceeds the platform maximum per line item
seller_mismatch403The variant belongs to a different seller than the cart

Checkout / Payment

CodeStatusDescription
shipping_address_required400Call set_shipping_address before checkout
delivery_not_available400Buyer's address is outside the seller's delivery coverage
cart_total_exceeds_limit400Cart total (subtotal + delivery fee) exceeds the platform cap; details.max_cents has the current ceiling
payment_failed402SPT verification or Stripe settlement failed
x402_not_configured400X-Payment sent but x402 is not activated in this environment

Upstream

CodeStatusDescription
upstream_unavailable503A required upstream service is temporarily unreachable
checkout_engine_unavailable503Commerce engine unreachable; cart state is safe, retry checkout

Retry strategy

For 503 responses, use exponential backoff starting from retry_after_seconds:

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

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

Always reuse the same Idempotency-Key when retrying — 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.