---
title: "stopAgent"
---

> Documentation Index
> Fetch the complete documentation index at: https://agenthold.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# stopAgent

Path: agenthold API › agents

`POST /agents/{agentId}/stop`

URL: `/api/v1/agents/{agentId}/stop`

## Authentication

Requires one of the following:

- `session`, apiKey, in cookie
- `token`, http bearer, header `Authorization`

## Path parameters

- `agentId` (`stopAgent.path.agentId`; string, required)

## Code samples

### cURL

```bash
curl --request POST \
  --url '<base-url>/api/v1/agents/<agentId>/stop' \
  --cookie 'agenthold_session=<agenthold_session>'
```

### TypeScript

```typescript
const url = '<base-url>/api/v1/agents/<agentId>/stop';
const options = {
  method: 'POST',
  headers: {cookie: 'agenthold_session=<agenthold_session>'}
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/api/v1/agents/<agentId>/stop"

headers = {"cookie": "agenthold_session=<agenthold_session>"}

response = requests.post(url, headers=headers)

print(response.text)
```

## Responses

### 202

Stopping. The home volume is kept.

#### Example

```json
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "owner": {
    "id": "string",
    "email": "string",
    "name": "string",
    "avatarUrl": "string"
  },
  "image": "string",
  "harness": "string",
  "cpus": 0,
  "memoryMb": 0,
  "idleMinutes": 0,
  "state": "creating",
  "stateError": "string",
  "stateChangedAt": "2019-08-24T14:15:22Z",
  "needsRebuild": true,
  "model": "string",
  "permissionPolicy": "auto-approve",
  "credentialsInSandbox": true,
  "login": {
    "source": "account",
    "user": {
      "id": "string",
      "email": "string",
      "name": "string",
      "avatarUrl": "string"
    },
    "mine": true,
    "connected": true,
    "kind": "string",
    "status": "ok",
    "reason": "string"
  },
  "lastActivityAt": "2019-08-24T14:15:22Z",
  "sleepsAt": "2019-08-24T14:15:22Z",
  "role": "viewer",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z"
}
```

- `id` (`stopAgent.response.202.id`; string, required)
- `workspaceId` (`stopAgent.response.202.workspaceId`; string, required)
- `name` (`stopAgent.response.202.name`; string, required)
- `owner` (`stopAgent.response.202.owner`; object, required)
  - `id` (`stopAgent.response.202.owner.id`; string, required)
  - `email` (`stopAgent.response.202.owner.email`; string, required)
  - `name` (`stopAgent.response.202.owner.name`; string, required)
  - `avatarUrl` (`stopAgent.response.202.owner.avatarUrl`; string, required)
- `image` (`stopAgent.response.202.image`; string, required)
- `harness` (`stopAgent.response.202.harness`; string, required)
- `cpus` (`stopAgent.response.202.cpus`; number, required)
- `memoryMb` (`stopAgent.response.202.memoryMb`; integer, required)
  - format: `int64`
- `idleMinutes` (`stopAgent.response.202.idleMinutes`; integer, required)
- `state` (`stopAgent.response.202.state`; string, required)
  - one of `"creating"`, `"starting"`, `"running"`, `"stopping"`, `"sleeping"`, `"rebuilding"`, `"destroying"`, `"error"`
- `stateError` (`stopAgent.response.202.stateError`; string, required)
- `stateChangedAt` (`stopAgent.response.202.stateChangedAt`; string, required)
  - format: `date-time`
- `needsRebuild` (`stopAgent.response.202.needsRebuild`; boolean, required) — Image or resources changed since the sandbox was built.
- `model` (`stopAgent.response.202.model`; string, required)
- `permissionPolicy` (`stopAgent.response.202.permissionPolicy`; string, required)
  - one of `"auto-approve"`, `"ask"`
- `credentialsInSandbox` (`stopAgent.response.202.credentialsInSandbox`; boolean, required) — A harness login was completed inside the sandbox; the agent can read its own credentials.
- `login` (`stopAgent.response.202.login`; object, required) — Which login the agent's harness uses.
  - `source` (`stopAgent.response.202.login.source`; string, required) — account: the account login of `user`. secret: an API key secret attached to the agent wins. sandbox: whatever is signed in inside the sandbox. unsupported: the harness has no account logins.
    - one of `"account"`, `"secret"`, `"sandbox"`, `"unsupported"`
  - `mine` (`stopAgent.response.202.login.mine`; boolean, required) — You are that user.
  - `connected` (`stopAgent.response.202.login.connected`; boolean, required) — That user has connected a login for the agent's harness.
  - `user` (`stopAgent.response.202.login.user`; object, optional) — Whose account logins the agent uses.
    - `id` (`stopAgent.response.202.login.user.id`; string, required)
    - `email` (`stopAgent.response.202.login.user.email`; string, required)
    - `name` (`stopAgent.response.202.login.user.name`; string, required)
    - `avatarUrl` (`stopAgent.response.202.login.user.avatarUrl`; string, required)
  - `kind` (`stopAgent.response.202.login.kind`; string, optional) — How that login was connected.
  - `status` (`stopAgent.response.202.login.status`; string, optional)
    - one of `"ok"`, `"error"`
  - `reason` (`stopAgent.response.202.login.reason`; string, optional) — Why the account login is not used although a user is set.
- `role` (`stopAgent.response.202.role`; string, required)
  - one of `"viewer"`, `"operator"`, `"admin"`
- `createdAt` (`stopAgent.response.202.createdAt`; string, required)
  - format: `date-time`
- `updatedAt` (`stopAgent.response.202.updatedAt`; string, required)
  - format: `date-time`
- `lastActivityAt` (`stopAgent.response.202.lastActivityAt`; string, optional) — Last activity while running (prompts, terminals, files, CPU use in the sandbox).
  - format: `date-time`
- `sleepsAt` (`stopAgent.response.202.sleepsAt`; string, optional) — When the agent goes to sleep if nothing happens. Absent while busy or not running.
  - format: `date-time`

### 403

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`stopAgent.response.403.error`; string, required)

### 404

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`stopAgent.response.404.error`; string, required)

### 409

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`stopAgent.response.409.error`; string, required)


Source: https://agenthold.dev/api/stop-agent/index.md
