---
title: "🔒 Подключить репозиторий Git-интеграции к проекту с выбором доступа ИИ-агентов: с этого момента он синхронизируется; повторный вызов меняет доступ агентов у существующей связи."
method: POST
path: "/projects/project/repository/link"
tags: ["Projects"]
---

# 🔒 Подключить репозиторий Git-интеграции к проекту с выбором доступа ИИ-агентов: с этого момента он синхронизируется; повторный вызов меняет доступ агентов у существующей связи.

`POST /projects/project/repository/link`

## Request

- Base URL: `http://localhost`
- URL: `http://localhost/projects/project/repository/link`
- Auth: one of:
  - API key in header `sid` and API key in header `rts` and API key in header `sig`
  - HTTP bearer

Подключить репозиторий Git-интеграции к проекту с выбором доступа ИИ-агентов: с этого момента он синхронизируется; повторный вызов меняет доступ агентов у существующей связи.

**Access:** `authorized` (10 ) · **Scope:** `write`

**Allows:** `project:update`, `integration:git` (все обязательны; проверка в команде по ресурсу из запроса)

### TypeScript (copy-paste)

**`POST /projects/project/repository/link`**

<details open><summary><b>Params</b></summary>

```typescript
export interface ProjectsProjectRepositoryLinkParams {
  ID: string
  repositoryID: string
  agentAccess?: ProjectRepository_AgentAccess | null
}
```

</details>

<details open><summary><b>Body</b></summary>

```typescript
export interface ProjectsProjectRepositoryLinkBody {
  agentAccess?: ProjectRepository_AgentAccess | null
}
```

</details>

<details open><summary><b>Response</b></summary>

```typescript
export type ProjectsProjectRepositoryLinkResponse = IServerResponse<Resp_projects_project_repository_link>

export interface IServerResponse<T = any> {
  code: number
  data: T
  srvTS: number
  rkey: string
}
```

</details>

> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)

## Query parameters

- `ID` string, uuid, required
- `repositoryID` string, uuid, required
- `agentAccess` 'read' | 'write': `read` = "read", `write` = "write"

## Headers

- `devID` string, uuid, required
- `tz` string, required
- `app` string, required
- `appVer` string, required
- `rKey` string

## Request body

- ProjectsProjectRepositoryLinkBody: JSON body for `projects/project/repository/link`
  - `agentAccess` 'read' | 'write': `read` = "read", `write` = "write"

## Response `200`

OK — `IServerResponse<Resp_projects_project_repository_link>`

- object
  - `code` integer, required
  - `data` RespProjectsProjectRepositoryLink, required: ResponseData for projects/project/repository/link
    - `link` ProjectRepository, required: Entity `ProjectRepository` (table: ProjectRepository )
      - `ID` string, uuid, required
      - `cID` string, uuid, required
      - `projectID` string, uuid, required
      - `repositoryID` string, uuid, required
      - `integrationID` string, uuid, required
      - `agentAccess` 'read' | 'write': `read` = "read", `write` = "write"
      - `createdUID` string, uuid, required
      - `createdDT` string, date-time, required
      - `updTS` integer, required: Unix timestamp in milliseconds
  - `srvTS` integer, required: Server timestamp (ms)
  - `rkey` string, required: Request key

## Other responses

- `400`: BadRequest / Validation — неверные params/body/headers
- `401`: Unauthorized: Active user session required
- `403`: AccessNotAllowed: Privilege project:update (to the project) or integration:git required
- `404`: NotFound: Project or repository with specified ID does not exist
- `406`: TimeResync — расхождение rts с сервером
- `422`: UnprocessableContent: Repository was removed at provider

---

[API](https://skmtc.dev/kosmodrom/apis/kosmodrom-backend-api.md) · [All operations](https://skmtc.dev/kosmodrom/apis/kosmodrom-backend-api/llms.txt) · [OpenAPI document](https://skmtc.dev/kosmodrom/apis/kosmodrom-backend-api/revisions/a143b51ba29a?raw)
