Skip to content

Reveal an API Key

GET /api/open/v1/keys/:id/key

Returns the same Key object as Get an API Key, except that key is the full sk-... value instead of the masked form. Use it when a third-party integration needs to save or rotate a Key without asking the user to copy the value from the console.

ParameterInTypeRequiredDescription
idpathintegerYesKey ID, a positive integer
Terminal window
curl https://www.routeapi.ai/api/open/v1/keys/12/key \
-H "Authorization: Bearer $ROUTEAPI_MANAGEMENT_KEY"
{
"success": true,
"message": "",
"data": {
"id": 12,
"name": "bot",
"key": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"status": 1,
"created_time": 1729000000,
"accessed_time": 1729000000,
"expired_time": -1,
"remain_amount": 10.00,
"unlimited": false,
"used_amount": 0.00,
"model_limits_enabled": false,
"model_limits": "",
"allow_ips": ""
}
}

The response carries Cache-Control: no-store so that neither browsers nor proxies cache the plaintext Key. For field descriptions, see the Key object.

HTTPcodeScenario
400invalid_requestid is not a positive integer
403insufficient_scopeThe Management Key does not have the permission this endpoint requires
404not_foundThe Key does not exist or does not belong to you
429rate_limitedPer-Management-Key rate limit exceeded
429—Per-client-IP rate limit exceeded (default 100 requests/20 minutes for sensitive endpoints); the response body may be empty

For other common error codes, see Platform API errors.

  • Every successful call writes an audit event (open_api.key.reveal) that records the Key ID and name and the Management Key used. Plaintext Keys are never written to audit events or logs.
  • This endpoint is subject to stricter rate limiting than ordinary read endpoints, because it returns secrets.
  • The full Key is also returned once by Create an API Key. Prefer storing it at creation time and calling this endpoint only when the stored value was lost or must be rotated.
  • Get an API Key and List API Keys keep returning the masked value.