Skip to content

Git Repositories

This API lets you list the Git repositories LinearB knows about, start or stop monitoring them, and read or override the settings of each repository.

A repository id returned by List Git Repositories is the repo_id used by the other endpoints on this page. To filter by integration, get the integration IDs from List Integrations.

Each repository follows the organization default for every setting section unless it overrides the section. The per-repository endpoints below read, set and remove those overrides. The organization defaults are managed with Git Configuration, and the sections and their fields are described in Settings sections.

List Git Repositories

Retrieves Git repositories and their monitoring status. Supports filtering by exact repository name, provider_id, integration_ids, monitoring state and visibility (each list filter takes a single value or a comma-separated list). Results are paginated using page and page_size (maximum 100 items per page). Returns an empty list if no repositories match the specified filters.

HTTP request

GET  https://public-api.linearb.io/api/v1/git/repositories

Query parameter

Parameter name Value Description
page integer Page number.
(Default: 1)
(Minimum: 1)
page_size integer Number of repositories per page.
(Default: 50)
(Minimum: 1)
(Maximum: 100)
name string Exact repository name to filter by.
(Min length: 1, Max length: 256)
provider_id string Filter by the repository ID on the Git provider (GitHub, GitLab, etc.).
(Min length: 1, Max length: 256)
integration_ids string Filter by Git integration IDs, as listed by List Integrations.
A single value or a comma-separated list.
state string Filter by monitoring state.
Valid values are: "monitored" "not_monitored" "failing" "discovered"
A single value or a comma-separated list.
visibility string Filter by repository visibility on the provider.
Valid values are: "public" "private" "internal"
A single value or a comma-separated list.

Responses

200 - Successful Response

{
  "total": 1,
  "items": [
    {
      "id": 80231,
      "provider_id": "123456789",
      "name": "api",
      "http_url": "https://github.com/acme/api",
      "provider": "github",
      "integration_id": 34,
      "visibility": "private",
      "state": "monitored",
      "failing_reason": null,
      "created_at": "2026-01-15T09:00:00Z",
      "updated_at": "2026-02-01T12:30:00Z",
      "provider_last_pushed_at": "2026-02-01T12:00:00Z",
      "has_webhook": true,
      "is_onprem": false,
      "ai_tool_rules": {}
    }
  ]
}

Each item in items has these fields:

Field Type Description
id integer LinearB repository id
provider_id string Repository id in the provider (GitHub/GitLab/etc.)
name string Repository name
http_url string Repository URL
provider string The Git provider: github, gitlab, bitbucket, bitbucket_server or azure_devops
integration_id integer The Git integration the repository belongs to, as listed by GET /api/v1/integrations
visibility string Repository visibility on the provider: public, private or internal; null when the provider does not report it
state string Monitoring state: monitored, not_monitored, discovered, or failing
failing_reason string Reason for failure; null unless state is failing
created_at string When the repository was first registered in LinearB
updated_at string When the repository record was last updated in LinearB
provider_last_pushed_at string Most recent push timestamp reported by the provider
has_webhook boolean Whether an active webhook is registered for this repo
is_onprem boolean True for OPA/on-prem repos, false for cloud
ai_tool_rules object Detected AI tool rule files in the repository, such as .cursorrules or CLAUDE.md

400 - Bad Request

401 - Unauthorized

403 - Forbidden

404 - Not Found

405 - Method Not Allowed

409 - Conflict

422 - Validation Error

500 - Internal Server Error

504 - Gateway Timeout

Monitor or Stop Monitoring Git Repositories

Sets repositories to monitored or not_monitored, up to 100 per call, exactly as Settings > Git > Repositories does. Monitoring starts collecting the repository and loads its history; it counts against the repository quota. Stopping monitoring stops collecting new data; data already collected is kept. Each repository is applied or rejected on its own: a repository already in the requested state is applied, and a rejected one carries a code and a message.

HTTP request

PATCH  https://public-api.linearb.io/api/v1/git/repositories

Body parameters

Parameter name Value Description
repositories
(required)
array of objects The monitoring changes to apply
(Entries: 1 to 100)
repositories[].id
(required)
integer LinearB repository id, as listed by GET /api/v1/git/repositories
(Minimum: 1)
repositories[].state
(required)
string monitored starts collecting the repository; not_monitored stops collecting it. Data already collected is kept

Nested fields marked required are required whenever their parent is sent.

Example

{
  "repositories": [
    {
      "id": 80231,
      "state": "monitored"
    },
    {
      "id": 80232,
      "state": "not_monitored"
    }
  ]
}

Responses

200 - Successful Response

{
  "applied": [
    {
      "id": 80231,
      "state": "monitored"
    }
  ],
  "rejected": [
    {
      "id": 80232,
      "state": "not_monitored",
      "code": "repository_not_found",
      "message": "string"
    }
  ]
}

Each entry in rejected carries a code and a message. The possible codes are: duplicate_repository, repository_not_found, integration_not_available, backfill_in_progress, never_monitored, state_changed, write_failed.

400 - Every repository was rejected; an invalid body is also a 400

{
  "applied": [],
  "rejected": [
    {
      "id": 80232,
      "state": "not_monitored",
      "code": "repository_not_found",
      "message": "string"
    }
  ]
}

401 - Unauthorized

403 - The caller may not change repositories, or the repository quota

404 - Not Found

405 - Method Not Allowed

409 - Conflict

422 - Validation Error

500 - Internal Server Error

504 - Gateway Timeout

Get Repository Configuration

Reads a repository's settings. Each section is source: repository when the repository overrides it, with the organization default in global_default, or source: global when it follows the organization default. The organization-wide only sections (bot-authored pull request attribution, included file extensions, active branches duration, issue start time) are not listed; read them with GET /api/v1/git/config

HTTP request

GET  https://public-api.linearb.io/api/v1/git/repositories/{repo_id}/config

Path parameters

Parameter name Value Description
repo_id
(required)
integer The repository id, as GET /api/v1/git/repositories returns it
(Minimum: 1)

Responses

200 - Successful Response

{
  "repository_id": 80231,
  "repository_name": "api",
  "settings": {
    "releases_detection": {
      "value": {
        "method": "tags",
        "pattern": ".*"
      },
      "source": "global"
    },
    "exclude_branches": {
      "value": {
        "patterns": [
          "^develop$",
          "^main$",
          "^release/.*"
        ]
      },
      "source": "repository",
      "global_default": {
        "patterns": [
          "^main$",
          "^master$"
        ]
      }
    }
  }
}

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

Replace Repository Configuration

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

HTTP request

PUT  https://public-api.linearb.io/api/v1/git/repositories/{repo_id}/config

Path parameters

Parameter name Value Description
repo_id
(required)
integer The repository id, as GET /api/v1/git/repositories returns it
(Minimum: 1)

Body parameters

Parameter name Value Description
releases_detection object How releases are detected. Changing it recomputes history asynchronously.
releases_detection.method
(required)
string tags, pr_to_branch, merge_to_branch or api
releases_detection.pattern string Regular expression for the release tags (tags) or the dedicated branch (pr_to_branch, merge_to_branch); required for those, not allowed with api
releases_detection.backfill_days integer How far back history is recomputed after this change: 90 (default) recomputes the last 90 days, 1 skips the recompute. The recompute runs asynchronously
(Default: 90)
draft_pull_requests object How draft pull requests are recognized; a pull request matching either rule is a draft.
draft_pull_requests.labels array of strings Labels that mark a pull request as a draft (case-insensitive)
draft_pull_requests.title_pattern string Regular expression matched against the title; null or empty: no title rule
default_branch object The branch every merge comparison is based on.
default_branch.branch_name string null uses the provider's default branch
exclude_branches object Changing it recomputes history asynchronously
exclude_branches.patterns array of strings Regular expressions, one per entry
exclude_base_branches object Changing it recomputes history asynchronously
exclude_base_branches.patterns array of strings Regular expressions, one per entry
exclude_file_extensions object Changing it recomputes history asynchronously
exclude_file_extensions.patterns array of strings Regular expressions, one per entry
coding_time_strategy object When coding time starts. Changing it recomputes history asynchronously.
coding_time_strategy.method
(required)
string first_commit: the first commit on the branch; issue_state_pr: the linked issue moving to in progress
coding_time_strategy.backfill_days integer How far back history is recomputed after this change: 90 (default) recomputes the last 90 days, 1 skips the recompute. The recompute runs asynchronously
(Default: 90)

Nested fields marked required are required whenever their parent is sent.

Example

{
  "exclude_branches": {
    "patterns": [
      "^develop$",
      "^main$",
      "^release/.*"
    ]
  }
}

Responses

200 - Successful Response

{
  "repository_id": 80231,
  "repository_name": "api",
  "settings": {
    "releases_detection": {
      "value": {
        "method": "tags",
        "pattern": ".*"
      },
      "source": "global"
    },
    "exclude_branches": {
      "value": {
        "patterns": [
          "^develop$",
          "^main$",
          "^release/.*"
        ]
      },
      "source": "repository",
      "global_default": {
        "patterns": [
          "^main$",
          "^master$"
        ]
      }
    }
  }
}

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

Update Repository Configuration

Overrides the organization default of each section sent for the repository; sections not sent are left as they are. Never changes the organization default. Changing excluded branches, excluded base branches, excluded file extensions, release detection or coding time strategy recomputes history asynchronously

HTTP request

PATCH  https://public-api.linearb.io/api/v1/git/repositories/{repo_id}/config

Path parameters

Parameter name Value Description
repo_id
(required)
integer The repository id, as GET /api/v1/git/repositories returns it
(Minimum: 1)

Body parameters

Parameter name Value Description
releases_detection object How releases are detected. Changing it recomputes history asynchronously.
releases_detection.method
(required)
string tags, pr_to_branch, merge_to_branch or api
releases_detection.pattern string Regular expression for the release tags (tags) or the dedicated branch (pr_to_branch, merge_to_branch); required for those, not allowed with api
releases_detection.backfill_days integer How far back history is recomputed after this change: 90 (default) recomputes the last 90 days, 1 skips the recompute. The recompute runs asynchronously
(Default: 90)
draft_pull_requests object How draft pull requests are recognized; a pull request matching either rule is a draft.
draft_pull_requests.labels array of strings Labels that mark a pull request as a draft (case-insensitive)
draft_pull_requests.title_pattern string Regular expression matched against the title; null or empty: no title rule
default_branch object The branch every merge comparison is based on.
default_branch.branch_name string null uses the provider's default branch
exclude_branches object Changing it recomputes history asynchronously
exclude_branches.patterns array of strings Regular expressions, one per entry
exclude_base_branches object Changing it recomputes history asynchronously
exclude_base_branches.patterns array of strings Regular expressions, one per entry
exclude_file_extensions object Changing it recomputes history asynchronously
exclude_file_extensions.patterns array of strings Regular expressions, one per entry
coding_time_strategy object When coding time starts. Changing it recomputes history asynchronously.
coding_time_strategy.method
(required)
string first_commit: the first commit on the branch; issue_state_pr: the linked issue moving to in progress
coding_time_strategy.backfill_days integer How far back history is recomputed after this change: 90 (default) recomputes the last 90 days, 1 skips the recompute. The recompute runs asynchronously
(Default: 90)

Nested fields marked required are required whenever their parent is sent.

Example

{
  "exclude_branches": {
    "patterns": [
      "^develop$",
      "^main$",
      "^release/.*"
    ]
  }
}

Responses

200 - Successful Response

{
  "repository_id": 80231,
  "repository_name": "api",
  "settings": {
    "releases_detection": {
      "value": {
        "method": "tags",
        "pattern": ".*"
      },
      "source": "global"
    },
    "exclude_branches": {
      "value": {
        "patterns": [
          "^develop$",
          "^main$",
          "^release/.*"
        ]
      },
      "source": "repository",
      "global_default": {
        "patterns": [
          "^main$",
          "^master$"
        ]
      }
    }
  }
}

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

Remove Repository Configuration Overrides

Removes every override of the repository, so it follows the organization default - including any later change to it. Changing excluded branches, excluded base branches, excluded file extensions, release detection or coding time strategy recomputes history asynchronously

HTTP request

DELETE  https://public-api.linearb.io/api/v1/git/repositories/{repo_id}/config

Path parameters

Parameter name Value Description
repo_id
(required)
integer The repository id, as GET /api/v1/git/repositories returns it
(Minimum: 1)

Responses

200 - Successful Response

{
  "repository_id": 80231,
  "repository_name": "api",
  "settings": {
    "releases_detection": {
      "value": {
        "method": "tags",
        "pattern": ".*"
      },
      "source": "global"
    },
    "exclude_branches": {
      "value": {
        "patterns": [
          "^develop$",
          "^main$",
          "^release/.*"
        ]
      },
      "source": "repository",
      "global_default": {
        "patterns": [
          "^main$",
          "^master$"
        ]
      }
    }
  }
}

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

Remove a Repository Configuration Override

Removes the repository's override of one section, so that section follows the organization default. Removing a section the repository does not override changes nothing. Changing excluded branches, excluded base branches, excluded file extensions, release detection or coding time strategy recomputes history asynchronously

HTTP request

DELETE  https://public-api.linearb.io/api/v1/git/repositories/{repo_id}/config/{section}

Path parameters

Parameter name Value Description
repo_id
(required)
integer The repository id, as GET /api/v1/git/repositories returns it
(Minimum: 1)
section
(required)
string The section whose override is removed
Valid values are: "releases_detection" "draft_pull_requests" "default_branch" "exclude_branches" "exclude_base_branches" "exclude_file_extensions" "coding_time_strategy"

Responses

200 - Successful Response

{
  "repository_id": 80231,
  "repository_name": "api",
  "settings": {
    "releases_detection": {
      "value": {
        "method": "tags",
        "pattern": ".*"
      },
      "source": "global"
    },
    "exclude_branches": {
      "value": {
        "patterns": [
          "^develop$",
          "^main$",
          "^release/.*"
        ]
      },
      "source": "repository",
      "global_default": {
        "patterns": [
          "^main$",
          "^master$"
        ]
      }
    }
  }
}

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