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#
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Logu-Workspace | header | string | optional | Humans 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.
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | required | 1–64 chars |
test | boolean | optional |
{
"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
| Field | Type | Required | Notes |
|---|---|---|---|
agent | Agent | required | |
agent.id | string | required | |
agent.name | string | required | |
agent.notificationLevel | "asks_and_events" | "asks_only" | "silent" | required | |
agent.createdAt | string | required | date-time |
agent.apiKeys | ApiKey[] | required | |
agent.apiKeys[].id | string | required | |
agent.apiKeys[].name | string | required | |
agent.apiKeys[].prefix | string | required | |
agent.apiKeys[].test | boolean | required | |
agent.apiKeys[].createdAt | string | required | date-time |
agent.apiKeys[].lastUsedAt | string | null | required | date-time |
agent.apiKeys[].connector | object | null | required | |
agent.asks30d | integer | required | |
agent.events30d | integer | required | |
apiKey | NewApiKey | required | |
apiKey.id | string | required | |
apiKey.name | string | required | |
apiKey.prefix | string | required | |
apiKey.test | boolean | required | |
apiKey.createdAt | string | required | date-time |
apiKey.lastUsedAt | string | null | required | date-time |
apiKey.connector | object | null | required | |
apiKey.connector.clientId | string | required | |
apiKey.connector.name | string | required | |
apiKey.key | string | required |
Errors#
Every error is {"error":{"code","message","hint","docUrl","requestId"}}: branch on code. See Errors.
| Status | Code | Meaning |
|---|---|---|
| 400 | bad_request | The request is malformed or a field is invalid (see issues). |
| 400 | unknown_field | The body has a field the endpoint doesn't know (often a typo or snake_case). |
| 401 | unauthorized | No credentials, or the API key or session is invalid or revoked. |
| 402 | plan_limit | This 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). |
| 403 | forbidden | The caller is authenticated but may not do this (wrong role, or an API key on a human-only endpoint). |
| 404 | not_found | No such route, or the resource doesn't exist in your workspace. |
| 500 | internal_error | Something went wrong on Logu's side. |