---
title: "End an active agent"
method: POST
path: "/agents/{id}/end"
tags: ["Agents"]
---

# End an active agent

`POST /agents/{id}/end`

## Request

- Base URL: `https://api.atako.ai`
- URL: `https://api.atako.ai/agents/{id}/end`
- Auth: HTTP bearer

Owner of the agent, or an admin of the owner's company. A plain teammate (who can still view and chat with the agent) gets 404.

## Path parameters

- `id` string, required

## Response `200`

- object
  - `session` AgentRecord, required: The raw `agents` table row, returned verbatim by POST /agents (201) and POST /agents/{id}/end (200, under `.session`). Every column, including several operational/internal fields not otherwise exposed.
    - `id` string, uuid, required
    - `clientId` string, uuid, required
    - `teamId` string, uuid, nullable
    - `companyId` string, uuid, nullable
    - `name` string, required
    - `image` string, required
    - `systemPrompt` string, nullable: Raw user instructions (no business context appended).
    - `mission` string, nullable
    - `profileUpdatedAt` string, date-time
    - `modelId` string, uuid, nullable
    - `directModelId` string, nullable
    - `modelConfig` object, nullable: Per-task-type model overrides.
      - `vision` string, nullable
      - `low_effort` string, nullable
      - `medium_effort` string, nullable
      - `high_effort` string, nullable
    - `llmKeyId` string, uuid, nullable: Set for a BYOK agent (company LLM provider key); null for the platform key.
    - `harnessId` string, uuid, nullable
    - `engine` 'openclaw' | 'hermes' | 'opencode', required
    - `status` 'active' | 'completed' | 'paused' | 'provisioning' | 'unresponsive' | 'failed', required
    - `agentAuthTokenHash` string, nullable
    - `agentAuthIssuedAt` string, date-time, nullable
    - `agentAuthLastUsedAt` string, date-time, nullable
    - `startDate` string, date-time, required
    - `activatedAt` string, date-time, nullable
    - `endDate` string, date-time, nullable
    - `lastHeartbeatAt` string, date-time, nullable
    - `lastReadAt` string, date-time, nullable
    - `engineVersion` string, nullable
    - `engineImage` string, nullable
    - `engineRequestedVersion` string, nullable
    - `upgradingAt` string, date-time, nullable
    - `upgradeRequestedAt` string, date-time, nullable
    - `upgradeStatus` 'requested' | 'running' | 'succeeded' | 'failed', nullable
    - `upgradeError` string, nullable
    - `provisioningError` string, nullable
    - `pausedAt` string, date-time, nullable
    - `pausedReason` string, nullable
    - `clientContext` string, nullable: Per-agent "contexte business" free text.
    - `createdAt` string, date-time, required

## Other responses

- `401`: Missing, malformed, or invalid bearer token / API key, or revoked session (SESSION_REVOKED).
- `404`: Unknown agent, or the caller is neither its owner nor an admin of the owner's company.
- `409`: AGENT_NOT_ACTIVE — agent already ended; or `code: AGENT_PROVISIONING` — still provisioning, cancel it instead.

---

[API](https://skmtc.dev/atako/apis/atako-api.md) · [All operations](https://skmtc.dev/atako/apis/atako-api/llms.txt) · [OpenAPI document](https://skmtc.dev/atako/apis/atako-api/revisions/aa555c56fbd7?raw)
