> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aihubmix.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update KEY

> Update the name, expiration time, quota, model/IP restrictions, and status of an existing KEY.

## Request Parameters

### Request Headers

<ResponseField type="string" required>
  Authentication for the request. This API uses the AIHubMix Manage Key for authentication.
</ResponseField>

<ResponseField type="string">
  The content type of the request. This parameter must be set to application/json.
</ResponseField>

### Path Parameters

<ParamField body="id" type="integer" required>
  KEY ID.
</ParamField>

### Request Body

<ParamField body="name" type="string">
  The name of the new Key.
</ParamField>

<ParamField body="expired_time" type="integer">
  Expiration time (UNIX timestamp), -1 means never expires.
</ParamField>

<ParamField body="unlimited_quota" type="boolean">
  Whether the quota is unlimited. true means unlimited; false means a quota is enabled (requires remain\_quota).
</ParamField>

<ParamField body="remain_quota" type="integer">
  Remaining quota. remain\_quota should be: desired quota \* 500000 (for example, if the desired quota is 10, then pass 5000000). When unlimited\_quota is true, it is recommended to pass -1.
</ParamField>

<ParamField body="status" type="integer">
  Key status. 0 means disabled, 1 means enabled.
</ParamField>

<ParamField body="models" type="text">
  Restrictions on the models that the current Key can use (empty or not provided means no restrictions).
</ParamField>

<ParamField body="subnet" type="text">
  IP restrictions (empty or not provided means no restrictions).
</ParamField>

## Response Parameters

<ResponseField name="success" type="boolean">
  Indicates whether the request was successful.
</ResponseField>

<ResponseField name="message" type="string">
  Detailed information on request failure. May be empty or not returned when the request is successful.
</ResponseField>

<ResponseField name="data" type="object">
  The updated Key object.

  <ResponseField name="id" type="integer" />

  <ResponseField name="user_id" type="integer" />

  <ResponseField name="status" type="integer" />

  <ResponseField name="name" type="string" />

  <ResponseField name="created_time" type="integer" />

  <ResponseField name="accessed_time" type="integer" />

  <ResponseField name="expired_time" type="integer" />

  <ResponseField name="remain_quota" type="integer" />

  <ResponseField name="unlimited_quota" type="boolean" />

  <ResponseField name="used_quota" type="integer" />

  <ResponseField name="models" type="text" />

  <ResponseField name="subnet" type="text" />
</ResponseField>

***

Last updated: 2026-06-01
