BazaarLinkBazaarLink
Đăng nhập
Tài liệuTham chiếu APITham chiếu SDKSử dụng AgentKỹ năng AI
Management Key

Cập nhật BYOK key

Cập nhật một BYOK key: bật/tắt, đổi tên, đổi chế độ dự phòng, bật/tắt từng model (modelToggles), đặt lại phạm vi áp dụng (scopedApiKeyIds). Mọi trường đều tùy chọn; không thể thay chính upstream key — muốn xoay khóa hãy xóa rồi tạo lại.

PATCH/api/v1/management/byok-keys/:id

Xác thực

Authorizationbắt buộc
string · header

API key dưới dạng bearer token trong header Authorization.

Tham số đường dẫn

idbắt buộc
string

Id của BYOK key.

Body

enabled
boolean

Công tắc tổng của cả khóa.

fallbackMode
string

Có quay về định tuyến nền tảng khi upstream lỗi hay không.

seamlessstrict
name
string

Tên hiển thị mới.

1-200 chars
modelToggles
{canonicalId, enabled}[]

Công tắc từng model: mỗi phần tử gồm canonicalId và enabled. Chỉ các model được liệt kê thay đổi; còn lại giữ nguyên.

≤2000 items
scopedApiKeyIds
string[]

Thay toàn bộ danh sách phạm vi: mảng rỗng = áp dụng toàn tổ chức. Chứa id không thuộc về bạn trả 400.

≤200 items; must be your own keys
PATCH /api/v1/management/byok-keys/:id
curl -X PATCH https://bazaarlink.ai/api/v1/management/byok-keys/byok_abc123 \
  -H "Authorization: Bearer $BAZAARLINK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"fallbackMode": "strict", "modelToggles": [{"canonicalId": "openai/gpt-4o", "enabled": false}]}'
Ví dụ phản hồi

Cập nhật thành công — trả về { key } đã cập nhật.

{
  "key": {
    "id": "byok_abc123",
    "ownerType": "org",
    "userId": null,
    "organizationId": "org_abc123",
    "name": "team-upstream",
    "baseUrl": "https://api.example-upstream.com/v1",
    "keyMask": "sk-abc…wxyz",
    "protocol": "openai",
    "enabled": true,
    "fallbackMode": "strict",
    "modelsStale": false,
    "lastVerifiedAt": "2026-07-29T00:00:00.000Z",
    "lastErrorAt": null,
    "lastErrorCode": null,
    "errorCount1h": 0,
    "createdAt": "2026-07-29T00:00:00.000Z",
    "updatedAt": "2026-07-29T00:00:00.000Z",
    "models": [
      {
        "canonicalId": "openai/gpt-4o",
        "upstreamModelId": "gpt-4o",
        "enabled": true
      }
    ],
    "scopedApiKeyIds": []
  }
}
Support
Support
Hi! How can we help you?
Send a message and we'll get back to you soon.
Cập nhật BYOK key — BazaarLink API