---
title: "Associate a repository with a project"
method: POST
path: "/v1/projects/{projectId}/repositories"
tags: ["Repositories"]
---

# Associate a repository with a project

`POST /v1/projects/{projectId}/repositories`

Associates a repository with a project where none has been previously set

## Path parameters

- `projectId` string, required

## Headers

- `Git-Provider-Access-Token` string

## Request body

- union
  - CreateAzureDevOpsRepositoryRequest
    - `provider` 'github' | 'gitlab' | 'azure-devops', required — The Git provider type
    - `providerParameters` object, required
      - `organization` string, required — The Azure DevOps organization name
      - `repositoryId` string, required — The existing repository ID in Azure DevOps
      - `tenantId` string, required — The Azure AD tenant ID
    - `repositoryName` string, required — The name of the repository
  - CreateGitHubRepositoryRequest
    - `provider` 'github' | 'gitlab' | 'azure-devops', required — The Git provider type
    - `providerParameters` object, required
      - `ownerName` string, required — The GitHub organization or user name that owns the repository
    - `repositoryName` string, required — The name of the repository
  - CreateGitLabRepositoryRequest
    - `provider` 'github' | 'gitlab' | 'azure-devops', required — The Git provider type
    - `providerParameters` object, required
      - `repositoryId` string, required — The GitLab repository ID (numeric)
    - `repositoryName` string, required — The name of the repository

## Response `201`

Repository associated successfully

## Other responses

- `400` — Bad request parameters
- `401` — Unauthorized
- `403` — Forbidden
- `409` — Repository already in use or already set
- `500` — Unexpected error occurred

---

[API](https://skmtc.net/maia/apis/maia-public-rest-api.md) · [All operations](https://skmtc.net/maia/apis/maia-public-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/maia/maia-public-rest-api/revisions/6239825f68eb/schema)
