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

# Finish connecting your GitHub account

> Connects the GitHub account the user signed in with, using the `code` GitHub sent to your callback URL. The response can include additional fields not listed here.



## OpenAPI

````yaml /spec/paas-git-oneclick.yaml post /v1/git-provider-integration/{provider}
openapi: 3.0.1
info:
  title: Git Integration & One-Click Apps
  version: 1.0.0
  description: |
    Connect your GitHub account, link a repository to an app so it deploys
    automatically, and browse the one-click app catalog.

    ## Connecting GitHub

    Git integration has two parts:

    1. **Your GitHub account.** Connect it with
       `GET /v1/git-provider-integration/github` (sign in on GitHub) and
       `POST /v1/git-provider-integration/github`.
    2. **The Liara GitHub app,** installed on your GitHub account or
       organization to give access to repositories. Get the installation link
       with `GET /v1/git-repository-integration/github/connect`.

    Then link a repository to an app with
    `POST /v1/projects/{projectID}/git-repository-integration/github`. To see
    what's connected, use `GET /v1/me/git-integrations` (in Authentication &
    Account).

    `github` is currently the only supported `provider`. Git connections
    belong to you, not to a team. With `teamID`, the app-level endpoints use
    your own GitHub connection on the team's app.
servers:
  - url: https://api.liara.ir
security:
  - bearerAuth: []
tags:
  - name: GitHub Account
    description: Connect and disconnect your GitHub account.
  - name: Repositories
    description: Install the GitHub app, and list repositories, branches and organizations.
  - name: App Repository
    description: Link a repository to an app and deploy from it.
  - name: One-Click Apps
    description: Browse ready-to-deploy apps.
paths:
  /v1/git-provider-integration/{provider}:
    post:
      tags:
        - GitHub Account
      summary: Finish connecting your GitHub account
      description: >-
        Connects the GitHub account the user signed in with, using the `code`
        GitHub sent to your callback URL. The response can include additional
        fields not listed here.
      operationId: finishGitHubConnection
      parameters:
        - $ref: '#/components/parameters/Provider'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - code
                - callback_url
                - githubOAuthCSRFToken
              properties:
                code:
                  type: string
                  description: The `code` GitHub added to your callback URL.
                callback_url:
                  type: string
                  format: uri
                  description: The same `callback_url` you used to start.
                githubOAuthCSRFToken:
                  type: string
                  description: From `GET /v1/git-provider-integration/{provider}`.
            example:
              code: <github-code>
              callback_url: https://example.com/github/callback
              githubOAuthCSRFToken: <csrf-token>
      responses:
        '200':
          description: Your GitHub account is connected.
          content:
            application/json:
              schema:
                type: object
                properties:
                  email:
                    type: string
                    format: email
                  fullname:
                    type: string
                  avatar:
                    type: string
                    format: uri
              example:
                email: you@example.com
                fullname: نام نمونه
                avatar: https://example.com/avatar.png
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          description: >-
            Your API token is invalid, or `githubOAuthCSRFToken` is missing,
            invalid, expired or belongs to someone else.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 401
                error: Unauthorized
                message: Authorization failed.
                data: null
        '404':
          $ref: '#/components/responses/UnknownProvider'
        '409':
          description: This GitHub account is already connected to a Liara account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 409
                error: Conflict
                message: Git provider integration already exists.
                data:
                  code: git_provider_integration_already_exists
components:
  parameters:
    Provider:
      name: provider
      in: path
      required: true
      description: The git provider.
      schema:
        type: string
        enum:
          - github
  responses:
    ValidationError:
      description: The request is invalid. `message` says which field failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 400
            error: Bad Request
            message: '"repositoryFullname" is required'
    UnknownProvider:
      description: The provider isn't supported.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 404
            error: Not Found
            message: Not Found
            data: null
  schemas:
    Error:
      type: object
      description: Standard error body.
      properties:
        statusCode:
          type: integer
        error:
          type: string
          description: HTTP status text.
        message:
          type: string
          description: What went wrong.
        data:
          type: object
          nullable: true
          description: >-
            Extra details. When present, `code` is a stable, machine-readable
            error code.
          properties:
            code:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Send your API token as `Authorization: Bearer <api-token>`.'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.