---
title: "Stop the agent without closing the session"
method: POST
path: "/api/v2/projects/{projectId}/sessions/{sessionId}/stop"
tags: ["Sessions"]
---

# Stop the agent without closing the session

`POST /api/v2/projects/{projectId}/sessions/{sessionId}/stop`

## Request

- Base URL: `https://davinci-app.com`
- URL: `https://davinci-app.com/api/v2/projects/{projectId}/sessions/{sessionId}/stop`
- Auth: HTTP bearer

Halts the current run. The session survives, the project stays open, and the
conversation so far is kept — so you can send a new prompt afterwards without
starting over. Use `deleteSession` when you actually want to finish.

Stopping when nothing is running is not an error; `stopped` is `false` and the
status is whatever it already was. That makes this safe to call defensively,
for instance when abandoning a run you may or may not have started.

## Response `200`

The run was halted, or there was none to halt.

- StopAgentResponse
  - `sessionId` string, uuid, required
  - `taskId` string, required
  - `stopped` boolean, required: False when there was no run to stop, which is not a failure — you asked for a state you already had.
  - `status` 'no_session' | 'project_not_running' | 'idle' | 'starting' | 'running' | 'paused' | 'completed' | 'failed' | 'unknown', required: - `no_session` — the machine has no record of this session; it lapsed or the project restarted. Create a new one. - `project_not_running` — the session is known but its project has unloaded. - `idle` — the session is live and no run has been started. - `starting` — a run is being set up. - `running` — a run is in progress. - `paused` — a run was stopped and can be continued with a new prompt. - `completed` — the run finished. - `failed` — the run ended in an error. `agent.error` says why, as does the transcript. - `unknown` — the machine could not be reached for this field. Retry; anything else in the same response is still valid. `paused`, `completed`, and `failed` are terminal for a run.

## Other responses

- `401`: No credential was supplied, or the supplied credential is malformed, expired, or revoked. A credential that is present but unusable is never downgraded to an anonymous request.
- `403`: Authenticated but not authorized. Either the acting user lacks the required resource permission, the key's scope ceiling excludes it, or the endpoint rejects this credential type (`CREDENTIAL_NOT_PERMITTED`).
- `404`: No such session, it belongs to another user, or it belongs to a different project than the one in the path. Error code is `SESSION_NOT_FOUND`.
- `409`: The project this session opened is no longer running. Error code is `PROJECT_NOT_RUNNING`.
- `429`: Request rate exceeded, either globally or for this key.
- `500`: Unexpected server error.

## Changes

- **2026-09-15** (v2) `67c8b8616dbb`: 6 info
  - the `success` response property const value `false` was added for the status `401`
  - the `success` response property const value `false` was added for the status `403`
  - the `success` response property const value `false` was added for the status `404`
  - the `success` response property const value `false` was added for the status `409`
  - …2 more
- **2026-09-15** (v2) `48948af37797`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/celedon-solutions/apis/davinci-public-api/changes/api/v2/projects/:projectId/sessions/:sessionId/stop/post.md)

---

[API](https://skmtc.dev/celedon-solutions/apis/davinci-public-api.md) - [All operations](https://skmtc.dev/celedon-solutions/apis/davinci-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/celedon-solutions/apis/davinci-public-api/revisions/279218ca2e8d?raw)
