---
title: "Replace Team Git Scope"
method: PUT
path: "/api/v1/git/config/teams/{team_id}/scope"
tags: ["Git Configuration"]
---

# Replace Team Git Scope

`PUT /api/v1/git/config/teams/{team_id}/scope`

## Request

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

Replaces the team's whole Git scope: each key sent becomes exactly that list, and a key not sent is cleared. At least one key is required; clearing the whole scope is a DELETE

## Path parameters

- `team_id` integer, required: The team id

## Request body

- TeamGitScopeWriteRequestModel: The scope keys a Git scope write sets: `repository_ids` and/or `service_ids` - at least one. Ids are the ones `GET /api/v1/git/repositories` and `GET /api/v1/services` return. Repositories must be monitored. Duplicate ids are ignored.
  - `repository_ids` integer[], nullable: Repository ids; `[]` clears the key
  - `service_ids` integer[], nullable: Service ids; `[]` clears the key

## Response `200`

Successful Response

- TeamGitScopeResponseModel: A team's own Git scope: the repositories and services assigned to the team itself. Scope assigned to descendant teams is not included; a group returns only what was assigned to the group. Only monitored repositories are listed.
  - `team_id` integer, required: The team id
  - `team_name` string, nullable: The team name
  - `repositories` TeamGitScopeRepositoryModel[]: The repositories in the team's Git scope
    - `id` integer, required: The repository id, as `GET /api/v1/git/repositories` returns it
    - `name` string, nullable: The repository name
    - `url` string, nullable: The repository URL
  - `services` TeamGitScopeServiceModel[]: The services in the team's Git scope
    - `id` integer, required: The service id, as `GET /api/v1/services` returns it
    - `name` string, nullable: The service name

## Other responses

- `400`: Bad Request, or an id was refused - repositories not found or not monitored, services not found. A refused write changes nothing
- `401`: Unauthorized
- `403`: Forbidden
- `404`: The team 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)
