> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maia.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Associate a repository with a project

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



## OpenAPI

````yaml /openapi/public-api-endpoint-reference.yaml post /v1/projects/{projectId}/repositories
openapi: 3.1.0
info:
  title: Maia Public REST API
  version: '1.0'
servers:
  - description: EU1
    url: https://eu1.api.matillion.com/dpc
  - description: US1
    url: https://us1.api.matillion.com/dpc
security:
  - bearerAuth: []
tags:
  - description: Manage Schedules
    name: Schedules
  - description: Manage Connections
    name: Connections
  - description: Operations for managing Project Variables
    name: Project Variables
  - description: Manage Pipelines
    name: Pipelines
  - description: Review pipelines against quality rules
    name: Pipeline Quality Review
  - description: Execute tests within a project
    name: Test Execution
  - description: Manage your AI agent tasks
    name: AI Agent Tasks
  - description: SCIM endpoints for user/group permission management
    name: Directory Integration
  - description: Publish shared pipeline artifacts
    name: Shared Pipeline Artifacts
  - description: Manage Repositories
    name: Repositories
  - description: Report on Credit Consumption
    name: Consumption
  - description: Manage Artifacts
    name: Artifacts
  - description: Operations for data lineage and governance
    name: Data Lineage
  - description: Manage Streaming Pipelines
    name: Streaming Pipelines
  - description: Execute a pipeline
    name: Pipeline Execution
  - description: ''
    name: Environments
  - description: ''
    name: Projects
  - description: Manage Agents
    name: Agents
  - description: Operations for managing Environment-level Overrides of Project Variables
    name: Project Variable Environment Overrides
  - description: Query audit events
    name: Audit Events
  - description: Connector Profiles
    name: Connectors
paths:
  /v1/projects/{projectId}/repositories:
    post:
      tags:
        - Repositories
      summary: Associate a repository with a project
      description: >-
        Associates a repository with a project where none has been previously
        set
      operationId: createRepository
      parameters:
        - in: path
          name: projectId
          required: true
          schema:
            type: string
            pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
        - in: header
          name: Git-Provider-Access-Token
          required: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            examples:
              Azure DevOps Repository:
                description: Azure DevOps Repository
                value:
                  provider: azure-devops
                  providerParameters:
                    organization: my-azure-organisation
                    repositoryId: existing-repo-id
                    tenantId: my-tenant-id
                  repositoryName: azure-repo-name
              GitHub Repository:
                description: GitHub Repository
                value:
                  provider: github
                  providerParameters:
                    ownerName: my-github-organisation
                  repositoryName: github-repo-name
              GitLab Repository:
                description: GitLab Repository
                value:
                  provider: gitlab
                  providerParameters:
                    repositoryId: '123456789'
                  repositoryName: gitlab-repo-name
            schema:
              oneOf:
                - $ref: '#/components/schemas/CreateAzureDevOpsRepositoryRequest'
                - $ref: '#/components/schemas/CreateGitHubRepositoryRequest'
                - $ref: '#/components/schemas/CreateGitLabRepositoryRequest'
        required: true
      responses:
        '201':
          description: Repository associated successfully
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Bad request parameters
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Unauthorized
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Forbidden
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Repository already in use or already set
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Unexpected error occurred
components:
  schemas:
    CreateAzureDevOpsRepositoryRequest:
      allOf:
        - $ref: '#/components/schemas/CreateRepositoryRequest'
        - type: object
          properties:
            providerParameters:
              $ref: '#/components/schemas/AzureDevOpsProviderParameters'
              description: ${repositories.create.providerParameters.desc}
      required:
        - provider
        - providerParameters
        - repositoryName
    CreateGitHubRepositoryRequest:
      allOf:
        - $ref: '#/components/schemas/CreateRepositoryRequest'
        - type: object
          properties:
            providerParameters:
              $ref: '#/components/schemas/GitHubProviderParameters'
              description: ${repositories.create.providerParameters.desc}
      required:
        - provider
        - providerParameters
        - repositoryName
    CreateGitLabRepositoryRequest:
      allOf:
        - $ref: '#/components/schemas/CreateRepositoryRequest'
        - type: object
          properties:
            providerParameters:
              $ref: '#/components/schemas/GitLabProviderParameters'
              description: ${repositories.create.providerParameters.desc}
      required:
        - provider
        - providerParameters
        - repositoryName
    ProblemDetail:
      type: object
      properties:
        detail:
          type: string
        instance:
          type: string
        status:
          type: integer
          format: int32
        title:
          type: string
        type:
          type: string
          format: uri
        violations:
          type: array
          items:
            type: string
    CreateRepositoryRequest:
      type: object
      discriminator:
        mapping:
          azure-devops:
            $ref: '#/components/schemas/CreateAzureDevOpsRepositoryRequest'
          github:
            $ref: '#/components/schemas/CreateGitHubRepositoryRequest'
          gitlab:
            $ref: '#/components/schemas/CreateGitLabRepositoryRequest'
        propertyName: provider
      properties:
        provider:
          type: string
          description: The Git provider type
          enum:
            - github
            - gitlab
            - azure-devops
          example: github
        providerParameters:
          $ref: '#/components/schemas/ProviderParameters'
          description: >-
            Provider-specific parameters. See the provider-specific request
            schema for field details.
        repositoryName:
          type: string
          description: The name of the repository
          example: my-project-repository
          maxLength: 255
          minLength: 1
      required:
        - provider
        - repositoryName
    AzureDevOpsProviderParameters:
      type: object
      properties:
        organization:
          type: string
          description: The Azure DevOps organization name
          example: my-azure-org
          minLength: 1
        repositoryId:
          type: string
          description: The existing repository ID in Azure DevOps
          example: existing-repo-id
          minLength: 1
        tenantId:
          type: string
          description: The Azure AD tenant ID
          example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
          minLength: 1
      required:
        - organization
        - repositoryId
        - tenantId
    GitHubProviderParameters:
      type: object
      properties:
        ownerName:
          type: string
          description: The GitHub organization or user name that owns the repository
          example: matillion
          minLength: 1
      required:
        - ownerName
    GitLabProviderParameters:
      type: object
      properties:
        repositoryId:
          type: string
          description: The GitLab repository ID (numeric)
          example: '123456789'
          minLength: 1
          pattern: \d+
      required:
        - repositoryId
    ProviderParameters: {}
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      description: a valid bearer token
      scheme: bearer
      type: http

````