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

# Connect template to GitHub repository

> Connect a template to a GitHub repository for syncing.



## OpenAPI

````yaml post /api/ui-templates/github/connect/{api_name}/{template_id}
openapi: 3.1.0
info:
  title: Apigene
  description: Apigene API
  version: 1.0.0
  contact:
    name: Apigene Support
    url: https://app.apigene.ai
    email: support@apigene.ai
servers:
  - url: https://app.apigene.ai
security:
  - BearerAuth: []
paths:
  /api/ui-templates/github/connect/{api_name}/{template_id}:
    post:
      tags:
        - GitHub Sync
      summary: Connect template to GitHub repository
      description: Connect a template to a GitHub repository for syncing.
      operationId: github_sync_connect
      parameters:
        - name: api_name
          in: path
          required: true
          schema:
            type: string
            title: Api Name
        - name: template_id
          in: path
          required: true
          schema:
            type: string
            title: Template Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GitHubConnectRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    GitHubConnectRequest:
      properties:
        repo_owner:
          type: string
          title: Repo Owner
          description: GitHub repository owner
        repo_name:
          type: string
          title: Repo Name
          description: GitHub repository name
        branch:
          type: string
          title: Branch
          description: Branch name
          default: main
        repo_path:
          anyOf:
            - type: string
            - type: 'null'
          title: Repo Path
          description: Optional custom repository path
        github_token:
          type: string
          title: Github Token
          description: GitHub Personal Access Token
        auto_sync:
          type: boolean
          title: Auto Sync
          description: Enable auto-sync on save
          default: false
        sync_direction:
          type: string
          enum:
            - push
            - pull
            - bidirectional
          title: Sync Direction
          description: Sync direction
          default: bidirectional
        on_conflict:
          type: string
          enum:
            - manual
            - local
            - remote
          title: On Conflict
          description: Conflict resolution strategy
          default: manual
      type: object
      required:
        - repo_owner
        - repo_name
        - github_token
      title: GitHubConnectRequest
      description: Request to connect template to GitHub.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Authorization header using the Bearer scheme. Example:
        'Authorization: Bearer {token}'

````