Skip to main content
GET
/
api
/
ai
/
key-status
Check API Key Status
curl --request GET \
  --url https://api.example.com/api/ai/key-status
{
  "hasKey": true
}
Returns whether the authenticated user has a Gemini API key stored in their account. This endpoint does not reveal the actual key value.

Authentication

Requires Bearer token authentication.

Response

hasKey
boolean
required
Returns true if the user has a Gemini API key configured, false otherwise

Example Request

curl -X GET https://api.example.com/api/ai/key-status \
  -H "Authorization: Bearer YOUR_TOKEN_HERE"

Example Response

{
  "hasKey": true
}

Error Responses

401 Unauthorized
Authentication token is missing or invalid
{
  "error": "Unauthorized",
  "message": "Invalid or missing authentication token"
}
404 Not Found
The user account was not found
{
  "error": "Not Found",
  "message": "User not found"
}

Notes

  • This endpoint is useful for frontend applications to determine whether to show the API key configuration UI
  • The actual API key value is never returned by any endpoint for security reasons
  • Keys are stored encrypted in the database using AES-256 encryption

Build docs developers (and LLMs) love