AI Models

Set or update API key for a provider

POST
/api/ai-models/organization/{organizationId}/api-key

Stores or replaces the API key for a single provider (anthropic, openai, google) on the organization's credentials. SUPERADMIN-only and tenant-scoped - callers cannot set keys for organizations they do not belong to. For backward compatibility, the legacy anthropicApiKey field is mirrored when provider=anthropic.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

organizationId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/ai-models/organization/string/api-key" \  -H "Content-Type: application/json" \  -d '{    "provider": "anthropic",    "apiKey": "sk-ant-api03-AbCdEf1234567890XyZ",    "isEnabled": true  }'
{  "success": true,  "message": "API key for anthropic updated successfully",  "data": {    "provider": "anthropic",    "isEnabled": true,    "hasApiKey": true  }}