---
title: "Append whole lines at the session's end (the first piece makes it)"
description: "Header `Pando-Session`: JSON `{program, agent_id, repo, branch, parent}`\n(`repo` and `branch` null in the repository's own folder; `parent` a\nsession id or null). `Content-Encoding: gzip` is optional. Only the\nsession's own person adds to it.\n"
---

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

Path: Pando API › sessions

`POST /v1/monorepos/{owner}/{monorepo}/sessions/{id}/pieces`

Header `Pando-Session`: JSON `{program, agent_id, repo, branch, parent}`
(`repo` and `branch` null in the repository's own folder; `parent` a
session id or null). `Content-Encoding: gzip` is optional. Only the
session's own person adds to it.

## Authentication

Requires one of the following:

- `credential`, http, header `Authorization`
- `session`, apiKey, in cookie

## Path parameters

- `appendSessionPiece.path.owner` (string, required) — The monorepo's owner, a namespace (a person's login or an organization). Matched without case.
  - pattern `^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38}$`
- `appendSessionPiece.path.monorepo` (string, required) — The monorepo's name within its owner (or an old name). Matched without case.
  - pattern `^[a-z0-9](?:[a-z0-9._]|-(?!-)){0,38}$`
- `appendSessionPiece.path.id` (string, required) — s_ and the first 128 bits of SHA-256("<program>:<agent's own id>") in Crockford base32.

## Query parameters

- `appendSessionPiece.query.at` (integer, required)
  - min 0
- `appendSessionPiece.query.next` (integer, required)
  - min 1

## Request body

_Required._

## Example request

```json
"string"
```

## Code samples

### cURL

```curl
curl --request POST \
  --url 'https://app.gitpando.com/v1/monorepos/string/string/sessions/string/pieces?at=0&next=1' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/x-ndjson' \
  --data '"string"'
```

### TypeScript

```typescript
const url = 'https://app.gitpando.com/v1/monorepos/string/string/sessions/string/pieces?at=0&next=1';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/x-ndjson', Authorization: 'Bearer <token>'},
  body: '"string"'
};

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

### Python

```python
import requests

url = "https://app.gitpando.com/v1/monorepos/string/string/sessions/string/pieces?at=0&next=1"

payload = "\"string\""
headers = {
    "Content-Type": "application/x-ndjson",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

The session now; its `end` is `next`.

#### Example

```json
{
  "id": "string",
  "state": "active",
  "person": "string",
  "machine": "string",
  "program": "claude-code",
  "models": [
    {
      "model": "string",
      "answers": 0
    }
  ],
  "repo": "string",
  "branch": "string",
  "parent": "string",
  "subagents": 0,
  "started_at": "2019-08-24T14:15:22Z",
  "last_at": "2019-08-24T14:15:22Z",
  "prompts": 0,
  "tool_calls": 0,
  "images": 0,
  "redactions": 0,
  "bytes": 0,
  "end": 0,
  "removed": [
    {
      "prompt": 0,
      "by": "string",
      "at": "2019-08-24T14:15:22Z"
    }
  ],
  "commits": [
    {
      "repo": "string",
      "sha": "string",
      "branch": "string",
      "title": "string",
      "committed_at": "2019-08-24T14:15:22Z",
      "on_main": true,
      "model": "string"
    }
  ]
}
```

- `appendSessionPiece.response.200.id` (string, required)
- `appendSessionPiece.response.200.state` (string, required)
  - one of `"active"`, `"inactive"`
- `appendSessionPiece.response.200.person` (string, required)
- `appendSessionPiece.response.200.machine` (string, required)
- `appendSessionPiece.response.200.program` (string, required)
  - one of `"claude-code"`, `"codex"`, `"pi"`, `"opencode"`
- `appendSessionPiece.response.200.models` (array<object>, required) — Most answers first, then the latest used.
  - `appendSessionPiece.response.200.models.model` (string, required)
  - `appendSessionPiece.response.200.models.answers` (integer, required)
- `appendSessionPiece.response.200.repo` (string | null, required)
- `appendSessionPiece.response.200.branch` (string | null, required)
- `appendSessionPiece.response.200.parent` (string | null, required)
- `appendSessionPiece.response.200.subagents` (integer, required)
- `appendSessionPiece.response.200.started_at` (string | null, required)
  - format `date-time`
- `appendSessionPiece.response.200.last_at` (string | null, required)
  - format `date-time`
- `appendSessionPiece.response.200.prompts` (integer, required)
- `appendSessionPiece.response.200.tool_calls` (integer, required)
- `appendSessionPiece.response.200.images` (integer, required)
- `appendSessionPiece.response.200.redactions` (integer, required)
- `appendSessionPiece.response.200.bytes` (integer, required)
- `appendSessionPiece.response.200.end` (integer, required) — Where the next piece starts.
- `appendSessionPiece.response.200.removed` (array<object>, required)
  - `appendSessionPiece.response.200.removed.prompt` (integer, required)
  - `appendSessionPiece.response.200.removed.by` (string, required)
  - `appendSessionPiece.response.200.removed.at` (string, required)
    - format `date-time`
- `appendSessionPiece.response.200.commits` (array<object>, required) — Its pushed commits, oldest first by committer time; within one second, the branch's own order, then sha. At most 500.
  - `appendSessionPiece.response.200.commits.repo` (string, required)
  - `appendSessionPiece.response.200.commits.sha` (string, required)
  - `appendSessionPiece.response.200.commits.branch` (string | null, required)
  - `appendSessionPiece.response.200.commits.title` (string, required)
  - `appendSessionPiece.response.200.commits.committed_at` (string, required)
    - format `date-time`
  - `appendSessionPiece.response.200.commits.on_main` (boolean, required)
  - `appendSessionPiece.response.200.commits.model` (string | null, required) — The model in force in the session at the commit's time; null when the sessions naming the commit disagree or one has none, the same in every view.

### 400

An error

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "paths": [
      "string"
    ],
    "checks": {
      "sha": "string",
      "state": "success",
      "required": [
        "string"
      ],
      "checks_unknown": "string",
      "missing": [
        "string"
      ],
      "statuses": [
        {
          "sha": "string",
          "context": "string",
          "state": "pending",
          "target_url": "string",
          "description": "string",
          "creator": "string",
          "app": "string",
          "created_at": "2019-08-24T14:15:22Z"
        }
      ]
    }
  }
}
```

- `appendSessionPiece.response.400.error` (object, required)
  - `appendSessionPiece.response.400.error.code` (string, required)
  - `appendSessionPiece.response.400.error.message` (string, required)
  - `appendSessionPiece.response.400.error.paths` (array<string>, optional)
  - `appendSessionPiece.response.400.error.checks` (object, optional) — GitHub's combined status, plus the required contexts and which are missing.
    - `appendSessionPiece.response.400.error.checks.sha` (string | null, required)
    - `appendSessionPiece.response.400.error.checks.state` (string, required) — `success` when the merge gate passes; `missing` when a required context has not reported; `unknown` while the required checks are (an unforced merge is refused).
      - one of `"success"`, `"pending"`, `"failure"`, `"error"`, `"missing"`, `"unknown"`
    - `appendSessionPiece.response.400.error.checks.required` (array | null, required) — Null while unknown.
    - `appendSessionPiece.response.400.error.checks.checks_unknown` (string | null, required) — Why the required checks are unknown, in plain words: "Pando couldn't read this monorepo's required checks; try again", or "pando.toml line 3: expected comma or end of structure; fix it on main, or merge with force". Null otherwise.
    - `appendSessionPiece.response.400.error.checks.statuses` (array<object>, required) — The latest status per context.
      - `appendSessionPiece.response.400.error.checks.statuses.sha` (string, required)
      - `appendSessionPiece.response.400.error.checks.statuses.context` (string, required)
      - `appendSessionPiece.response.400.error.checks.statuses.state` (string, required)
        - one of `"pending"`, `"success"`, `"failure"`, `"error"`
      - `appendSessionPiece.response.400.error.checks.statuses.created_at` (string, required)
        - format `date-time`
      - `appendSessionPiece.response.400.error.checks.statuses.target_url` (string | null, optional)
      - `appendSessionPiece.response.400.error.checks.statuses.description` (string | null, optional)
      - `appendSessionPiece.response.400.error.checks.statuses.creator` (string, optional) — The member who posted it (a login); `app:<slug>` for a status posted with a status token or by a CI integration; `hook:<hook id>` for a status token from a web hook with no app.
      - `appendSessionPiece.response.400.error.checks.statuses.app` (string | null, optional) — The CI service that reported it (`buildkite`, `github-actions`, ...), stamped by Pando from a status token or a CI integration, never from the body or `target_url`. Null when a member posted it with their own credential. The web shows the service's mark for a slug it knows.
    - `appendSessionPiece.response.400.error.checks.missing` (array<string>, optional)

### 403

An error

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "paths": [
      "string"
    ],
    "checks": {
      "sha": "string",
      "state": "success",
      "required": [
        "string"
      ],
      "checks_unknown": "string",
      "missing": [
        "string"
      ],
      "statuses": [
        {
          "sha": "string",
          "context": "string",
          "state": "pending",
          "target_url": "string",
          "description": "string",
          "creator": "string",
          "app": "string",
          "created_at": "2019-08-24T14:15:22Z"
        }
      ]
    }
  }
}
```

- `appendSessionPiece.response.403.error` (object, required)
  - `appendSessionPiece.response.403.error.code` (string, required)
  - `appendSessionPiece.response.403.error.message` (string, required)
  - `appendSessionPiece.response.403.error.paths` (array<string>, optional)
  - `appendSessionPiece.response.403.error.checks` (object, optional) — GitHub's combined status, plus the required contexts and which are missing.
    - `appendSessionPiece.response.403.error.checks.sha` (string | null, required)
    - `appendSessionPiece.response.403.error.checks.state` (string, required) — `success` when the merge gate passes; `missing` when a required context has not reported; `unknown` while the required checks are (an unforced merge is refused).
      - one of `"success"`, `"pending"`, `"failure"`, `"error"`, `"missing"`, `"unknown"`
    - `appendSessionPiece.response.403.error.checks.required` (array | null, required) — Null while unknown.
    - `appendSessionPiece.response.403.error.checks.checks_unknown` (string | null, required) — Why the required checks are unknown, in plain words: "Pando couldn't read this monorepo's required checks; try again", or "pando.toml line 3: expected comma or end of structure; fix it on main, or merge with force". Null otherwise.
    - `appendSessionPiece.response.403.error.checks.statuses` (array<object>, required) — The latest status per context.
      - `appendSessionPiece.response.403.error.checks.statuses.sha` (string, required)
      - `appendSessionPiece.response.403.error.checks.statuses.context` (string, required)
      - `appendSessionPiece.response.403.error.checks.statuses.state` (string, required)
        - one of `"pending"`, `"success"`, `"failure"`, `"error"`
      - `appendSessionPiece.response.403.error.checks.statuses.created_at` (string, required)
        - format `date-time`
      - `appendSessionPiece.response.403.error.checks.statuses.target_url` (string | null, optional)
      - `appendSessionPiece.response.403.error.checks.statuses.description` (string | null, optional)
      - `appendSessionPiece.response.403.error.checks.statuses.creator` (string, optional) — The member who posted it (a login); `app:<slug>` for a status posted with a status token or by a CI integration; `hook:<hook id>` for a status token from a web hook with no app.
      - `appendSessionPiece.response.403.error.checks.statuses.app` (string | null, optional) — The CI service that reported it (`buildkite`, `github-actions`, ...), stamped by Pando from a status token or a CI integration, never from the body or `target_url`. Null when a member posted it with their own credential. The web shows the service's mark for a slug it knows.
    - `appendSessionPiece.response.403.error.checks.missing` (array<string>, optional)

### 409

An error

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "paths": [
      "string"
    ],
    "checks": {
      "sha": "string",
      "state": "success",
      "required": [
        "string"
      ],
      "checks_unknown": "string",
      "missing": [
        "string"
      ],
      "statuses": [
        {
          "sha": "string",
          "context": "string",
          "state": "pending",
          "target_url": "string",
          "description": "string",
          "creator": "string",
          "app": "string",
          "created_at": "2019-08-24T14:15:22Z"
        }
      ]
    }
  }
}
```

- `appendSessionPiece.response.409.error` (object, required)
  - `appendSessionPiece.response.409.error.code` (string, required)
  - `appendSessionPiece.response.409.error.message` (string, required)
  - `appendSessionPiece.response.409.error.paths` (array<string>, optional)
  - `appendSessionPiece.response.409.error.checks` (object, optional) — GitHub's combined status, plus the required contexts and which are missing.
    - `appendSessionPiece.response.409.error.checks.sha` (string | null, required)
    - `appendSessionPiece.response.409.error.checks.state` (string, required) — `success` when the merge gate passes; `missing` when a required context has not reported; `unknown` while the required checks are (an unforced merge is refused).
      - one of `"success"`, `"pending"`, `"failure"`, `"error"`, `"missing"`, `"unknown"`
    - `appendSessionPiece.response.409.error.checks.required` (array | null, required) — Null while unknown.
    - `appendSessionPiece.response.409.error.checks.checks_unknown` (string | null, required) — Why the required checks are unknown, in plain words: "Pando couldn't read this monorepo's required checks; try again", or "pando.toml line 3: expected comma or end of structure; fix it on main, or merge with force". Null otherwise.
    - `appendSessionPiece.response.409.error.checks.statuses` (array<object>, required) — The latest status per context.
      - `appendSessionPiece.response.409.error.checks.statuses.sha` (string, required)
      - `appendSessionPiece.response.409.error.checks.statuses.context` (string, required)
      - `appendSessionPiece.response.409.error.checks.statuses.state` (string, required)
        - one of `"pending"`, `"success"`, `"failure"`, `"error"`
      - `appendSessionPiece.response.409.error.checks.statuses.created_at` (string, required)
        - format `date-time`
      - `appendSessionPiece.response.409.error.checks.statuses.target_url` (string | null, optional)
      - `appendSessionPiece.response.409.error.checks.statuses.description` (string | null, optional)
      - `appendSessionPiece.response.409.error.checks.statuses.creator` (string, optional) — The member who posted it (a login); `app:<slug>` for a status posted with a status token or by a CI integration; `hook:<hook id>` for a status token from a web hook with no app.
      - `appendSessionPiece.response.409.error.checks.statuses.app` (string | null, optional) — The CI service that reported it (`buildkite`, `github-actions`, ...), stamped by Pando from a status token or a CI integration, never from the body or `target_url`. Null when a member posted it with their own credential. The web shows the service's mark for a slug it knows.
    - `appendSessionPiece.response.409.error.checks.missing` (array<string>, optional)

### 410

An error

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "paths": [
      "string"
    ],
    "checks": {
      "sha": "string",
      "state": "success",
      "required": [
        "string"
      ],
      "checks_unknown": "string",
      "missing": [
        "string"
      ],
      "statuses": [
        {
          "sha": "string",
          "context": "string",
          "state": "pending",
          "target_url": "string",
          "description": "string",
          "creator": "string",
          "app": "string",
          "created_at": "2019-08-24T14:15:22Z"
        }
      ]
    }
  }
}
```

- `appendSessionPiece.response.410.error` (object, required)
  - `appendSessionPiece.response.410.error.code` (string, required)
  - `appendSessionPiece.response.410.error.message` (string, required)
  - `appendSessionPiece.response.410.error.paths` (array<string>, optional)
  - `appendSessionPiece.response.410.error.checks` (object, optional) — GitHub's combined status, plus the required contexts and which are missing.
    - `appendSessionPiece.response.410.error.checks.sha` (string | null, required)
    - `appendSessionPiece.response.410.error.checks.state` (string, required) — `success` when the merge gate passes; `missing` when a required context has not reported; `unknown` while the required checks are (an unforced merge is refused).
      - one of `"success"`, `"pending"`, `"failure"`, `"error"`, `"missing"`, `"unknown"`
    - `appendSessionPiece.response.410.error.checks.required` (array | null, required) — Null while unknown.
    - `appendSessionPiece.response.410.error.checks.checks_unknown` (string | null, required) — Why the required checks are unknown, in plain words: "Pando couldn't read this monorepo's required checks; try again", or "pando.toml line 3: expected comma or end of structure; fix it on main, or merge with force". Null otherwise.
    - `appendSessionPiece.response.410.error.checks.statuses` (array<object>, required) — The latest status per context.
      - `appendSessionPiece.response.410.error.checks.statuses.sha` (string, required)
      - `appendSessionPiece.response.410.error.checks.statuses.context` (string, required)
      - `appendSessionPiece.response.410.error.checks.statuses.state` (string, required)
        - one of `"pending"`, `"success"`, `"failure"`, `"error"`
      - `appendSessionPiece.response.410.error.checks.statuses.created_at` (string, required)
        - format `date-time`
      - `appendSessionPiece.response.410.error.checks.statuses.target_url` (string | null, optional)
      - `appendSessionPiece.response.410.error.checks.statuses.description` (string | null, optional)
      - `appendSessionPiece.response.410.error.checks.statuses.creator` (string, optional) — The member who posted it (a login); `app:<slug>` for a status posted with a status token or by a CI integration; `hook:<hook id>` for a status token from a web hook with no app.
      - `appendSessionPiece.response.410.error.checks.statuses.app` (string | null, optional) — The CI service that reported it (`buildkite`, `github-actions`, ...), stamped by Pando from a status token or a CI integration, never from the body or `target_url`. Null when a member posted it with their own credential. The web shows the service's mark for a slug it knows.
    - `appendSessionPiece.response.410.error.checks.missing` (array<string>, optional)

### 413

An error

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "paths": [
      "string"
    ],
    "checks": {
      "sha": "string",
      "state": "success",
      "required": [
        "string"
      ],
      "checks_unknown": "string",
      "missing": [
        "string"
      ],
      "statuses": [
        {
          "sha": "string",
          "context": "string",
          "state": "pending",
          "target_url": "string",
          "description": "string",
          "creator": "string",
          "app": "string",
          "created_at": "2019-08-24T14:15:22Z"
        }
      ]
    }
  }
}
```

- `appendSessionPiece.response.413.error` (object, required)
  - `appendSessionPiece.response.413.error.code` (string, required)
  - `appendSessionPiece.response.413.error.message` (string, required)
  - `appendSessionPiece.response.413.error.paths` (array<string>, optional)
  - `appendSessionPiece.response.413.error.checks` (object, optional) — GitHub's combined status, plus the required contexts and which are missing.
    - `appendSessionPiece.response.413.error.checks.sha` (string | null, required)
    - `appendSessionPiece.response.413.error.checks.state` (string, required) — `success` when the merge gate passes; `missing` when a required context has not reported; `unknown` while the required checks are (an unforced merge is refused).
      - one of `"success"`, `"pending"`, `"failure"`, `"error"`, `"missing"`, `"unknown"`
    - `appendSessionPiece.response.413.error.checks.required` (array | null, required) — Null while unknown.
    - `appendSessionPiece.response.413.error.checks.checks_unknown` (string | null, required) — Why the required checks are unknown, in plain words: "Pando couldn't read this monorepo's required checks; try again", or "pando.toml line 3: expected comma or end of structure; fix it on main, or merge with force". Null otherwise.
    - `appendSessionPiece.response.413.error.checks.statuses` (array<object>, required) — The latest status per context.
      - `appendSessionPiece.response.413.error.checks.statuses.sha` (string, required)
      - `appendSessionPiece.response.413.error.checks.statuses.context` (string, required)
      - `appendSessionPiece.response.413.error.checks.statuses.state` (string, required)
        - one of `"pending"`, `"success"`, `"failure"`, `"error"`
      - `appendSessionPiece.response.413.error.checks.statuses.created_at` (string, required)
        - format `date-time`
      - `appendSessionPiece.response.413.error.checks.statuses.target_url` (string | null, optional)
      - `appendSessionPiece.response.413.error.checks.statuses.description` (string | null, optional)
      - `appendSessionPiece.response.413.error.checks.statuses.creator` (string, optional) — The member who posted it (a login); `app:<slug>` for a status posted with a status token or by a CI integration; `hook:<hook id>` for a status token from a web hook with no app.
      - `appendSessionPiece.response.413.error.checks.statuses.app` (string | null, optional) — The CI service that reported it (`buildkite`, `github-actions`, ...), stamped by Pando from a status token or a CI integration, never from the body or `target_url`. Null when a member posted it with their own credential. The web shows the service's mark for a slug it knows.
    - `appendSessionPiece.response.413.error.checks.missing` (array<string>, optional)


Source: https://docs.gitpando.com/api/sessions/appendSessionPiece/index.md
