# Manage API key status Activate, deactivate, pause, or unpause an API key. #### Activate API Key **Path Parameters:** **`org_id`** string *required* - The organization ID. **`key_id`** string *required* - The API key ID. #### Deactivate API Key **Path Parameters:** **`org_id`** string *required* - The organization ID. **`key_id`** string *required* - The API key ID. #### Pause API Key **Path Parameters:** **`org_id`** string *required* - The organization ID. **`key_id`** string *required* - The API key ID. #### Unpause API Key **Path Parameters:** **`org_id`** string *required* - The organization ID. **`key_id`** string *required* - The API key ID. ## Returns An action response with success status, message, and the updated API key object. Activate API Key ```bash curl "https://api.aitronos.com/v1/organizations/org_123abc/api-keys/ak_123abc456def789/activate" \ -X POST \ -H "X-API-Key: $FREDDY_API_KEY" ``` ```python import os import requests api_key = os.environ["FREDDY_API_KEY"] response = requests.post( "https://api.aitronos.com/v1/organizations/org_123abc/api-keys/ak_123abc456def789/activate", headers={"X-API-Key": api_key} ) ``` ```javascript const apiKey = process.env.FREDDY_API_KEY; const response = await fetch('https://api.aitronos.com/v1/organizations/org_123abc/api-keys/ak_123abc456def789/activate', { method: 'POST', headers: { 'X-API-Key': apiKey } }); ``` Deactivate API Key ```bash curl "https://api.aitronos.com/v1/organizations/org_123abc/api-keys/ak_123abc456def789/deactivate" \ -X POST \ -H "X-API-Key: $FREDDY_API_KEY" ``` ```python api_key = os.environ["FREDDY_API_KEY"] response = requests.post( "https://api.aitronos.com/v1/organizations/org_123abc/api-keys/ak_123abc456def789/deactivate", headers={"X-API-Key": api_key} ) ``` ```javascript const apiKey = process.env.FREDDY_API_KEY; const response = await fetch('https://api.aitronos.com/v1/organizations/org_123abc/api-keys/ak_123abc456def789/deactivate', { method: 'POST', headers: { 'X-API-Key': apiKey } }); ``` Pause API Key ```bash curl "https://api.aitronos.com/v1/organizations/org_123abc/api-keys/ak_123abc456def789/pause" \ -X POST \ -H "X-API-Key: $FREDDY_API_KEY" ``` ```python api_key = os.environ["FREDDY_API_KEY"] response = requests.post( "https://api.aitronos.com/v1/organizations/org_123abc/api-keys/ak_123abc456def789/pause", headers={"X-API-Key": api_key} ) ``` ```javascript const apiKey = process.env.FREDDY_API_KEY; const response = await fetch('https://api.aitronos.com/v1/organizations/org_123abc/api-keys/ak_123abc456def789/pause', { method: 'POST', headers: { 'X-API-Key': apiKey } }); ``` Unpause API Key ```bash curl "https://api.aitronos.com/v1/organizations/org_123abc/api-keys/ak_123abc456def789/unpause" \ -X POST \ -H "X-API-Key: $FREDDY_API_KEY" ``` ```python api_key = os.environ["FREDDY_API_KEY"] response = requests.post( "https://api.aitronos.com/v1/organizations/org_123abc/api-keys/ak_123abc456def789/unpause", headers={"X-API-Key": api_key} ) ``` ```javascript const apiKey = process.env.FREDDY_API_KEY; const response = await fetch('https://api.aitronos.com/v1/organizations/org_123abc/api-keys/ak_123abc456def789/unpause', { method: 'POST', headers: { 'X-API-Key': apiKey } }); ``` **Response:** 200 OK (Activate) ```json { "id": "ak_123abc456def789", "key_prefix": "oak_live_a1b2", "organization_id": "org_123abc", "key_name": "Production API Key", "is_active": true, "usage_limit_chf": 500.0, "scopes": ["read:usage", "write:projects"], "created_by": "usr_456def", "created_at": "2025-11-05T10:00:00Z", "expires_at": "2026-01-01T00:00:00Z" } ``` 200 OK (Deactivate) ```json { "id": "ak_123abc456def789", "key_prefix": "oak_live_a1b2", "organization_id": "org_123abc", "key_name": "Production API Key", "is_active": false, "usage_limit_chf": 500.0, "scopes": ["read:usage", "write:projects"], "created_by": "usr_456def", "created_at": "2025-11-05T10:00:00Z", "expires_at": "2026-01-01T00:00:00Z" } ``` 400 Bad Request ```json { "success": false, "error": { "code": "INVALID_STATE_TRANSITION", "message": "Cannot pause an already inactive API key", "system_message": "API key must be active to be paused", "type": "client_error", "status": 400, "trace_id": "trace_123abc", "timestamp": "2025-11-05T10:00:00Z" } } ``` 404 Not Found ```json { "success": false, "error": { "code": "API_KEY_NOT_FOUND", "message": "API key not found", "system_message": "No API key exists with the provided ID", "type": "client_error", "status": 404, "trace_id": "trace_123abc", "timestamp": "2025-11-05T10:00:00Z" } } ```