---
title: "Create or update a pull request for a model branch"
method: POST
path: "/v1/models/{modelId}/git/commit"
tags: ["Model Git configuration"]
---

# Create or update a pull request for a model branch

`POST /v1/models/{modelId}/git/commit`

<Note>
  This endpoint requires **Modeler** or **Connection Admin** permisisons.
</Note>

Push a branch's model contents to Git and create or update a pull request. This mirrors the **Create Pull Request** / **Update Pull Request** buttons in Omni allowing API consumers and AI agents to drive the pull request workflow programmatically.

By default, the endpoint automatically detects whether the Git branch exists. If a branch doesn't exist, a successful request will create a new Git branch and open a pull request. If a branch does exist, a commit will be added to the branch.

The `allow_branch_exists` and `require_branch_exists` parameters constrain this behavior:

- **Create or update mode** (default) - Auto-detects and handles both scenarios
- **Create-only mode** (`allow_branch_exists: false`) - Fails if the Git branch already exists
- **Update-only mode** (`require_branch_exists: true`) - Fails if the Git branch doesn't exist

## Path parameters

- `modelId` string, uuid, required

## Request body

- object
  - `branch_id` string, uuid, required — UUID of the Omni branch to commit.
  - `commit_message` string, required — Commit message for the git commit.
  - `allow_branch_exists` boolean — Set `false` to fail if git branch already exists (**Create-only mode**).
  - `require_branch_exists` boolean — Set `true` to fail if git branch doesn't exist (**Update-only mode**).

## Response `200`

Commit operation completed successfully

- object
  - `pr_url` string — URL of the created or updated pull request.
  - `git_sha` string — The git SHA of the commit.
  - `in_sync` boolean — Whether the shared model is currently in sync with its configured default git branch.
  - `did_sync` boolean — Whether a sync operation was performed between the shared model and its configured default git branch.

## Other responses

- `400` — Bad Request Possible error messages: - `Bad Request: modelId: Invalid uuid` - `Bad Request: branch_id: Invalid uuid` - `Bad Request: commit_message is required` - `Bad Request: Cannot set both allow_branch_exists=false and require_branch_exists=true`
- `401` — Missing or invalid authentication
- `403` — Forbidden Possible error messages: - `Forbidden: Requires MANAGE_MODEL permission` - This endpoint requires **Modeler** or **Connection Admin** permisisons.
- `404` — Not Found Possible error messages: - `Not Found: Model does not exist` - `Not Found: Branch does not exist` - `Not Found: Git configuration not found for this model`
- `429` — Too Many Requests - Rate limit exceeded (60 requests/minute)

---

[API](https://skmtc.net/omni/apis/omni-api.md) · [All operations](https://skmtc.net/omni/apis/omni-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/omni/omni-api/versions/6b02f7349d0e/schema)
