Upsert an AI credential
Creates or replaces the API key for the specified AI provider. If a credential for the same provider already exists, it is overwritten. The stored key is encrypted at rest and is never returned by any GET endpoint. **Required scope:** `ai:write`
Authorization
BearerAuth Security scheme for OpenAPI endpoints. Validates both JWT tokens and API keys.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Request body for creating or updating an AI credential.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X PUT "https://example.com/v1/ai/credentials" \ -H "Content-Type: application/json" \ -d '{ "provider": "openai", "api_key": "sk-proj-abc123...", "base_url": null }'{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "provider": "claude", "base_url": "string", "created_at": "string", "updated_at": "string"}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}List AI credentials
Returns all AI provider credentials registered by the authenticated user. The API key itself is never returned — only the provider name, optional base URL, and timestamps. Use this to check which providers are configured before calling Magic Dust analysis. **Required scope:** `ai:read`
Delete an AI credential
Permanently removes the stored API key for the given provider. Any subsequent Magic Dust requests that require this provider will fail until a new credential is stored. **Required scope:** `ai:write`