---
title: "Replace Repository Configuration"
method: PUT
path: "/api/v1/git/repositories/{repo_id}/config"
tags: ["Git Repositories"]
---

# Replace Repository Configuration

`PUT /api/v1/git/repositories/{repo_id}/config`

## Request

- Base URL: `https://public-api.linearb.io`
- URL: `https://public-api.linearb.io/api/v1/git/repositories/{repo_id}/config`
- Auth: API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/linearb/apis/linearb-api/docs/api/v1/git/repositories/:repo_id/config/put.ts> (a function with typed inputs; its response is checked against the schema)

Replaces the repository's overrides: each section sent overrides the organization default, and every section not sent returns to the organization default. Changing excluded branches, excluded base branches, excluded file extensions, release detection or coding time strategy recomputes history asynchronously

## Path parameters

- `repo_id` integer, required: The repository id, as `GET /api/v1/git/repositories` returns it

## Request body

- RepositorySettingsWriteModel: The setting sections to write, at least one. Each section sent replaces that section.
  - `releases_detection` ReleasesDetectionWriteModel: How releases are detected. Changing it recomputes history asynchronously.
    - `method` 'tags' | 'pr_to_branch' | 'merge_to_branch' | 'api', required: `tags`, `pr_to_branch`, `merge_to_branch` or `api`
    - `pattern` string, nullable: Regular expression for the release tags (`tags`) or the dedicated branch (`pr_to_branch`, `merge_to_branch`); required for those, not allowed with `api`
    - `backfill_days` 1 | 90: How far back history is recomputed after this change: `90` (default) recomputes the last 90 days, `1` skips the recompute. The recompute runs asynchronously
  - `draft_pull_requests` DraftPullRequestsModel: How draft pull requests are recognized; a pull request matching either rule is a draft.
    - `labels` string[]: Labels that mark a pull request as a draft (case-insensitive)
    - `title_pattern` string, nullable: Regular expression matched against the title; `null` or empty: no title rule
  - `default_branch` DefaultBranchModel: The branch every merge comparison is based on.
    - `branch_name` string, nullable: `null` uses the provider's default branch
  - `exclude_branches` PatternsModel: A list of regular expressions. Changing it recomputes history asynchronously.
    - `patterns` string[]: Regular expressions, one per entry
  - `exclude_base_branches` PatternsModel: A list of regular expressions. Changing it recomputes history asynchronously.
    - `patterns` string[]: Regular expressions, one per entry
  - `exclude_file_extensions` PatternsModel: A list of regular expressions. Changing it recomputes history asynchronously.
    - `patterns` string[]: Regular expressions, one per entry
  - `coding_time_strategy` CodingTimeStrategyWriteModel: When coding time starts. Changing it recomputes history asynchronously.
    - `method` 'first_commit' | 'issue_state_pr', required: `first_commit`: the first commit on the branch; `issue_state_pr`: the linked issue moving to in progress
    - `backfill_days` 1 | 90: How far back history is recomputed after this change: `90` (default) recomputes the last 90 days, `1` skips the recompute. The recompute runs asynchronously

## Response `200`

Successful Response

- RepositoryConfigResponseModel: A repository's settings, each section marked as inherited (`global`) or overridden (`repository`).
  - `repository_id` integer, required
  - `repository_name` string, nullable
  - `settings` object, required

## Other responses

- `400`: Bad Request - an unknown section, an invalid value or regular expression
- `401`: Unauthorized
- `403`: Forbidden
- `404`: The repository was not found
- `405`: Method Not Allowed
- `409`: Conflict
- `422`: Validation Error
- `500`: Internal Server Error
- `504`: Gateway Timeout

---

[API](https://skmtc.dev/linearb/apis/linearb-api.md) - [All operations](https://skmtc.dev/linearb/apis/linearb-api/llms.txt) - [OpenAPI document](https://skmtc.dev/linearb/apis/linearb-api/revisions/3aea06710db6?raw)
