---
title: update-a-byok-credential
product: vercel
url: /docs/rest-api/sdk/ai-gateway/update-a-byok-credential
canonical_url: "https://vercel.com/docs/rest-api/sdk/ai-gateway/update-a-byok-credential"
last_updated: 2026-10-30
type: reference
prerequisites:
  []
related:
  - /docs/rest-api
summary: Learn about update-a-byok-credential on Vercel.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# Update a BYOK credential

```http
PATCH /ai-gateway/byok-credentials/{credentialId}
```

Update a BYOK credential. Send `credential` to replace the key value in place, which keeps the credential ID, settings and model mappings.

## Authentication

**bearerToken**: HTTP bearer

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `credentialId` | string | Yes | The unique ID of the credential to update |


## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `ownerId` | string | No |  |
| `teamId` | string | No | The Team identifier to perform the request on behalf of. |
| `slug` | string | No | The Team slug to perform the request on behalf of. |


## Request body

Required: No

Content-Type: `application/json`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "The new name for the credential",
      "maxLength": 100
    },
    "active": {
      "type": "boolean",
      "description": "Whether the credential should be active"
    },
    "zeroDataRetention": {
      "type": "boolean",
      "description": "Whether the customer attested this external credential has a zero data retention policy"
    },
    "userId": {
      "type": "string",
      "description": "The ID of the user performing this action, used for Activity-log attribution."
    }
  }
}
```

## Example request

```typescript
import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.aiGateway.updateAiGatewayByokCredential({
    credentialId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();
```

## Example response

```json
{
  "active": "false",
  "createdAt": "123",
  "credentialId": "example_id",
  "lastFourChars": "string",
  "name": "Example Name",
  "ownerId": "example_id",
  "providerSlug": "example_id",
  "updatedAt": "123",
  "zeroDataRetention": "false"
}
```

## Responses

### 200: No description

Content-Type: `application/json`

```json
{
  "type": "object",
  "required": [
    "active",
    "createdAt",
    "credentialId",
    "lastFourChars",
    "name",
    "ownerId",
    "providerSlug",
    "updatedAt",
    "zeroDataRetention"
  ],
  "properties": {
    "active": {
      "type": "boolean",
      "enum": [
        false,
        true
      ]
    },
    "createdAt": {
      "type": "number"
    },
    "credentialId": {
      "type": "string"
    },
    "lastFourChars": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "ownerId": {
      "type": "string"
    },
    "providerSlug": {
      "type": "string"
    },
    "updatedAt": {
      "type": "number"
    },
    "zeroDataRetention": {
      "type": "boolean",
      "enum": [
        false,
        true
      ]
    }
  }
}
```

### 400: One of the provided values in the request body is invalid.
One of the provided values in the request query is invalid.

### 401: The request is not authorized.

### 403: You do not have permission to access this resource.

### 404: No description

### 410: No description

### 500: No description

---

## Related

- [ai-gateway endpoints](/docs/rest-api#ai-gateway)

- [REST API overview](/docs/rest-api)

- [OpenAPI spec](https://vercel.com/openapi.json) (machine-readable, all endpoints)

---

[View full sitemap](/docs/sitemap)


If you encounter incorrect information, can’t find what you need, need a capability Vercel doesn’t currently offer, or have any other feedback to report, please do it by following the instructions at https://vercel.com/feedback.md.
