API Reference
Dashboard
  1. API Reference
  2. Box API
  3. API keys

Replace the secret of an API key

Use this when a key was lost or may have leaked. The key keeps its id, name, type and expiry but gets a new secret; the old secret stops working at once, so every bot or link that uses it must be updated. The new full key is returned once in data.key. An expired key cannot be regenerated; delete it and create a new one. Available from XProxy v21.3.61.

  • Action · reversible
  • Basic auth
  • Panel API · since v21.3.61
  • Hub: blocked by the Hub
  • regenerateApiKey
POST/v2/api_keys/regenerate

Request body application/json · required

idintegerrequired

Key number from GET /v2/api_keys.

Authentication

Needs the admin login (HTTP Basic, or the panel session). An API key cannot manage API keys: any key sent here, even a valid Full access key, is refused with HTTP 401 invalid_token, also from the LAN. A browser request whose Origin is not the panel's own address is refused with HTTP 403 cross_origin; requests without an Origin header (curl, scripts) are not affected.

How authentication works: login, API keys, LAN and 401 answers →

Responses

The new key, or the reason it was refused. Sent with Cache-Control: no-store.

Errors returned in msg

msgMeaningWhat to do
not_foundNo key has this id, or id is not a whole number (code field, HTTP 200).Take the id from GET /v2/api_keys.
expiredThe key has expired (code field).Delete it and create a new key.
invalid_tokenAn API key was sent. Keys cannot manage keys (HTTP 401).Call this with the admin login and no key.
cross_originThe request came from a browser page on another origin (HTTP 403, in the code field).Open the panel itself
Verified against XProxy v21.3.61 on Dec 4, 2026