---
title: "Apply a simulated repository decision through patch, local branch, or remote PR"
method: POST
path: "/v1/repositories/{repository_id}/apply"
tags: ["Repository Intelligence"]
---

# Apply a simulated repository decision through patch, local branch, or remote PR

`POST /v1/repositories/{repository_id}/apply`

## Request

- Base URL: `https://api.algenta.ai`
- URL: `https://api.algenta.ai/v1/repositories/{repository_id}/apply`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

## Path parameters

- `repository_id` string, uuid, required

## Request body

- RepositoryApplyRequest
  - `snapshot_id` string, nullable
  - `decision_plan_id` string, required
  - `simulation_id` string, required
  - `mode` 'patch_only' | 'local_branch' | 'remote_pr', required
  - `write_permission` boolean
  - `branch_name` string, nullable
  - `commit_message` string, nullable
  - `base_branch` string, nullable
  - `pull_request_title` string, nullable
  - `pull_request_body` string, nullable

## Response `200`

Successful Response

- RepositoryApplyResponse
  - `repository_id` string, required
  - `snapshot_id` string, required
  - `decision_plan_id` string, required
  - `simulation_id` string, required
  - `mode` 'patch_only' | 'local_branch' | 'remote_pr', required
  - `applied` boolean, required
  - `created_at` string, date-time, required
  - `patch` string, required
  - `branch_name` string, nullable
  - `commit_sha` string, nullable
  - `local_checkout_path` string, nullable
  - `pull_request_url` string, nullable
  - `apply_gate` object
  - `validation_summary` object

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/codna/apis/algenta-api.md) · [All operations](https://skmtc.dev/codna/apis/algenta-api/llms.txt) · [OpenAPI document](https://skmtc.dev/codna/apis/algenta-api/revisions/35d30f84a5df?raw)
