# Update provider Update provider configuration including enabling/disabling and updating credentials (BYOK - Bring Your Own Key). ## Path parameters **`organization_id`** string required Organization ID (org_ prefixed string). **`provider_name`** string required Provider name (e.g., "openai", "anthropic", "google"). ## Request body **`is_active`** boolean optional Enable or disable the provider. **`api_key`** string optional Provider API key for BYOK (Bring Your Own Key). **`org_id`** string optional Provider organization ID. **`project_id`** string optional Provider project ID. ## Returns Success response with message. ```bash # Enable a provider curl -X PATCH "https://api.aitronos.com/v1/organizations/org_abc123/providers/openai" \ -H "X-API-Key: $FREDDY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "is_active": true }' # Update provider credentials (BYOK) curl -X PATCH "https://api.aitronos.com/v1/organizations/org_abc123/providers/openai" \ -H "X-API-Key: $FREDDY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "api_key": "sk-proj-...", "org_id": "org-xyz", "project_id": "proj-abc" }' ``` ```python import os import requests api_key = os.environ["FREDDY_API_KEY"] org_id = "org_abc123" provider_name = "openai" # Enable provider response = requests.patch( f"https://api.aitronos.com/v1/organizations/{org_id}/providers/{provider_name}", headers={"X-API-Key": api_key}, json={"is_active": True} ) # Update credentials (BYOK) response = requests.patch( f"https://api.aitronos.com/v1/organizations/{org_id}/providers/{provider_name}", headers={"X-API-Key": api_key}, json={ "api_key": "sk-proj-...", "org_id": "org-xyz", "project_id": "proj-abc" } ) print(response.json()) ``` ```javascript const orgId = "org_abc123"; const providerName = "openai"; // Enable provider const response = await fetch( `https://api.aitronos.com/v1/organizations/${orgId}/providers/${providerName}`, { method: "PATCH", headers: { "X-API-Key": process.env.FREDDY_API_KEY, "Content-Type": "application/json" }, body: JSON.stringify({ is_active: true }) } ); // Update credentials (BYOK) const response2 = await fetch( `https://api.aitronos.com/v1/organizations/${orgId}/providers/${providerName}`, { method: "PATCH", headers: { "X-API-Key": process.env.FREDDY_API_KEY, "Content-Type": "application/json" }, body: JSON.stringify({ api_key: "sk-proj-...", org_id: "org-xyz", project_id: "proj-abc" }) } ); console.log(await response.json()); ``` **Response:** 200 OK ```json { "success": true, "message": "Provider openai updated" } ``` 401 Unauthorized ```json { "success": false, "error": { "code": "AUTHENTICATION_REQUIRED", "message": "Authentication required", "system_message": "User authentication required", "type": "client_error", "status": 401, "trace_id": "abc-123-def", "timestamp": "2025-12-07T10:30:00Z" } } ``` 403 Forbidden ```json { "success": false, "error": { "code": "INSUFFICIENT_PERMISSIONS", "message": "You are not authorized to update providers for this organization", "system_message": "Insufficient permissions", "type": "client_error", "status": 403, "details": { "organization_id": "org_abc123" }, "trace_id": "abc-123-def", "timestamp": "2025-12-07T10:30:00Z" } } ``` 422 Validation Error ```json { "success": false, "error": { "code": "VALIDATION_ERROR", "message": "Failed to update provider credentials", "system_message": "Validation error", "type": "client_error", "status": 422, "details": { "provider_name": "openai", "organization_id": "org_abc123" }, "trace_id": "abc-123-def", "timestamp": "2025-12-07T10:30:00Z" } } ```