LoguDocs
Open Logu

Agents · createAgent

Create an agent and its first API key

POST /v1/agents

An agent is anything that calls Logu from code (an AI agent, a script, CI). It belongs to the workspace, not to the member who created it. The API key's secret (lg_…) is returned exactly once: only its hash is stored. With test: true it is a test API key (lg_test_…): what the agent sends with it is shown in the app, never delivered.

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

Parameters#

NameInTypeRequiredDescription
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).

A new agent. Strict.

FieldTypeRequiredNotes
namestringrequired1–64 chars
testbooleanoptional
{
  "name": "deploy-bot"
}

Example#

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

Responses#

201

The agent and its API key, with the secret in apiKey.key.

{
  "agent": {
    "id": "agt_01K7D8F2H4K6M8P0R2T4V6X8Z0",
    "name": "deploy-bot",
    "notificationLevel": "asks_and_events",
    "createdAt": "2026-10-01T09:00:00.000Z",
    "apiKeys": [
      {
        "id": "key_01K7D8F2J5N7Q9S1U3W5Y7A9C1",
        "name": "deploy-bot",
        "prefix": "lg_8fK2xQp",
        "test": false,
        "createdAt": "2026-10-01T09:00:00.000Z",
        "lastUsedAt": "2026-10-12T14:03:11.000Z",
        "connector": null
      }
    ],
    "asks30d": 14,
    "events30d": 62
  },
  "apiKey": {
    "id": "key_01K7D8F2J5N7Q9S1U3W5Y7A9C1",
    "name": "deploy-bot",
    "prefix": "lg_8fK2xQp",
    "test": false,
    "createdAt": "2026-10-01T09:00:00.000Z",
    "lastUsedAt": null,
    "connector": null,
    "key": "lg_8fK2xQp3R7vT9wY1zA4cD6eG8hJ0kL2m"
  }
}
Response fields
FieldTypeRequiredNotes
agentAgentrequired
agent.idstringrequired
agent.namestringrequired
agent.notificationLevel"asks_and_events" | "asks_only" | "silent"required
agent.createdAtstringrequireddate-time
agent.apiKeysApiKey[]required
agent.apiKeys[].idstringrequired
agent.apiKeys[].namestringrequired
agent.apiKeys[].prefixstringrequired
agent.apiKeys[].testbooleanrequired
agent.apiKeys[].createdAtstringrequireddate-time
agent.apiKeys[].lastUsedAtstring | nullrequireddate-time
agent.apiKeys[].connectorobject | nullrequired
agent.asks30dintegerrequired
agent.events30dintegerrequired
apiKeyNewApiKeyrequired
apiKey.idstringrequired
apiKey.namestringrequired
apiKey.prefixstringrequired
apiKey.testbooleanrequired
apiKey.createdAtstringrequireddate-time
apiKey.lastUsedAtstring | nullrequireddate-time
apiKey.connectorobject | nullrequired
apiKey.connector.clientIdstringrequired
apiKey.connector.namestringrequired
apiKey.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.
402plan_limitThis is over one of the workspace's plan quotas: asks, events or metric reports this month, stored images, projects or metric names (Free and Pro), or on Free its agents, members and webhook endpoints (only on servers that enforce plan limits), or a Free account that already owns its shared workspaces (always).
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.