Skip to main content

Overview

Use this endpoint to update the name, usage limit, allowed models, expiry, or status of an existing user API key.

Request Body

At least one field must be provided.
FieldTypeDefault / LimitsNotes
statusenum-active, inactive, revoked
namestringlength 1-50Updated display name
limitAmountnumber | nullmin 0, max 100000null = unlimited, 0 = zero quota, positive = USD cap
limitCurrencyenumdefault USDOptional: USD or CNY. When set to CNY, limitAmount is treated as RMB and converted to USD server-side before storage
modelsstring[]-Updated logical model allowlist
expiresAtstring | nullRFC3339 datetimenull clears the expiry

Notes

  • Hard delete is intentionally not supported in Management API v1.
  • revoked is terminal for ordinary operational use; create a new key instead of expecting a future un-revoke flow.
  • The response includes exchange_rate, plus RMB display companions limit_amount_cny and used_amount_cny.
  • By default, limitAmount is interpreted as USD. Set limitCurrency: "CNY" to submit an RMB cap that will be converted to USD using the current exchange rate before storage.

Example

curl -X PATCH "https://api.lemondata.cc/v1/management/api-keys/key_abc123def456" \
  -H "Authorization: Bearer mt-your-management-token" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "inactive",
    "limitAmount": 0
  }'

Request / Response

Use the interactive OpenAPI panel above for the exact schema and response fields.