---
title: "Commit on a branch"
method: POST
path: "/entries/{entryId}/branches/{branchId}/commits"
tags: ["Entry versioning"]
---

# Commit on a branch

`POST /entries/{entryId}/branches/{branchId}/commits`

## Request

- Base URL: `https://whatareyoudo.ing/api/v1`
- URL: `https://whatareyoudo.ing/api/v1/entries/{entryId}/branches/{branchId}/commits`
- Auth: HTTP bearer

`expectedHeadCommitId` is an optimistic-concurrency check: send the head the edit was based on and a commit that landed meanwhile is rejected rather than silently overwritten.

## Path parameters

- `entryId` string, uuid, required
- `branchId` string, uuid, required

## Request body

- CommitOnBranchRequest
  - `content` BranchCommitContent
    - `format` 'plain' | 'markdown'
    - `body` string, required
    - `title` string, nullable
    - `mood` string, nullable
    - `location` string, nullable
    - `tags` string[]
    - `coverMediaAssetId` string, uuid, nullable
  - `media` object[]
    - `mediaAssetId` string, uuid, required
    - `caption` string, nullable
  - `commitMessage` string, nullable
  - `expectedHeadCommitId` string, uuid, nullable

## Response `201`

Committed

- object
  - `data` object, required
    - `headCommitId` string, uuid, required
    - `parentCommitId` string, uuid, nullable, required
  - `meta` object, required
    - `requestId` string, required

## Other responses

- `404`: Not found
- `409`: The branch head moved since expectedHeadCommitId

---

[API](https://skmtc.dev/whatareyoudo/apis/whatcha-api.md) · [All operations](https://skmtc.dev/whatareyoudo/apis/whatcha-api/llms.txt) · [OpenAPI document](https://skmtc.dev/whatareyoudo/apis/whatcha-api/revisions/48dd8a54abea?raw)
