> ## 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.

# Change a repo's licence, and commit its licence files to say the same

> Members of the owning org, with the `publish` scope. Fields you leave out stay as they are. The default branch gets one new commit, with you as author and Patch as committer, unless its files say this already: `LICENSE` holds the code's licence, under whatever name the repo already calls its one licence file, and `LICENSE-ART` the art's, when it isn't the code's. Sending what it lists already changes nothing, unless `write_files` says to add a licence file it doesn't have, which is how a repo with none gets one before it goes open: that never replaces or deletes a file that's there, and one that says something else answers 409 `license_differs`. Only a licence Patch has a file for can be chosen. A file that isn't a standard licence's words isn't replaced without `replace_edited`, and its old words stay in the history. The setting changes only once the commit has landed, and a repo with no commits has no file to change. `PATCH /projects/{owner}/{slug}` changes the setting alone. A repo whose home is GitHub has the licence its LICENSE there gives it, and Patch follows it, so it's changed on GitHub: here it answers 409 `on_github`, with the repo's page in `details.html_url`, and nothing changes.



## OpenAPI

````yaml /api-reference/openapi.json put /projects/{owner}/{slug}/repo/license
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:
  /projects/{owner}/{slug}/repo/license:
    put:
      tags:
        - Repos
      summary: Change a repo's licence, and commit its licence files to say the same
      description: >-
        Members of the owning org, with the `publish` scope. Fields you leave
        out stay as they are. The default branch gets one new commit, with you
        as author and Patch as committer, unless its files say this already:
        `LICENSE` holds the code's licence, under whatever name the repo already
        calls its one licence file, and `LICENSE-ART` the art's, when it isn't
        the code's. Sending what it lists already changes nothing, unless
        `write_files` says to add a licence file it doesn't have, which is how a
        repo with none gets one before it goes open: that never replaces or
        deletes a file that's there, and one that says something else answers
        409 `license_differs`. Only a licence Patch has a file for can be
        chosen. A file that isn't a standard licence's words isn't replaced
        without `replace_edited`, and its old words stay in the history. The
        setting changes only once the commit has landed, and a repo with no
        commits has no file to change. `PATCH /projects/{owner}/{slug}` changes
        the setting alone. A repo whose home is GitHub has the licence its
        LICENSE there gives it, and Patch follows it, so it's changed on GitHub:
        here it answers 409 `on_github`, with the repo's page in
        `details.html_url`, and nothing changes.
      parameters:
        - schema:
            type: string
            example: patch
          required: true
          name: owner
          in: path
        - schema:
            type: string
            example: demo-mod
          required: true
          name: slug
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                code_license:
                  type: string
                  maxLength: 64
                  pattern: ^[A-Za-z0-9][A-Za-z0-9.+-]*$
                  example: MIT
                art_license:
                  type: string
                  maxLength: 64
                  pattern: ^[A-Za-z0-9][A-Za-z0-9.+-]*$
                  example: MIT
                replace_edited:
                  type: boolean
                  description: Replace licence files someone has edited by hand
                write_files:
                  type: boolean
                  description: >-
                    With what it lists not changing, add a licence file it
                    doesn't have. It never replaces or deletes one, and one that
                    says something else answers 409 `license_differs`
      responses:
        '200':
          description: Updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Repo'
        '308':
          description: Renamed; follow the Location header
        '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'
        '409':
          description: >-
            Nothing changed: `license_differs` with `write_files`, with
            `details.paths`, `details.says` and `details.listed`;
            `license_edited`, with `details.paths`, until you send
            `replace_edited`; `branch_moved`, for a push that landed first;
            `several_license_files`, with `details.paths`; `license_path_taken`,
            where a folder has the name; `too_many_top_files`;
            `remix_stays_on_patch`, for a remix that can't leave the Patch
            licence while the work it's built on is under it; or `on_github`,
            for a repo whose home is GitHub, with its page in `details.html_url`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: 'No file for that licence: `unknown_licence`, with `details.licences`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            Too many requests: wait as long as `Retry-After` says
            (`retry_after_s` in `details`), then retry
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: The repo couldn't be written to, or read
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: The repo is waking up, or repos aren't set up here
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearer: []
components:
  schemas:
    Repo:
      type: object
      properties:
        name:
          type: string
        summary:
          type:
            - string
            - 'null'
        code_license:
          type: string
          maxLength: 64
          pattern: ^[A-Za-z0-9][A-Za-z0-9.+-]*$
          example: MIT
          description: License of the code
        art_license:
          type: string
          maxLength: 64
          pattern: ^[A-Za-z0-9][A-Za-z0-9.+-]*$
          example: MIT
          description: License of original art and other assets
        clone_url:
          type: string
          format: uri
          example: https://git.patch.gg/patch/demo-mod.git
        visibility:
          type: string
          enum:
            - open
            - closed_source
            - private
          description: >-
            Who can reach the project's repo. open: anyone can find it, read it
            and fork it. closed_source: anyone can find and play what it
            releases; only its org reads the source. private: only its org can
            find it, and anyone else gets a 404. It isn't locked: the game host
            serves a published browser game to anyone who has its address.
        visibility_chosen_at:
          type:
            - string
            - 'null'
          description: >-
            When someone last set `visibility` on purpose, for its org: what to
            send back with a change that depends on nobody having done that
            since
        opening:
          type:
            - object
            - 'null'
          properties:
            status:
              type: string
              enum:
                - scanning
                - secrets_found
                - big_files_unread
                - failed
            says:
              type: string
              description: Where it's got to, to pass on to the person
            found:
              type: array
              items:
                type: object
                properties:
                  kind:
                    type: string
                    example: an AWS access key
                  path:
                    type:
                      - string
                      - 'null'
                    description: Null for a commit's message.
                  line:
                    type: integer
                    minimum: 1
                  commit:
                    type:
                      - string
                      - 'null'
                required:
                  - kind
                  - path
                  - line
                  - commit
              description: >-
                What a later push brought that closed it, as Patch read that
                push, and never a secret's value. Empty for a first push's hold,
                and for a push Patch couldn't read all of.
            was_open:
              type: boolean
              description: >-
                Whether it was open until a later push closed it. With nothing
                in `found`, that's for what Patch couldn't read of the push.
          required:
            - status
            - says
            - found
            - was_open
          description: >-
            For the repo's org. A repo that was open when its first push landed
            stays closed source until a scan of its history is clean, and then
            opens by itself, and so does an open repo that a later push closed
            by bringing a secret, or something Patch couldn't read. This says
            where that's got to. Null for anyone else, and for a repo that isn't
            waiting.
        can_read_source:
          type: boolean
          description: >-
            Whether you can read its source. When false, as for someone outside
            a closed source repo's org, `head_commit`, `last_commit` and
            `readme` are null, and its file, tree and commit reads answer 403
            `source_closed`.
        default_branch:
          type: string
          example: main
        created_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When the repo was made; null until its first push.
        head_commit:
          type:
            - string
            - 'null'
          description: The default branch's latest commit, as of the last push.
        pushed_at:
          type:
            - string
            - 'null'
          format: date-time
        forked_from:
          type:
            - string
            - 'null'
          description: The repo it was forked from, as owner/slug.
          example: patch/demo-mod
        fork_count:
          type: integer
          description: >-
            Its forks anyone can see: open ones with a repo, each once it has a
            public release. Until then a fork is quiet, and nothing counts it.
        clone_count:
          type: integer
          description: >-
            Fresh clones by people outside its org, each cloner counted once a
            day, as the git host saw them.
        training_opt_out:
          type: boolean
          description: When true, Patch doesn't train its own models on this project.
        change_requests:
          type: boolean
          description: >-
            The owner's switch for change requests. Only open repos take them,
            so it does nothing while the repo isn't open.
        open_change_requests:
          type: integer
          description: >-
            How many change requests are open, for whoever can read its source:
            0 for anyone else.
        last_commit:
          type:
            - object
            - 'null'
          properties:
            id:
              type: string
            subject:
              type: string
              description: Its message's first line
            author:
              type: string
            committed_at:
              type: string
              format: date-time
          required:
            - id
            - subject
            - author
            - committed_at
          description: >-
            The default branch's latest commit, as read after the push that
            moved it.
        readme:
          type:
            - object
            - 'null'
          properties:
            path:
              type: string
              example: README.md
            text:
              type: string
          required:
            - path
            - text
          description: >-
            The README at the top of the default branch, its first 128 KB; null
            when there's none.
        readme_pictures:
          type: array
          items:
            type: object
            properties:
              url:
                type: string
                format: uri
                description: The file, as the README writes its address.
              levels:
                $ref: '#/components/schemas/MediaLevels'
              fit:
                type: string
                enum:
                  - cover
                  - contain
                  - pixel
                  - wave
                description: >-
                  How it sits in a card's frame. cover: fills it. contain: a
                  thing on nothing, whole, on the frame's ground. pixel: the
                  same, with its pixels kept sharp. wave: a sound's waveform,
                  across the frame.
            required:
              - url
              - levels
              - fit
          description: >-
            The pictures in a library repo's README, which Patch holds copies
            of, so a page can show them at their levels. Empty for any other
            repo, and for anyone who can't read its source.
        home:
          type: string
          enum:
            - patch
            - github
          description: >-
            Where its repo lives, where connecting GitHub is on (and only
            there): `patch`, or `github` once a GitHub repo is connected to it,
            whose files and commits stay on GitHub. `clone_url` is the same
            either way.
        github:
          type:
            - object
            - 'null'
          properties:
            full_name:
              type: string
              example: sam/sky-mod
            html_url:
              type: string
              format: uri
              example: https://github.com/sam/sky-mod
            private:
              type: boolean
              description: Whether it's private on GitHub
            default_branch:
              type: string
              example: main
            head_commit:
              type:
                - string
                - 'null'
              description: >-
                The default branch's latest commit, as of GitHub's last push
                event
            pushed_at:
              type:
                - string
                - 'null'
              format: date-time
            state:
              type: string
              enum:
                - connected
                - disconnected
                - gone
                - suspended
                - no_access
              description: >-
                connected. disconnected: someone disconnected it on Patch, or it
                moved to an account without Patch's GitHub App. gone: deleted
                from GitHub. suspended: the app is suspended on its account.
                no_access: the app no longer reaches it (uninstalled, or the
                repo was taken out of the installation).
          required:
            - full_name
            - html_url
            - private
            - default_branch
          description: >-
            The GitHub repo that's its home, with `home`. Null on Patch, and for
            someone outside the project's org when the repo is private on
            GitHub.
      required:
        - name
        - summary
        - code_license
        - art_license
        - clone_url
        - visibility
        - opening
        - can_read_source
        - default_branch
        - created_at
        - head_commit
        - pushed_at
        - forked_from
        - fork_count
        - clone_count
        - training_opt_out
        - change_requests
        - open_change_requests
        - last_commit
        - readme
        - readme_pictures
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: version_exists
            message:
              type: string
            details: {}
          required:
            - code
            - message
      required:
        - error
    MediaLevels:
      type: array
      items:
        type: object
        properties:
          width:
            type: integer
          url:
            type: string
        required:
          - width
          - url
      description: >-
        Smaller copies of a picture (WebP) or a clip (MP4, H.264, without
        sound), smallest first, each at its own address that never changes. Show
        the smallest that's sharp where it goes. Empty for animated pictures,
        for flat art and short clips with no smaller copy, and for media from
        before Patch made copies until theirs are made: then use the file
        itself.
  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.