LoguDocs
Open Logu

Agents · createApiKey

Create another API key

POST /v1/agents/{id}/api-keys

Another API key for the agent, e.g. to rotate: create the new one, switch the agent to it, then revoke the old one. With test: true, a test API key (lg_test_…) to build and try an integration: what it sends is marked test, shown in the app and never delivered (no push, browser notification, email, Telegram or Slack). The secret is returned exactly once.

Who may call it
humans: Deciders and up
Server
https://api.logu.dev

Parameters#

NameInTypeRequiredDescription
idpathstringrequiredThe agent's id (agt_…). · e.g. agt_01K7D8F2H4K6M8P0R2T4V6X8Z0
Logu-WorkspaceheaderstringoptionalHumans only: the workspace to act in (default: your personal workspace). Agents always act in their API key's workspace. · e.g. wsp_01K7D7Y8Z0B2D4F6H8K0M2P4R6

Request body#

Content type application/json (required).

Another API key for an agent. Strict.

FieldTypeRequiredNotes
namestringoptional1–64 chars
testbooleanoptional
{
  "name": "deploy-bot (test)",
  "test": true
}

Example#

curl -s -X POST "https://api.logu.dev/v1/agents/agt_01K7D8F2H4K6M8P0R2T4V6X8Z0/api-keys" \
  -H "Authorization: Bearer $LOGU_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"deploy-bot (test)","test":true}'

Responses#

201

The API key, with the secret in key.

{
  "id": "key_01K7DR1B3D5F7H9K1M3P5R7T9V",
  "name": "deploy-bot (test)",
  "prefix": "lg_test_Zr5mW1n",
  "test": true,
  "createdAt": "2026-10-12T14:05:42.000Z",
  "lastUsedAt": null,
  "connector": null,
  "key": "lg_test_Zr5mW1nB8cX3vK6qP9sT2uY4wA7dF0gH"
}
Response fields
FieldTypeRequiredNotes
idstringrequired
namestringrequired
prefixstringrequired
testbooleanrequired
createdAtstringrequireddate-time
lastUsedAtstring | nullrequireddate-time
connectorobject | nullrequired
connector.clientIdstringrequired
connector.namestringrequired
keystringrequired

Errors#

Every error is {"error":{"code","message","hint","docUrl","requestId"}}: branch on code. See Errors.

StatusCodeMeaning
400bad_requestThe request is malformed or a field is invalid (see issues).
400unknown_fieldThe body has a field the endpoint doesn't know (often a typo or snake_case).
401unauthorizedNo credentials, or the API key or session is invalid or revoked.
402ceiling_reachedThe workspace reached one of Logu's cost ceilings (asks, events, metric reports, test traffic or images this month, stored image bytes, projects, metric names or API keys). Unlike plan_limit, upgrading doesn't lift it. An account that already owns the most shared workspaces an account may own gets it too.
403forbiddenThe caller is authenticated but may not do this (wrong role, or an API key on a human-only endpoint).
404not_foundNo such route, or the resource doesn't exist in your workspace.
500internal_errorSomething went wrong on Logu's side.