Skip to content

Errors

The API fails closed and predictable: auth and credit checks run before any workflow executes, and you are never billed for a failed call.

HTTP status codes (REST)

StatusMeaningWhat to do
401Missing, revoked or invalid X-Api-TokenCopy the active key from the Studio APIs tab
403Key's organization has no World Cup entitlementClaim a tier at machina.gg/world-cup-api
402Insufficient credits for this endpoint's costTop up under the APIs tab — the call was not executed
404Endpoint's workflow not availableTransient during maintenance; retry later
429Rate limitedHonor Retry-After (seconds) and retry
502The underlying workflow reported a failureSafe to retry once — not billed

Error body shape:

json
{
  "data": {},
  "error": { "code": 402, "message": "Insufficient credits for this endpoint" },
  "meta": { "code": 402 },
  "status": "error"
}

Typed errors (MCP)

MCP tools return a structured error object designed for agents to act on without parsing prose:

json
{
  "status": "error",
  "error": {
    "type": "insufficient_credits",
    "http_status": 402,
    "hint": "The organization is out of prepaid credits — top up in Studio under the APIs tab.",
    "detail": { "...": "raw gateway response" }
  }
}
error.typeHTTPNotes
invalid_api_key401key missing/revoked/wrong
not_entitled403org doesn't hold the product
insufficient_credits402top up, then retry
not_available404endpoint workflow offline
rate_limited429includes retry_after_seconds
upstream_error5xxsafe to retry once

Billing guarantees

  • 402 happens before execution — a blocked call never runs and never charges.
  • 5xx never bills — the debit is written only after a genuinely successful execution.
  • health is free precisely so you (or your agent) can verify a key without spending.