---
title: "The work in one workspace repo since its base branch, as a git patch [write]"
method: POST
path: "/sessions/{id}/workspace/patch"
---

# The work in one workspace repo since its base branch, as a git patch \[write\]

`POST /sessions/{id}/workspace/patch`

## Request

- Base URL: `https://api.agentsky.dev/v1`
- URL: `https://api.agentsky.dev/v1/sessions/{id}/workspace/patch`
- Auth: HTTP bearer

Runs inside the pod as the workspace owner and returns one binary-safe `git diff --binary` from the merge base of HEAD with the branch's upstream (or the remote's default branch, or else the base an imported folder recorded, with base_branch "") to the working tree: commits, uncommitted edits and new files that are not ignored. The repository's own index is left as it was. Wakes a parked pod. 400 not_a_repository, 409 no_base when there is no remote branch to compare against, 413 patch_too_large over 5 MB.

## Path parameters

- `id` string, required

## Request body

- object
  - `repo` string, required: repo directory relative to the workspace root, as /workspace/changes lists it; "." for the root

## Response `200`

OK

- object
  - `repo` string
  - `base_branch` string: the branch the work started from, as the remote names it
  - `base_commit` string: the commit the patch applies to
  - `commits` string[]: subjects of the commits since the base, oldest first
  - `patch` string: base64 of the patch; empty when nothing changed

## Other responses

- `default`: Error — { error: { code, message, request_id } }

## Changes

- **2026-11-02** `e5e8f0229a99`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/agentsky/apis/agentsky-developer-api/changes/sessions/:id/workspace/patch/post.md)

---

[API](https://skmtc.dev/agentsky/apis/agentsky-developer-api.md) - [All operations](https://skmtc.dev/agentsky/apis/agentsky-developer-api/llms.txt) - [OpenAPI document](https://skmtc.dev/agentsky/apis/agentsky-developer-api/revisions/8280a065ef6a?raw)
