Skip to main content

Overview

Creates a new type=user API key in the organization associated with the current management token.

Request Body

FieldTypeDefault / LimitsNotes
namestringrequired, default Default Key, length 1-50Display name, trimmed server-side
limitAmountnumber | nullmin 0, max 100000null or omitted = unlimited, 0 = zero quota, positive = USD spending cap
limitCurrencyenumdefault USDOptional: USD or CNY. When set to CNY, limitAmount is treated as RMB and converted to USD server-side before storage
modelsstring[]default []Optional logical model allowlist
expiresAtstring | nullRFC3339 datetimenull means no expiry

Notes

  • The full API key value is shown only once in the response.
  • models: [] means the key has no additional model restriction beyond organization policy.
  • limitAmount: 0 creates a key that is valid but cannot spend quota until updated.
  • 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 POST "https://api.lemondata.cc/v1/management/api-keys" \
  -H "Authorization: Bearer mt-your-management-token" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Backend Worker",
    "limitAmount": 500,
    "models": ["veo3.1", "sora-2"],
    "expiresAt": "2026-12-31T23:59:59Z"
  }'

Request / Response

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