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#
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | required | The agent's id (agt_…). · e.g. agt_01K7D8F2H4K6M8P0R2T4V6X8Z0 |
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).
Another API key for an agent. Strict.
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | optional | 1–64 chars |
test | boolean | optional |
{
"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
| Field | Type | Required | Notes |
|---|---|---|---|
id | string | required | |
name | string | required | |
prefix | string | required | |
test | boolean | required | |
createdAt | string | required | date-time |
lastUsedAt | string | null | required | date-time |
connector | object | null | required | |
connector.clientId | string | required | |
connector.name | string | required | |
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 | ceiling_reached | The 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. |
| 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. |