Skip to content

Authentication

RouteAPI uses Bearer Token authentication. Every API request must include a valid Token in the Authorization request header.

Authorization: Bearer sk-your-routeapi-token

Example:

Terminal window
curl https://www.routeapi.ai/v1/models \
-H "Authorization: Bearer $ROUTEAPI_KEY"
  1. Log in to the RouteAPI console.
  2. Open the API Keys page.
  3. Create a new token.
  4. Set the name, quota, access permissions, and expiration time as needed.
  5. Save the token and use it only on the server side or in a secure environment.

A Token is usually affected by the following configuration:

ConfigurationEffect
User balanceRequests may return 402 when balance is insufficient
Token quotaA single Token can have an independent quota or expiration time
Rate limitReturns 429 after being triggered
  • Do not expose Tokens in frontend code, public repositories, or plaintext mobile configuration.
  • Prefer environment variables when calling from server-side code.
  • Disable or delete leaked Tokens immediately and generate new ones.
  • Create different Tokens for different applications to simplify auditing and limits.
  • Set low quotas and expiration times for temporary test Tokens.
Status codeCommon causeHandling
401Missing Token, typo, or deleted TokenCheck the Authorization header
402Insufficient balance or quota exhaustedRecharge, raise quota, or use another Token
429Rate limit triggeredReduce concurrency and check user or Token rate limits