API Key Management
Each user account can maintain multiple independent API keys (up to 25 non-revoked keys per user) for separate environments, servers, or automation workflows.
The full secret (plainTextKey) is shown once and only once immediately when the key is created. Neither support staff nor subsequent list/inspect calls can retrieve the plaintext secret again.
Key Properties & Optional Limits
| Field | Type | Rules & Behavior |
|---|---|---|
name | string | Trimmed, whitespace-collapsed label (1–64 characters). Can be renamed anytime while non-revoked. |
monthlySpendCap | string | null | Optional UTC calendar month spend ceiling in USDT (fixed-point string ^\d+(\.\d{1,6})?$ > 0, or null to clear). Sums completed purchases for that apiKeyId since 00:00:00 UTC on day 1 of the month. |
perRequestCap | string | null | Optional single-request spend ceiling in USDT (> 0, or null to clear). Checked atomically before charging. |
expiresAt | ISO-8601 | null | Optional future expiration timestamp. Must be strictly in the future when created or updated; expired keys immediately fail with 401 UNAUTHORIZED. |
status | enum | ACTIVE, DISABLED, or REVOKED. |
Lifecycle Operations
- Create: Provisions a new key (
ACTIVE), returns{ apiKey, plainTextKey }, and logsKEY_CREATED. - List: Returns all keys belonging strictly to your account (
maskedKey:gpk_live_xxxx...wxyz) along withmonthlySpentfor the current UTC month. - Rename / Update Limits: Updates
name,monthlySpendCap,perRequestCap, orexpiresAt, immediately invalidates the auth cache for that key, and logsKEY_RENAMEDorKEY_LIMITS_UPDATED. - Disable / Enable: Temporarily pauses a key (
DISABLED, causing403 FORBIDDEN) without destroying its identity or caps. Re-enabling restoresACTIVE. - Revoke: Permanently terminates a key (
REVOKED, returning401 UNAUTHORIZEDon all future calls) and immediately evicts the auth cache. Revoked keys cannot be modified or re-enabled—subsequent updates or re-enable attempts return409 CONFLICT.
Provisioning Interface Boundary
TODO(verify)— Public Web-Portal Key Management Exposure: In the derived backend source (Gpkeys Digital Bot), customer API key creation, listing, renaming, disabling, enabling, and revoking handlers execute behind internal Telegram bot authentication so customers provision keys through the official bot / account interface. External/api/v1/*keys are intentionally scoped strictly to consuming/api/v1/key, balance, catalog, purchases, actions, orders, ledger, and audit—and cannot mint or revoke sibling keys to prevent privilege escalation if a single runtime key leaks.See
OPEN_QUESTIONS.mdfor whether standalone public reseller-portal management routes will be exposed later.
From an active API key itself, integrators can inspect the key's current caps and usage safely via GET /api/v1/key.