> ## Documentation Index
> Fetch the complete documentation index at: https://velt.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update API Key Config

Use this API to update the app configuration for a workspace API key. Every field is optional, but **at least one** must be provided. Unknown fields are rejected. All writes are field-merge only — no fields are removed.

> [!NOTE]
>
> This endpoint uses **API-key-level auth**: pass `x-velt-api-key` and `x-velt-auth-token` as headers. You can obtain these from the [Get Auth Tokens](https://velt.dev/docs/api-reference/rest-apis/v2/workspace/authtokens-get.md) endpoint.

# Endpoint

`POST https://api.velt.dev/v2/workspace/apikeyconfig/update`

# Headers

**x-velt-api-key** `string` *required*

Your API key.

**x-velt-auth-token** `string` *required*

Your [Auth Token](https://velt.dev/docs/security/auth-tokens.md).

# Body

#### Params

**data** `object` *required*

At least one of the following fields must be provided.

**properties**

**enablePrivateComments** `boolean`

Enable (`true`) or disable (`false`) private comments for this API key.

**requireJwtToken** `boolean`

When `true`, the SDK requires a signed JWT to authenticate.

**requireAutoOrgUser** `boolean`

When `true`, users are auto-added to the organization on first access.

**defaultDocumentAccessType** `string`

Workspace-default document access type. One of `public`, `restricted`, or `organizationPrivate`.

**aiModelApiKey** `object[]`

Array of AI model provider keys — pass multiple entries to update several providers in one call. Each raw key is encrypted at rest and is never returned in any response. Must contain at least one entry.

**entry properties**

**provider** `string` *required*

AI provider. One of `openai`, `anthropic`, or `gemini`.

**customerApiKey** `string` *required*

The provider API key to store (encrypted).

# Example Request

```JSON theme={null}
{
  "data": {
    "requireJwtToken": true,
    "defaultDocumentAccessType": "restricted",
    "aiModelApiKey": [
      { "provider": "openai", "customerApiKey": "sk-openai-..." },
      { "provider": "anthropic", "customerApiKey": "sk-ant-..." },
      { "provider": "gemini", "customerApiKey": "AIza..." }
    ]
  }
}
```

# Example Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "API key configuration updated successfully.",
    "data": {
      "requireJwtToken": true,
      "defaultDocumentAccessType": "restricted",
      "aiModelsConfig": {
        "openai": { "displayText": "sk-open...xxxxxxxxxxxxxxxxxxxxxxx" },
        "anthropic": { "displayText": "sk-ant-...xxxxxxxxxxxxxxxxxxxxx" },
        "gemini": { "displayText": "AIza...xxxxxxxxxxxxxxxxxxxxxxxxx" }
      }
    }
  }
}
```

> [!NOTE]
>
> The response echoes the post-write values for the fields you provided. For `aiModelApiKey`, the keys come back masked under `aiModelsConfig` as a map of `provider -> { displayText }` (the same shape as [Get API Key Config](https://velt.dev/docs/api-reference/rest-apis/v2/workspace/apikeyconfig-get.md)) — the raw key value is never returned. When `enablePrivateComments` is the only field and its value already matches the current value, the write is skipped internally and the response is simply `{ "enablePrivateComments": <value> }`.

#### Failure Response

##### If no field is provided, or an unknown field is sent

```JSON theme={null}
{
  "error": {
    "status": "INVALID_ARGUMENT",
    "message": "At least one field must be provided for update"
  }
}
```

```js theme={null}
{
  "result": {
    "status": "success",
    "message": "API key configuration updated successfully.",
    "data": {
      "requireJwtToken": true,
      "defaultDocumentAccessType": "restricted",
      "aiModelsConfig": {
        "openai": { "displayText": "sk-open...xxxxxxxxxxxxxxxxxxxxxxx" },
        "anthropic": { "displayText": "sk-ant-...xxxxxxxxxxxxxxxxxxxxx" },
        "gemini": { "displayText": "AIza...xxxxxxxxxxxxxxxxxxxxxxxxx" }
      }
    }
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.