Tronergydocs

API keys

List, create and revoke API keys.

A key acts as the user who owns it, with that user's permissions. You only see and manage your own user's keys. Up to 25 usable keys; expired and revoked keys do not count. See Authentication.

Keys look like omk_1a2b3c4d.<secret>. The part before the dot is the public keyPrefix. Only a hash is stored, so a lost secret cannot be recovered.

List keys

Returns your keys. The secret is never listed.

GET/api/customer_api_keys/portal/keys
curl "https://apiv2.tronergy.io/api/customer_api_keys/portal/keys?page=1&pageSize=20" \
  -H "x-api-key: $TRONERGY_API_KEY"
Parameters
pagenumberquery

Page number. Defaults to 1.

pageSizenumberquery

Items per page. Default 20, max 100.

Response
{
  "ok": true,
  "items": [
    {
      "id": "c7a2...",
      "name": "Production backend",
      "keyPrefix": "omk_1a2b3c4d",
      "description": null,
      "expiresAt": null,
      "lastUsedAt": "2026-10-21T09:58:00.000Z",
      "createdAt": "2026-10-01T12:00:00.000Z"
    }
  ],
  "total": 1,
  "page": 1,
  "pageSize": 20
}

Create a key

Creates a key and returns its secret once. Dashboard session only, so a leaked key cannot mint keys that outlive its own revocation. The dashboard calls this when you click Create key.

Portal session only — API keys get 403 SESSION_REQUIRED.
POST/api/customer_api_keys/portal/keys
curl -X POST "https://apiv2.tronergy.io/api/customer_api_keys/portal/keys" \
  -H "Cookie: <portal-session-cookie>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production backend",
    "expiresAt": "2027-10-01T00:00:00Z"
  }'
Parameters
namestringrequired

1-120 characters.

descriptionstring | null

Up to 1000 characters.

expiresAtstring | null

ISO date in the future. Leave out or null for no expiry.

Response (201)
{
  "ok": true,
  "id": "d81f...",
  "name": "Production backend",
  "keyPrefix": "omk_9f8e7d6c",
  "secret": "omk_9f8e7d6c.<48 hex characters>",
  "expiresAt": "2027-10-01T00:00:00.000Z",
  "createdAt": "2026-10-21T10:00:00.000Z"
}

secret is shown once. Store it in your secret manager right away.

Errors: 422 limit_reached (25 usable keys already), 422 Validation failed, 403 SESSION_REQUIRED.

Revoke a key

The key stops working immediately. You can revoke the key you are calling with. Pass id in the query string: DELETE /api/customer_api_keys/portal/keys?id=<id>.

DELETE/api/customer_api_keys/portal/keys
curl -X DELETE "https://apiv2.tronergy.io/api/customer_api_keys/portal/keys?id=d81f2c3a-4b5e-4f6a-9b8c-7d6e5f4a3b2c" \
  -H "x-api-key: $TRONERGY_API_KEY"
Parameters
idstringrequiredquery

ID of the key to revoke.

Response
{ "ok": true, "success": true }

Errors: 404 Missing or invalid id parameter, 404 Key not found (unknown, already revoked or not yours).