Docs
Authentication API
Authentication API
The Authentication API handles API key validation and management. API keys are generated through the Tatry UI, and can be managed through these endpoints.
Available Endpoints
Method | Endpoint | Description |
---|---|---|
GET | /v1/auth/validate | Validate an API key and get its permissions |
GET | /v1/auth/keys | List all API keys for your organization |
Validate API Key
Validates an API key and returns its associated permissions.
curl -H "Authorization: Bearer YOUR_API_KEY" \
-X GET https://api.tatry.dev/v1/auth/validate
from tatry import TatryRetriever
# Initialize the client with your API key
client = TatryRetriever(api_key="your-api-key")
# Validate your API key
is_valid = client.validate_api_key()
Request
GET /v1/validate
Headers:
Authorization: Bearer your-api-key
Content-Type: application/json
Response
{
"status": "success",
"data": {
"valid": true,
}
}
List API Keys
Lists all API keys for your organization.
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.tatry.dev/v1/auth/keys
from tatry import TatryRetriever
# Initialize the client with your API key
client = TatryRetriever(api_key="your-api-key")
# List all API keys with query parameters
keys = client.list_api_keys(
status="active", # Filter by key status
limit=10, # Maximum number of keys to return
offset=0 # Pagination offset
)
Query Parameters
Parameter | Type | Description |
---|---|---|
status | string | Filter by key status (active/expired) |
limit | integer | Maximum number of keys to return |
offset | integer | Pagination offset |
Response
{
"status": "success",
"data": {
"keys": [
{
"id": "key_123",
"name": "Production API Key",
"status": "active",
"created_at": "2024-01-01T00:00:00Z",
"last_used_at": "2024-02-12T00:00:00Z"
}
],
"total": 1
}
}
Error Responses
auth_invalid_key (401)
Invalid API key provided.
{
"status": "error",
"error": {
"code": "auth_invalid_key",
"message": "Invalid API key provided",
"details": {
"key_status": "invalid"
}
}
}
auth_expired_key (401)
API key has expired.
{
"status": "error",
"error": {
"code": "auth_expired_key",
"message": "API key has expired",
"details": {
"expired_at": "2024-01-01T00:00:00Z"
}
}
}
auth_permission_denied (403)
Insufficient permissions for the requested operation.
{
"status": "error",
"error": {
"code": "auth_permission_denied",
"message": "Insufficient permissions",
"details": {
"required_permissions": ["write"],
"current_permissions": ["read"]
}
}
}