---
title: "Update a BYOK credential"
method: PATCH
path: "/ai-gateway/byok-credentials/{credentialId}"
tags: ["ai-gateway"]
---

# Update a BYOK credential

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

## Request

- Base URL: `https://api.vercel.com`
- URL: `https://api.vercel.com/ai-gateway/byok-credentials/{credentialId}`
- Auth: HTTP bearer

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

## Path parameters

- `credentialId` string, required: The unique ID of the credential to update

## Query parameters

- `ownerId` string
- `teamId` string
- `slug` string

## Request body

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

## Response `200`

- object
  - `active` false | true, required
  - `createdAt` number, required
  - `credentialId` string, required
  - `lastFourChars` string, required
  - `name` string, required
  - `ownerId` string, required
  - `providerSlug` string, required
  - `rotatedAt` number, nullable, required
  - `updatedAt` number, required
  - `zeroDataRetention` false | true, required

## Other responses

- `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`
- `410`
- `500`

## Changes

- **2026-10-29** `4966aebe003c`: 1 info
  - added the required property `rotatedAt` to the response with the `200` status
- **2026-10-27** `ef8042371d97`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/vercel/apis/vercel-api/changes/ai-gateway/byok-credentials/:credentialId/patch.md)

---

[API](https://skmtc.dev/vercel/apis/vercel-api.md) - [All operations](https://skmtc.dev/vercel/apis/vercel-api/llms.txt) - [OpenAPI document](https://skmtc.dev/vercel/apis/vercel-api/revisions/60686c0e1f6a?raw)
