Unauthorized
URI: https://docs.ankatech.co/errors/unauthorized
HTTP Status: 401 Unauthorized
When you see this
The request lacks valid authentication credentials or the provided credentials could not be verified. You must authenticate before accessing this resource.
Common Causes
-
Missing authentication headers
NoAuthorizationheader or API key was provided in the request. -
Invalid credentials
The provided API key, JWT token, or other credentials are incorrect or malformed. -
Expired token
Your JWT access token has expired and needs to be refreshed. -
Revoked credentials
The API key or token has been revoked due to security reasons or administrative action. -
Wrong authentication method
Using an incorrect authentication scheme (e.g., Basic auth when Bearer token is required).
How to Resolve
- Verify authentication headers
- Ensure the
Authorizationheader is included in your request. -
Check the format:
Authorization: Bearer <token>orX-API-Key: <key>. -
Validate credentials
- Confirm your API key or token is correctly copied without extra spaces.
-
Verify credentials haven't been accidentally truncated or modified.
-
Refresh expired tokens
- Use the refresh token endpoint to obtain a new access token.
-
Implement automatic token refresh in your application.
-
Request new credentials
- If credentials are revoked, contact your administrator for new ones.
-
Generate new API keys through the admin console if you have access.
-
Check authentication method
- Review the API documentation for the correct authentication scheme.
- Ensure you're using the appropriate credential type for the endpoint.
Response Example
{
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication required",
"detail": "Invalid or missing authentication credentials",
"timestamp": "2025-01-15T10:30:00Z",
"traceId": "550e8400-e29b-41d4-a716-446655440000",
"type": "https://docs.ankatech.co/errors/unauthorized"
}
}
Authentication Methods
AnkaSecure API supports the following authentication methods:
- JWT Bearer Token: For user and service authentication
- API Key: For programmatic access via
X-API-Keyheader - mTLS: For certificate-based authentication (specific endpoints)
If you continue to receive a 401 error after these steps, please verify your account status and consult the full API Reference.