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

# Fetch a public GitHub release's files, to make a release from them

> Takes a repository or release link. Patch stores the release's files (its assets, or the source as a zip when it has none; at most 500 MB; the default branch's source when the repository has no release) and returns them, with a listing filled from the repository's name, description, README and license. Send the files with POST /projects/{owner}/{slug}/releases: they're already stored, so there's nothing to upload. With unpack, a release of one zip is stored as the files inside it, without the folder they all share (a browser game's).



## OpenAPI

````yaml /api-reference/openapi.json post /imports/github
openapi: 3.1.0
info:
  title: Patch API
  version: 1.0.0
  description: >-
    The public API behind patch.gg, the desktop app and pch. Changes within v1
    are additive only. Errors are { error: { code, message, details } }; branch
    on code.
servers:
  - url: https://patch.gg/api/v1
security: []
paths:
  /imports/github:
    post:
      tags:
        - Releases
      summary: Fetch a public GitHub release's files, to make a release from them
      description: >-
        Takes a repository or release link. Patch stores the release's files
        (its assets, or the source as a zip when it has none; at most 500 MB;
        the default branch's source when the repository has no release) and
        returns them, with a listing filled from the repository's name,
        description, README and license. Send the files with POST
        /projects/{owner}/{slug}/releases: they're already stored, so there's
        nothing to upload. With unpack, a release of one zip is stored as the
        files inside it, without the folder they all share (a browser game's).
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                url:
                  type: string
                  minLength: 1
                  maxLength: 500
                  example: https://github.com/mira/lantern-run/releases/tag/v1.2.0
                unpack:
                  type: boolean
                  description: >-
                    Store the files inside the release's one zip instead of the
                    zip, e.g. for a browser game.
              required:
                - url
      responses:
        '200':
          description: The release's files, stored
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GithubImport'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Not signed in
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Not allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearer: []
components:
  schemas:
    GithubImport:
      type: object
      properties:
        repository:
          type: string
          example: https://github.com/mira/lantern-run
        release:
          type:
            - object
            - 'null'
          properties:
            tag:
              type: string
            name:
              type:
                - string
                - 'null'
            published_at:
              type:
                - string
                - 'null'
            notes:
              type:
                - string
                - 'null'
              description: The release's notes on GitHub
          required:
            - tag
            - name
            - published_at
            - notes
          description: 'Null when the repository has no release: see branch'
        branch:
          type:
            - string
            - 'null'
          description: >-
            When the repository has never made a release, the default branch
            whose source Patch took
        listing:
          type: object
          properties:
            name:
              type: string
            summary:
              type:
                - string
                - 'null'
            description:
              type:
                - string
                - 'null'
              description: The repository's README
            license:
              type:
                - string
                - 'null'
              description: The repository's SPDX license, when GitHub knows it
          required:
            - name
            - summary
            - description
            - license
        source_zip:
          type: boolean
          description: >-
            The files are GitHub's zip of the source, because the release has
            none of its own or there's no release. Its files are all in one
            folder (see zips[].root).
        files:
          type: array
          items:
            type: object
            properties:
              path:
                type: string
              sha256:
                type: string
              size:
                type: integer
            required:
              - path
              - sha256
              - size
        zips:
          type: array
          items:
            type: object
            properties:
              path:
                type: string
              root:
                type:
                  - string
                  - 'null'
                description: >-
                  The folder every file inside is in, e.g.
                  "lantern-run-1a2b3c/", or null. A mapping's from can leave it
                  out.
              paths:
                type: array
                items:
                  type: string
                description: The first 200 files inside, folders left out
              count:
                type: integer
            required:
              - path
              - root
              - paths
              - count
          description: What's inside each zip among the files (not sent when unpacked)
      required:
        - repository
        - release
        - branch
        - listing
        - source_zip
        - files
        - zips
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: version_exists
            message:
              type: string
            details: {}
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: An API key (pch_...) or the token from pch login.

````

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