Api
Verify API key
Check that your API key is valid and active.
Overview
Use this endpoint to verify that your API key is valid and active. It returns key metadata without consuming a chat completion request.
Endpoint
POST
/v1/verify-keyAuthentication
This endpoint requires a Bearer token in the Authorization header:
Authorization: Bearer sk_unii_your_api_key_hereRequest examples
curl -X POST https://api.unii.dev/v1/verify-key \-H "Authorization: Bearer $UNII_API_KEY"Response
200 OK
A valid API key returns a JSON object with key metadata:
{"valid": true,"keyPrefix": "sk_unii_...","createdAt": "2025-01-15T10:30:00Z"}Errors
| Status code | Meaning |
|---|---|
| 401 | The API key is missing, invalid, or expired |
| 403 | The API key is valid but has been revoked |
{"error": { "message": "Invalid API key.", "type": "authentication_error", "code": 401}}Tip
Call this endpoint during application startup to fail fast if the API key is invalid, rather than waiting for the first chat completion to fail.
Next steps
- Read the Authentication guide for key management best practices.
- Try the Chat completions endpoint to generate responses.
- See the API Overview for a full list of endpoints.