# Branch a session

> Branch from an earlier turn and leave the original as it was. Try another direction from any earlier response; the branch is a new line of work and the original session does not change.

Canonical URL: https://harnessrouter.ai/docs/branch-a-session
Section: API reference

## Request

Branch from an earlier turn:

```
POST /{harness_id}/v1/responses
Content-Type: application/json

{
  "input": "Try the same analysis with last year's numbers instead.",
  "previous_response_id": "<an earlier response id>",
  "branch": true,
  "stream": true
}
```

## How it works

- The branch starts from the turn you name and continues from there. Later turns on the original are not part of it.
- The original session is left alone, so both lines of work stay open.
- You can branch only from a response that has ended. One with no restorable checkpoint answers 409 with `branch_unavailable`.
- `branch` without `previous_response_id` answers 400.

- [Continue a session](https://harnessrouter.ai/docs/continue-a-session): Carry on the same line of work instead.

## Open standard

A branch reuses the previous_response_id that session continuation sends, adding one flag, and the server reports it as the session_branching capability in its discovery document. See [the sessions model in UHP's Sessions chapter](https://unifiedharnessprotocol.org/spec/sessions).
