openapi: 3.0.3 info: title: Codeberg API (Forgejo) Git Content API description: 'Core subset of the Forgejo/Gitea-compatible REST API exposed by Codeberg, the community-run non-profit Git hosting platform, at https://codeberg.org/api/v1. Codeberg runs Forgejo (a community fork of Gitea); the reported application version at review time was 15.0.0-209+gitea-1.22.0. This document captures the core repository, issue, pull request, release, Git content, user, and organization paths. It is a representative subset - the full, authoritative machine-readable specification is served live by Codeberg at https://codeberg.org/swagger.v1.json (interactive UI at https://codeberg.org/api/swagger). Authenticate with a personal access token sent as `Authorization: token YOUR_TOKEN`, or via OAuth2.' version: 15.0.0 contact: name: Codeberg url: https://codeberg.org license: name: MIT (Forgejo software) url: https://forgejo.org/ servers: - url: https://codeberg.org/api/v1 description: Codeberg production security: - AuthorizationHeaderToken: [] tags: - name: Git Content description: Read and write repository files, list commits, and read the Git tree. paths: /repos/{owner}/{repo}/contents/{filepath}: get: operationId: repoGetContents tags: - Git Content summary: Gets the metadata and contents (if a file) of an entry in a repository, or a list of entries if a dir parameters: - $ref: '#/components/parameters/owner' - $ref: '#/components/parameters/repo' - $ref: '#/components/parameters/filepath' responses: '200': description: File or directory contents. post: operationId: repoCreateFile tags: - Git Content summary: Create a file in a repository parameters: - $ref: '#/components/parameters/owner' - $ref: '#/components/parameters/repo' - $ref: '#/components/parameters/filepath' responses: '201': description: The created file. put: operationId: repoUpdateFile tags: - Git Content summary: Update a file in a repository parameters: - $ref: '#/components/parameters/owner' - $ref: '#/components/parameters/repo' - $ref: '#/components/parameters/filepath' responses: '200': description: The updated file. delete: operationId: repoDeleteFile tags: - Git Content summary: Delete a file in a repository parameters: - $ref: '#/components/parameters/owner' - $ref: '#/components/parameters/repo' - $ref: '#/components/parameters/filepath' responses: '200': description: The file was deleted. /repos/{owner}/{repo}/raw/{filepath}: get: operationId: repoGetRawFile tags: - Git Content summary: Get a file from a repository parameters: - $ref: '#/components/parameters/owner' - $ref: '#/components/parameters/repo' - $ref: '#/components/parameters/filepath' responses: '200': description: Raw file bytes. /repos/{owner}/{repo}/commits: get: operationId: repoGetAllCommits tags: - Git Content summary: Get a list of all commits from a repository parameters: - $ref: '#/components/parameters/owner' - $ref: '#/components/parameters/repo' responses: '200': description: A list of commits. /repos/{owner}/{repo}/git/trees/{sha}: get: operationId: getTree tags: - Git Content summary: Gets the tree of a repository parameters: - $ref: '#/components/parameters/owner' - $ref: '#/components/parameters/repo' - name: sha in: path required: true description: SHA of the commit or tree. schema: type: string responses: '200': description: The Git tree. components: parameters: repo: name: repo in: path required: true description: Name of the repository. schema: type: string filepath: name: filepath in: path required: true description: Path of the file or directory within the repository. schema: type: string owner: name: owner in: path required: true description: Owner of the repository (user or organization). schema: type: string securitySchemes: AuthorizationHeaderToken: type: apiKey in: header name: Authorization description: 'Personal access token. Must be prepended with the word "token" followed by a space, e.g. `Authorization: token YOUR_TOKEN`.'