AI
Update an AI provider
Change one of a workspace's AI providers: its name, its config (replaced whole when given) or its key (a new one replaces the old, write-only).
PATCH
/workspaces/{workspace}/ai/providers/{id}Use it to rotate a key. Fields left out are kept. Keys are never returned. Owners only.
The key is write-only. Use it to rotate a key: the new one replaces the old at once.
- Authentication: Required. Send an access token as
Authorization: Bearer. - MCP tool:
aiwithactionupdate_provider, and the same inputs - Scope: An access token needs
workspace:admin.
Path parameters
Section titled “Path parameters”| Name | Type | Required | Description |
|---|---|---|---|
workspace |
string | Yes | The workspace’s slug, e.g. “flagon-io”. |
id |
string | Yes | The AI provider’s id. |
Body parameters
Section titled “Body parameters”Send a JSON object. Names are snake_case, as in responses; the camelCase spelling is accepted too.
| Name | Type | Required | Description |
|---|---|---|---|
name |
string | No | A new name. |
config |
object | No | Its settings, replaced whole. |
config.base_url |
string | No | The address of a self-hosted endpoint or an Azure OpenAI resource, over https. An Anthropic-compatible one without /v1; an OpenAI-compatible one up to and including the version. |
config.auth_header |
string | No | For an endpoint: send the key as x-api-key, or as authorization: Bearer. One of x-api-key, authorization. |
config.model |
string | No | The model the team uses on it; for Azure OpenAI, the deployment. |
config.console_workspace |
string | No | For anthropic: the Console workspace the key belongs to (wrkspc_…), or any Console address in it, so links to the sessions it starts open there. Without it, the account’s Default workspace. |
secret |
string | No | A new API key, replacing the old one. Write-only: sealed, never returned. |
Example request
Section titled “Example request”curl -X PATCH https://api.g1t.sh/workspaces/flagon-io/ai/providers/ai_01kpx4n8r3g9s0v5w7x1z2a3be \ -H "Authorization: Bearer $G1T_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Anthropic (team)", "secret": "sk-ant-…" }'Example response
Section titled “Example response”A successful request answers 200 with:
{ "id": "ai_01kpx4n8r3g9s0v5w7x1z2a3be", "workspace": "flagon-io", "provider": "anthropic", "group": "labs", "name": "Anthropic (team)", "config": {}, "secret_hint": "…w8Rt", "created_by": "syntaqx", "created_at": "2026-10-04T15:42:07.318Z", "last_used_at": "2026-10-14T09:12:44.051Z", "last_error": null, "models": [ "claude-haiku-4-5", "claude-sonnet-4-5", "claude-opus-4-1" ]}Errors
Section titled “Errors”A failed request answers with one of these statuses and a body like {"error": {"code": "not_found", "message": "Repository not found."}}. See errors.
| Status | Code | When |
|---|---|---|
| 401 | unauthenticated |
A token is required, or the one sent is not valid. |
| 403 | forbidden |
The token is valid but not allowed to do this, such as a member-only change, or a token without the scope it needs. |
| 404 | not_found |
It does not exist, or you cannot see it. |
| 409 | conflict |
The request conflicts with the current state. |
| 422 | invalid |
The input is not valid. message says which field and why. |