> ## 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 Permission Provider Config

Use this API to update the permission provider configuration for a workspace. At least one of `usePermissionProvider` or `permissionProviderConfig` must be provided. The config is merged with the existing value, so e.g. the `authToken` is preserved when only the URL changes.

<Info>
  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](/api-reference/rest-apis/v2/workspace/authtokens-get) endpoint.
</Info>

<Note>
  **Defaults on first enable.** If you enable the provider (`usePermissionProvider: true`) and no `permissionProviderConfig` exists yet, an empty config is seeded (`permissionProviderUrl` and `authToken` set to empty strings) and returned in the response `data`. Any `permissionProviderConfig` values you send in the same request are merged on top.
</Note>

# Endpoint

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

# Headers

<ParamField header="x-velt-api-key" type="string" required>
  Your API key.
</ParamField>

<ParamField header="x-velt-auth-token" type="string" required>
  Your [Auth Token](/security/auth-tokens).
</ParamField>

# Body

#### Params

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="usePermissionProvider" type="boolean">
      Whether to enable the permission provider.
    </ParamField>

    <ParamField body="permissionProviderConfig" type="object">
      Permission provider configuration object.

      <Expandable title="properties">
        <ParamField body="permissionProviderUrl" type="string">
          Provider URL. Must be an empty string (to clear the value) or a valid `http`/`https` URL. Any other value is rejected.
        </ParamField>

        <ParamField body="authToken" type="string">
          Auth token sent to the permission provider.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

# Example Request

```JSON theme={null}
{
  "data": {
    "usePermissionProvider": true,
    "permissionProviderConfig": {
      "permissionProviderUrl": "https://example.com/permissions",
      "authToken": "provider_auth_token_here"
    }
  }
}
```

# Example Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Permission provider configuration updated successfully."
  }
}
```

#### Failure Response

##### If permissionProviderUrl is not empty and not a valid http(s) URL

```JSON theme={null}
{
  "error": {
    "status": "INVALID_ARGUMENT",
    "message": "Please enter a valid URL"
  }
}
```

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "success",
      "message": "Permission provider configuration updated successfully."
    }
  }
  ```
</ResponseExample>
