Skip to content
Get API key

The metadata of one past request, by its request id (the x-request-id header of that response). Metadata only: prompts and responses are never returned, and there is no endpoint that returns them.

Only requests from the calling key's workspace can be read. Any other id, and an unknown id, return the same 404.

The record is written after the response is sent, so a lookup straight after a request can return 404 for a short while. Retry.

Amounts are credits.

GEThttps://api.router.africa/v1/generation

Authorizations

Authorizationbearer (API key (sk-ra-...))headerrequired

Send your key as Authorization: Bearer YOUR_KEY. Never put a key in the URL or the body: the request is refused with key_not_in_header.

Query parameters

idstringrequired

The request id to look up.

Response

200

The request's metadata.

Response headers: x-request-id. Include x-request-id when you contact support.

dataobjectrequired
11 child fields
idstringrequired

The request id.

created_atstringrequired

Format: date-time

endpointstringrequired

The path that was called, for example /v1/chat/completions.

modelstringrequired
status_codeintegerrequired

The HTTP status the request returned.

error_codestring | nullrequired

The error reason, or null when the request succeeded.

latency_msintegerrequired
streamedbooleanrequired
input_tokensintegerrequired
output_tokensintegerrequired
coststringrequired

The charge, in credits.

Example: 1250.00000000

Pattern: ^[0-9]+\.[0-9]{8}$

Errors

Errors share one body shape. Branch on error.metadata.error_type for retry logic and on error.metadata.reason for what to show your user. The full table is in Errors.

400invalid_body, key_not_in_header, context_length_exceeded

The request is malformed or fails validation.

{
  "error": {
    "code": 400,
    "message": "Request body is invalid: `messages` is required.",
    "metadata": {
      "error_type": "invalid_request",
      "reason": "invalid_body"
    }
  }
}
{
  "error": {
    "code": 400,
    "message": "Send your API key in the Authorization header, not the URL or body.",
    "metadata": {
      "error_type": "invalid_request",
      "reason": "key_not_in_header"
    }
  }
}
{
  "error": {
    "code": 400,
    "message": "The request is too long for `openai/gpt-4.1-mini`'s context window. Shorten the input and retry.",
    "metadata": {
      "error_type": "context_length_exceeded",
      "reason": "context_length_exceeded"
    }
  }
}

401missing_api_key, invalid_api_key

The API key is missing or not valid. One answer for unknown, malformed, revoked, expired and pending keys.

{
  "error": {
    "code": 401,
    "message": "You didn't provide an API key. Send it as `Authorization: Bearer YOUR_KEY`.",
    "metadata": {
      "error_type": "authentication",
      "reason": "missing_api_key"
    }
  }
}
{
  "error": {
    "code": 401,
    "message": "Incorrect API key provided: sk-ra-…abcd. Check your keys at https://app.router.africa.",
    "metadata": {
      "error_type": "authentication",
      "reason": "invalid_api_key"
    }
  }
}

403account_suspended, content_policy_violation

The account is suspended, or the provider refused the content.

{
  "error": {
    "code": 403,
    "message": "This account is suspended. Contact support.",
    "metadata": {
      "error_type": "permission_denied",
      "reason": "account_suspended"
    }
  }
}
{
  "error": {
    "code": 403,
    "message": "The request was blocked by the model provider's content policy.",
    "metadata": {
      "error_type": "content_policy_violation",
      "reason": "content_policy_violation"
    }
  }
}

404model_not_found, route_not_found

The model is unknown, off or not allowed for this key (one answer for all three), or the path does not exist.

{
  "error": {
    "code": 404,
    "message": "The model `acme/unknown-model` does not exist or you do not have access to it.",
    "metadata": {
      "error_type": "not_found",
      "reason": "model_not_found",
      "model": "acme/unknown-model"
    }
  }
}
{
  "error": {
    "code": 404,
    "message": "No such endpoint. Check the URL and method.",
    "metadata": {
      "error_type": "not_found",
      "reason": "route_not_found"
    }
  }
}

429rate_limited, concurrency_limited, edge_rate_limited

Rate limit reached. Back off and honour Retry-After. No x-ratelimit-* headers are sent.

{
  "error": {
    "code": 429,
    "message": "Rate limit reached for this API key. Retry after 20 seconds.",
    "metadata": {
      "error_type": "rate_limit_exceeded",
      "reason": "rate_limited"
    }
  }
}
{
  "error": {
    "code": 429,
    "message": "Too many requests are running at once for this account. Wait for some to finish, then retry.",
    "metadata": {
      "error_type": "rate_limit_exceeded",
      "reason": "concurrency_limited"
    }
  }
}
{
  "error": {
    "code": 429,
    "message": "Too many requests from this address. Retry after 60 seconds.",
    "metadata": {
      "error_type": "rate_limit_exceeded",
      "reason": "edge_rate_limited"
    }
  }
}

500internal_error

A fault on our side. Retry once, then contact support with the request id.

{
  "error": {
    "code": 500,
    "message": "Something went wrong on our side. Reference: 0192f0e0-7b1a-7c3e-9d4f-5a6b7c8d9e0f.",
    "metadata": {
      "error_type": "server",
      "reason": "internal_error"
    }
  }
}

503service_unavailable

Temporarily unavailable; refused before any model was called.

{
  "error": {
    "code": 503,
    "message": "The service is temporarily unavailable.",
    "metadata": {
      "error_type": "server",
      "reason": "service_unavailable"
    }
  }
}