Skip to main content

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.

Single-Reveal Security Policy

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​

FieldTypeRules & Behavior
namestringTrimmed, whitespace-collapsed label (1–64 characters). Can be renamed anytime while non-revoked.
monthlySpendCapstring | nullOptional 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.
perRequestCapstring | nullOptional single-request spend ceiling in USDT (> 0, or null to clear). Checked atomically before charging.
expiresAtISO-8601 | nullOptional future expiration timestamp. Must be strictly in the future when created or updated; expired keys immediately fail with 401 UNAUTHORIZED.
statusenumACTIVE, DISABLED, or REVOKED.

Lifecycle Operations​

  1. Create: Provisions a new key (ACTIVE), returns { apiKey, plainTextKey }, and logs KEY_CREATED.
  2. List: Returns all keys belonging strictly to your account (maskedKey: gpk_live_xxxx...wxyz) along with monthlySpent for the current UTC month.
  3. Rename / Update Limits: Updates name, monthlySpendCap, perRequestCap, or expiresAt, immediately invalidates the auth cache for that key, and logs KEY_RENAMED or KEY_LIMITS_UPDATED.
  4. Disable / Enable: Temporarily pauses a key (DISABLED, causing 403 FORBIDDEN) without destroying its identity or caps. Re-enabling restores ACTIVE.
  5. Revoke: Permanently terminates a key (REVOKED, returning 401 UNAUTHORIZED on all future calls) and immediately evicts the auth cache. Revoked keys cannot be modified or re-enabled—subsequent updates or re-enable attempts return 409 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.md for 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.