---
title: "Diff session turns"
method: GET
path: "/api/session/{sessionID}/diff"
tags: ["session"]
---

# Diff session turns

`GET /api/session/{sessionID}/diff`

## 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}/diff`
- Auth: none required

Structured per-file diffs of the files a turn changed. A turn runs from the first prompt after the session was last idle until its next idle marker, so prompts steered in while it was busy belong to the same turn; `to` extends the range through a later turn. Compares the range's first recorded snapshot with its last; a step still running in the active session compares against the working copy. Ranges that span a location change are rejected. In sessions without any idle marker, a prompt's turn spans until the next user message.

## Path parameters

- `sessionID` string, required

## Query parameters

- `from` string
- `to` string
- `context` string, nullable: Unchanged lines around each hunk. Omit for full-file patches.

## Response `200`

Success

- object
  - `data` FileDiffInfo[], required
    - `file` string, required
    - `patch` string, required
    - `additions` integer, required
    - `deletions` integer, required
    - `status` 'added' | 'deleted' | 'modified', required
    - `more` true

## Other responses

- `400`: InvalidRequestError
- `401`: UnauthorizedError
- `404`: MessageNotFoundError | SessionNotFoundError | LocationNotFoundError
- `500`: UnknownError

## Changes

> 50 revisions in range; 1 not diffed.

- **2026-10-26** `aa0f65b3d158`: 1 info
  - added the optional property `data/items/more` to the response with the `200` status

[Operation history](https://skmtc.dev/kaaass/apis/opencode/changes/api/session/:sessionID/diff/get.md)

---

[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)
