---
title: "PATCH /v1/me/apikeys/{id}"
method: PATCH
path: "/v1/me/apikeys/{id}"
tags: ["UserAPIKeyService"]
---

# PATCH /v1/me/apikeys/{id}

`PATCH /v1/me/apikeys/{id}`

UpdateAPIKey 单接口聚合更新，仅传需要变更的字段；nil 字段不修改。

## Path parameters

- `id` string, required

## Request body

- ApikeyV1UpdateAPIKeyRequest — UpdateAPIKeyRequest 聚合更新；nil 字段表示不修改。
  - `channelSourceId` string
  - `expiresAt` string, date-time
  - `hasChannelSourceId` boolean — channel_source_id: has_channel_source_id=false 不修改；has_channel_source_id=true && channel_source_id=0 表示解绑。
  - `hasExpiresAt` boolean — expires_at: has_expires_at=false 不修改；has_expires_at=true && expires_at=nil 表示永久。
  - `hasScopes` boolean — scopes 为空切片 = 清空；nil 字段（未传）= 不更新。 这里用 has_scopes 显式区分。
  - `id` string
  - `name` string — 使用 wrapper-style：proto3 默认值无法区分"未传"与"清空"，因此用 optional 标记，需要明确传 nil 才不更新。
  - `scopes` string[]

## Response `200`

OK

- ApikeyV1UpdateAPIKeyReply
  - `apikey` ApikeyV1APIKeyInfo — APIKeyInfo API Key 元数据；plaintext key 仅在 Create/Rotate 时一次性返回。
    - `billingMode` string
    - `channelSourceCode` string
    - `channelSourceId` string
    - `createdAt` string, date-time
    - `creatorId` string
    - `creatorName` string
    - `expiresAt` string, date-time
    - `id` string
    - `keyPrefix` string
    - `lastUsedAt` string, date-time
    - `lastUsedIp` string
    - `name` string
    - `scopes` string[]
    - `status` integer
    - `subscriptionId` string
    - `teamId` string
    - `teamName` string
    - `updatedAt` string, date-time
    - `userId` string

---

[API](https://skmtc.dev/apiqik/apis/apiqik-api.md) · [All operations](https://skmtc.dev/apiqik/apis/apiqik-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/apiqik/apiqik-api/revisions/e06b96127408/schema)
