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

# Endpoint called by GitHub post-installation.

> Handles two flows:
- `setup_action=install`: The installation was completed. Registers the installation
  and redirects to the success page.
- `setup_action=request`: The installation was requested but awaits org owner approval.
  Stores the requester's GitHub user ID (for webhook matching) and redirects to the
  pending page.

# Access control rules

- Company member of the company.
- Admins can list all companies. Requires `manage_companies` permissions.



## OpenAPI

````yaml GET /api/v0/companies/github/installation-callback
openapi: 3.1.0
info:
  title: Cantina Client API
  description: >-
    Endpoints available to client organizations. For an overview and
    authentication, see
    https://docs.cantina.xyz/for-organizations/getting-started/api-access.
  license:
    name: Cantina
    identifier: Cantina
  version: 0.1.0
servers: []
security: []
paths:
  /api/v0/companies/github/installation-callback:
    get:
      tags:
        - companies
      summary: Endpoint called by GitHub post-installation.
      description: >-
        Handles two flows:

        - `setup_action=install`: The installation was completed. Registers the
        installation
          and redirects to the success page.
        - `setup_action=request`: The installation was requested but awaits org
        owner approval.
          Stores the requester's GitHub user ID (for webhook matching) and redirects to the
          pending page.

        # Access control rules


        - Company member of the company.

        - Admins can list all companies. Requires `manage_companies`
        permissions.
      operationId: github_installation_callback
      parameters:
        - name: installation_id
          in: query
          description: |-
            The installation id, unique to an installation of the GitHub app.
            Present for `install`, absent for `request`.
          required: false
          schema:
            type:
              - integer
              - 'null'
            format: int64
            minimum: 0
        - name: code
          in: query
          description: |-
            The code to create a user access token.
            May be absent for `request`.
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: setup_action
          in: query
          description: The type of callback. Either "install" or "request".
          required: true
          schema:
            type: string
        - name: state
          in: query
          description: >-
            The CSRF state that was set at the start of the installation.

            Absent when the org admin approves a requested installation (they
            never

            went through our installation link flow).
          required: false
          schema:
            type:
              - string
              - 'null'
      responses:
        '307':
          description: GitHub app installed or installation pending approval
          headers:
            Location:
              schema:
                type: string
              description: Redirect to success or pending page
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
        '401':
          description: Access not authorised
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
        '403':
          description: Access forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
        '404':
          description: Not found. This can also be due to requester not having permission
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
        '500':
          description: Error installing GitHub app
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
components:
  schemas:
    CantinaError:
      type: object
      description: Error returned by the Cantina API.
      required:
        - type
        - msg
      properties:
        type:
          $ref: '#/components/schemas/ErrorType'
        msg:
          type: string
          description: Error message for the user.
    ErrorType:
      type: string
      description: Type of error.
      enum:
        - email_not_verified
        - auth_invalid
        - auth_expired
        - auth_token_missing
        - auth_id_missing
        - invalid_password
        - disabled_user
        - tc_not_accepted
        - evicted
        - unauthorized
        - bad_request
        - not_found
        - forbidden
        - gone
        - payload_too_large
        - service_unavailable
        - internal_error

````