---
title: "Compact session"
method: POST
path: "/api/session/{sessionID}/compact"
tags: ["session"]
---

# Compact session

`POST /api/session/{sessionID}/compact`

## Request

- Base URL: `https://opencode.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://opencode.ai/api/session/{sessionID}/compact`
- Auth: none required

Durably admit a session compaction request. Steers by default: it runs at the next step boundary instead of waiting behind queued prompts.

## Path parameters

- `sessionID` string, required

## Request body

- object
  - `id` string
  - `delivery` 'steer' | 'queue'

## Response `200`

Success

- object
  - `data` SessionInboxCompaction, required (unresolved $ref)

## Other responses

- `400`: InvalidRequestError
- `401`: UnauthorizedError
- `404`: SessionNotFoundError | LocationNotFoundError
- `409`: ConflictError

---

[API](https://skmtc.dev/kaaass/apis/opencode.md) - [All operations](https://skmtc.dev/kaaass/apis/opencode/llms.txt) - [OpenAPI document](https://skmtc.dev/kaaass/apis/opencode/revisions/4e083d954707?raw)
