openapi: 3.0.3 info: title: Gitee Open API v5 (core subset) description: >- A curated, representative subset of the Gitee (码云) Open API v5, the documented REST API of the China-based Git hosting and DevOps platform operated by OSChina / Shenzhen Oschina (开源中国). Every path in this document is grounded in Gitee's live Swagger definition at https://gitee.com/api/v5/swagger_doc.json (Gitee Open API version 5.4.92 as observed on 2026-07-12); the authoritative, complete machine-readable spec (175 paths / 264 operations across Repositories, Issues, Pull Requests, Users, Organizations, Gists, Enterprises, Webhooks, Labels, Milestones, Activity, Git Data, Search, and more) lives there. This subset captures the core representative operations per resource group. Requests authenticate with a personal access token supplied either as an `access_token` query parameter or an `Authorization: Bearer ` header, or via OAuth2. English endpoint summaries below are translated from the Chinese summaries in the source spec. version: '5.4.92' contact: name: Gitee url: https://gitee.com servers: - url: https://gitee.com/api/v5 description: Gitee Open API v5 (production) security: - accessTokenQuery: [] - bearerAuth: [] - oauth2: - projects tags: - name: Repositories description: Repositories and their contents - branches, tags, commits, contents, forks. - name: Issues description: Issue tracking - issues, comments, labels, milestones. - name: Pull Requests description: Pull requests - create, review, merge, and inspect changes. - name: Users description: The authenticated user, keys, followers, and following. - name: Organizations description: Organizations and their members. - name: Gists description: Code snippets (gists) and their comments. - name: Enterprises description: Gitee Enterprise Edition - enterprises, members, weekly reports. - name: Webhooks description: Repository WebHooks (outbound HTTP event callbacks). - name: Search description: Search across repositories, issues, and users. paths: /user: get: operationId: getAuthenticatedUser tags: [Users] summary: Get the authenticated user's profile responses: '200': description: The authenticated user. content: application/json: schema: { $ref: '#/components/schemas/User' } '401': { $ref: '#/components/responses/Unauthorized' } /user/keys: get: operationId: listUserKeys tags: [Users] summary: List the authenticated user's SSH public keys responses: '200': description: A list of SSH public keys. content: application/json: schema: type: array items: { $ref: '#/components/schemas/SshKey' } '401': { $ref: '#/components/responses/Unauthorized' } post: operationId: createUserKey tags: [Users] summary: Add an SSH public key for the authenticated user requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/SshKeyInput' } responses: '201': description: The created SSH public key. content: application/json: schema: { $ref: '#/components/schemas/SshKey' } '401': { $ref: '#/components/responses/Unauthorized' } /user/repos: get: operationId: listUserRepos tags: [Repositories] summary: List repositories the authenticated user owns or has access to parameters: - { name: page, in: query, schema: { type: integer, default: 1 } } - { name: per_page, in: query, schema: { type: integer, default: 20, maximum: 100 } } responses: '200': description: A list of repositories. content: application/json: schema: type: array items: { $ref: '#/components/schemas/Repository' } '401': { $ref: '#/components/responses/Unauthorized' } post: operationId: createUserRepo tags: [Repositories] summary: Create a repository for the authenticated user requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/RepositoryInput' } responses: '201': description: The created repository. content: application/json: schema: { $ref: '#/components/schemas/Repository' } '401': { $ref: '#/components/responses/Unauthorized' } /repos/{owner}/{repo}: parameters: - { $ref: '#/components/parameters/Owner' } - { $ref: '#/components/parameters/Repo' } get: operationId: getRepo tags: [Repositories] summary: Get a single repository responses: '200': description: The requested repository. content: application/json: schema: { $ref: '#/components/schemas/Repository' } '404': { $ref: '#/components/responses/NotFound' } patch: operationId: updateRepo tags: [Repositories] summary: Update repository settings requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/RepositoryInput' } responses: '200': description: The updated repository. content: application/json: schema: { $ref: '#/components/schemas/Repository' } '401': { $ref: '#/components/responses/Unauthorized' } /repos/{owner}/{repo}/branches: parameters: - { $ref: '#/components/parameters/Owner' } - { $ref: '#/components/parameters/Repo' } get: operationId: listBranches tags: [Repositories] summary: List all branches responses: '200': description: A list of branches. content: application/json: schema: type: array items: { $ref: '#/components/schemas/Branch' } post: operationId: createBranch tags: [Repositories] summary: Create a branch requestBody: required: true content: application/json: schema: type: object required: [refs, branch_name] properties: refs: { type: string, description: Source branch or ref. } branch_name: { type: string, description: New branch name. } responses: '201': description: The created branch. content: application/json: schema: { $ref: '#/components/schemas/Branch' } '401': { $ref: '#/components/responses/Unauthorized' } /repos/{owner}/{repo}/tags: parameters: - { $ref: '#/components/parameters/Owner' } - { $ref: '#/components/parameters/Repo' } get: operationId: listTags tags: [Repositories] summary: List all tags of a repository responses: '200': description: A list of tags. content: application/json: schema: type: array items: { type: object, additionalProperties: true } /repos/{owner}/{repo}/commits: parameters: - { $ref: '#/components/parameters/Owner' } - { $ref: '#/components/parameters/Repo' } get: operationId: listCommits tags: [Repositories] summary: List a repository's commits parameters: - { name: sha, in: query, schema: { type: string }, description: Branch, tag, or SHA to start from. } - { name: page, in: query, schema: { type: integer, default: 1 } } - { name: per_page, in: query, schema: { type: integer, default: 20, maximum: 100 } } responses: '200': description: A list of commits. content: application/json: schema: type: array items: { type: object, additionalProperties: true } /repos/{owner}/{repo}/issues: parameters: - { $ref: '#/components/parameters/Owner' } - { $ref: '#/components/parameters/Repo' } get: operationId: listRepoIssues tags: [Issues] summary: List all issues of a repository parameters: - { name: state, in: query, schema: { type: string, enum: [open, progressing, closed, rejected, all], default: open } } - { name: page, in: query, schema: { type: integer, default: 1 } } - { name: per_page, in: query, schema: { type: integer, default: 20, maximum: 100 } } responses: '200': description: A list of issues. content: application/json: schema: type: array items: { $ref: '#/components/schemas/Issue' } /repos/{owner}/issues: parameters: - { $ref: '#/components/parameters/Owner' } post: operationId: createIssue tags: [Issues] summary: Create an issue (issues belong to an owner, assigned to a repo) requestBody: required: true content: application/json: schema: type: object required: [repo, title] properties: repo: { type: string, description: Repository path. } title: { type: string } body: { type: string } responses: '201': description: The created issue. content: application/json: schema: { $ref: '#/components/schemas/Issue' } '401': { $ref: '#/components/responses/Unauthorized' } /repos/{owner}/issues/{number}: parameters: - { $ref: '#/components/parameters/Owner' } - { name: number, in: path, required: true, schema: { type: string }, description: The issue number. } patch: operationId: updateIssue tags: [Issues] summary: Update an issue requestBody: required: true content: application/json: schema: type: object properties: repo: { type: string } title: { type: string } state: { type: string, enum: [open, progressing, closed, rejected] } body: { type: string } responses: '200': description: The updated issue. content: application/json: schema: { $ref: '#/components/schemas/Issue' } '401': { $ref: '#/components/responses/Unauthorized' } /repos/{owner}/{repo}/issues/{number}/comments: parameters: - { $ref: '#/components/parameters/Owner' } - { $ref: '#/components/parameters/Repo' } - { name: number, in: path, required: true, schema: { type: string }, description: The issue number. } get: operationId: listIssueComments tags: [Issues] summary: List all comments on an issue responses: '200': description: A list of issue comments. content: application/json: schema: type: array items: { type: object, additionalProperties: true } post: operationId: createIssueComment tags: [Issues] summary: Create a comment on an issue requestBody: required: true content: application/json: schema: type: object required: [body] properties: body: { type: string } responses: '201': description: The created comment. content: application/json: schema: { type: object, additionalProperties: true } '401': { $ref: '#/components/responses/Unauthorized' } /repos/{owner}/{repo}/labels: parameters: - { $ref: '#/components/parameters/Owner' } - { $ref: '#/components/parameters/Repo' } get: operationId: listRepoLabels tags: [Issues] summary: List all task labels in a repository responses: '200': description: A list of labels. content: application/json: schema: type: array items: { type: object, additionalProperties: true } /repos/{owner}/{repo}/milestones: parameters: - { $ref: '#/components/parameters/Owner' } - { $ref: '#/components/parameters/Repo' } get: operationId: listMilestones tags: [Issues] summary: List all milestones in a repository responses: '200': description: A list of milestones. content: application/json: schema: type: array items: { type: object, additionalProperties: true } /repos/{owner}/{repo}/pulls: parameters: - { $ref: '#/components/parameters/Owner' } - { $ref: '#/components/parameters/Repo' } get: operationId: listPullRequests tags: [Pull Requests] summary: List pull requests parameters: - { name: state, in: query, schema: { type: string, enum: [open, closed, merged, all], default: open } } - { name: page, in: query, schema: { type: integer, default: 1 } } - { name: per_page, in: query, schema: { type: integer, default: 20, maximum: 100 } } responses: '200': description: A list of pull requests. content: application/json: schema: type: array items: { $ref: '#/components/schemas/PullRequest' } post: operationId: createPullRequest tags: [Pull Requests] summary: Create a pull request requestBody: required: true content: application/json: schema: type: object required: [title, head, base] properties: title: { type: string } head: { type: string, description: Source branch. } base: { type: string, description: Target branch. } body: { type: string } responses: '201': description: The created pull request. content: application/json: schema: { $ref: '#/components/schemas/PullRequest' } '401': { $ref: '#/components/responses/Unauthorized' } /repos/{owner}/{repo}/pulls/{number}: parameters: - { $ref: '#/components/parameters/Owner' } - { $ref: '#/components/parameters/Repo' } - { name: number, in: path, required: true, schema: { type: integer }, description: The pull request number. } get: operationId: getPullRequest tags: [Pull Requests] summary: Get a single pull request responses: '200': description: The requested pull request. content: application/json: schema: { $ref: '#/components/schemas/PullRequest' } '404': { $ref: '#/components/responses/NotFound' } /repos/{owner}/{repo}/pulls/{number}/merge: parameters: - { $ref: '#/components/parameters/Owner' } - { $ref: '#/components/parameters/Repo' } - { name: number, in: path, required: true, schema: { type: integer }, description: The pull request number. } get: operationId: isPullRequestMerged tags: [Pull Requests] summary: Check whether a pull request has been merged responses: '204': { description: The pull request has been merged. } '404': { description: The pull request has not been merged. } put: operationId: mergePullRequest tags: [Pull Requests] summary: Merge a pull request requestBody: required: false content: application/json: schema: type: object properties: merge_method: { type: string, enum: [merge, squash, rebase] } responses: '200': description: The pull request was merged. '401': { $ref: '#/components/responses/Unauthorized' } /repos/{owner}/{repo}/pulls/{number}/files: parameters: - { $ref: '#/components/parameters/Owner' } - { $ref: '#/components/parameters/Repo' } - { name: number, in: path, required: true, schema: { type: integer }, description: The pull request number. } get: operationId: listPullRequestFiles tags: [Pull Requests] summary: List the changed files of a pull request (up to 300 diffs) responses: '200': description: A list of changed files. content: application/json: schema: type: array items: { type: object, additionalProperties: true } /user/orgs: get: operationId: listUserOrgs tags: [Organizations] summary: List organizations the authenticated user belongs to responses: '200': description: A list of organizations. content: application/json: schema: type: array items: { $ref: '#/components/schemas/Organization' } '401': { $ref: '#/components/responses/Unauthorized' } /orgs/{org}: parameters: - { name: org, in: path, required: true, schema: { type: string }, description: The organization path. } get: operationId: getOrg tags: [Organizations] summary: Get a single organization responses: '200': description: The requested organization. content: application/json: schema: { $ref: '#/components/schemas/Organization' } '404': { $ref: '#/components/responses/NotFound' } /orgs/{org}/members: parameters: - { name: org, in: path, required: true, schema: { type: string }, description: The organization path. } get: operationId: listOrgMembers tags: [Organizations] summary: List all members of an organization responses: '200': description: A list of members. content: application/json: schema: type: array items: { $ref: '#/components/schemas/User' } /gists: get: operationId: listGists tags: [Gists] summary: List the authenticated user's gists (code snippets) responses: '200': description: A list of gists. content: application/json: schema: type: array items: { $ref: '#/components/schemas/Gist' } '401': { $ref: '#/components/responses/Unauthorized' } post: operationId: createGist tags: [Gists] summary: Create a gist (code snippet) requestBody: required: true content: application/json: schema: type: object required: [files] properties: files: type: object additionalProperties: true description: Map of filename to { content }. description: { type: string } public: { type: boolean } responses: '201': description: The created gist. content: application/json: schema: { $ref: '#/components/schemas/Gist' } '401': { $ref: '#/components/responses/Unauthorized' } /gists/{id}: parameters: - { name: id, in: path, required: true, schema: { type: string }, description: The gist ID. } get: operationId: getGist tags: [Gists] summary: Get a single gist responses: '200': description: The requested gist. content: application/json: schema: { $ref: '#/components/schemas/Gist' } '404': { $ref: '#/components/responses/NotFound' } delete: operationId: deleteGist tags: [Gists] summary: Delete a gist responses: '204': { description: The gist was deleted. } '401': { $ref: '#/components/responses/Unauthorized' } /user/enterprises: get: operationId: listUserEnterprises tags: [Enterprises] summary: List enterprises the authenticated user belongs to responses: '200': description: A list of enterprises. content: application/json: schema: type: array items: { type: object, additionalProperties: true } '401': { $ref: '#/components/responses/Unauthorized' } /enterprises/{enterprise}: parameters: - { name: enterprise, in: path, required: true, schema: { type: string }, description: The enterprise path. } get: operationId: getEnterprise tags: [Enterprises] summary: Get a single enterprise responses: '200': description: The requested enterprise. content: application/json: schema: { type: object, additionalProperties: true } '404': { $ref: '#/components/responses/NotFound' } /enterprises/{enterprise}/members: parameters: - { name: enterprise, in: path, required: true, schema: { type: string }, description: The enterprise path. } get: operationId: listEnterpriseMembers tags: [Enterprises] summary: List all members of an enterprise responses: '200': description: A list of enterprise members. content: application/json: schema: type: array items: { type: object, additionalProperties: true } post: operationId: addEnterpriseMember tags: [Enterprises] summary: Add or invite an enterprise member requestBody: required: true content: application/json: schema: type: object properties: username: { type: string } email: { type: string } role: { type: string } responses: '201': description: The member was added or invited. '401': { $ref: '#/components/responses/Unauthorized' } /repos/{owner}/{repo}/hooks: parameters: - { $ref: '#/components/parameters/Owner' } - { $ref: '#/components/parameters/Repo' } get: operationId: listRepoHooks tags: [Webhooks] summary: List a repository's WebHooks responses: '200': description: A list of webhooks. content: application/json: schema: type: array items: { $ref: '#/components/schemas/Webhook' } post: operationId: createRepoHook tags: [Webhooks] summary: Create a repository WebHook requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/WebhookInput' } responses: '201': description: The created webhook. content: application/json: schema: { $ref: '#/components/schemas/Webhook' } '401': { $ref: '#/components/responses/Unauthorized' } /repos/{owner}/{repo}/hooks/{id}/tests: parameters: - { $ref: '#/components/parameters/Owner' } - { $ref: '#/components/parameters/Repo' } - { name: id, in: path, required: true, schema: { type: integer }, description: The webhook ID. } post: operationId: testRepoHook tags: [Webhooks] summary: Send a test delivery for a WebHook responses: '204': { description: The test delivery was sent. } '401': { $ref: '#/components/responses/Unauthorized' } /search/repositories: get: operationId: searchRepositories tags: [Search] summary: Search repositories parameters: - { name: q, in: query, required: true, schema: { type: string }, description: Search keyword. } - { name: page, in: query, schema: { type: integer, default: 1 } } - { name: per_page, in: query, schema: { type: integer, default: 20, maximum: 100 } } responses: '200': description: Matching repositories. content: application/json: schema: type: array items: { $ref: '#/components/schemas/Repository' } /search/issues: get: operationId: searchIssues tags: [Search] summary: Search issues parameters: - { name: q, in: query, required: true, schema: { type: string }, description: Search keyword. } responses: '200': description: Matching issues. content: application/json: schema: type: array items: { $ref: '#/components/schemas/Issue' } /search/users: get: operationId: searchUsers tags: [Search] summary: Search users parameters: - { name: q, in: query, required: true, schema: { type: string }, description: Search keyword. } responses: '200': description: Matching users. content: application/json: schema: type: array items: { $ref: '#/components/schemas/User' } components: securitySchemes: accessTokenQuery: type: apiKey in: query name: access_token description: >- Personal access token passed as the `access_token` query parameter. Present on the large majority of Gitee v5 operations. bearerAuth: type: http scheme: bearer description: >- Personal access token passed as `Authorization: Bearer `. oauth2: type: oauth2 description: >- Gitee OAuth2. Authorize at https://gitee.com/oauth/authorize and exchange for a token at https://gitee.com/oauth/token. flows: authorizationCode: authorizationUrl: https://gitee.com/oauth/authorize tokenUrl: https://gitee.com/oauth/token refreshUrl: https://gitee.com/oauth/token scopes: user_info: Read the user's profile. projects: Read and manage repositories. pull_requests: Read and manage pull requests. issues: Read and manage issues. notes: Read and manage comments. keys: Read and manage SSH keys. hook: Read and manage webhooks. groups: Read and manage organizations. gists: Read and manage gists. enterprises: Read and manage enterprises. emails: Read the user's email addresses. parameters: Owner: name: owner in: path required: true description: The repository owner (user or organization path). schema: { type: string } Repo: name: repo in: path required: true description: The repository path. schema: { type: string } responses: Unauthorized: description: Missing or invalid access token. content: application/json: schema: { $ref: '#/components/schemas/Error' } NotFound: description: The requested resource was not found. content: application/json: schema: { $ref: '#/components/schemas/Error' } schemas: Error: type: object properties: message: { type: string } User: type: object properties: id: { type: integer } login: { type: string } name: { type: string } html_url: { type: string } avatar_url: { type: string } type: { type: string } SshKeyInput: type: object required: [key] properties: key: { type: string } title: { type: string } SshKey: allOf: - { $ref: '#/components/schemas/SshKeyInput' } - type: object properties: id: { type: integer } created_at: { type: string, format: date-time } RepositoryInput: type: object required: [name] properties: name: { type: string } description: { type: string } private: { type: boolean } has_issues: { type: boolean } has_wiki: { type: boolean } Repository: type: object properties: id: { type: integer } full_name: { type: string } human_name: { type: string } path: { type: string } name: { type: string } owner: { $ref: '#/components/schemas/User' } description: { type: string } private: { type: boolean } html_url: { type: string } stargazers_count: { type: integer } forks_count: { type: integer } Branch: type: object properties: name: { type: string } protected: { type: boolean } commit: { type: object, additionalProperties: true } Issue: type: object properties: id: { type: integer } number: { type: string } title: { type: string } state: { type: string } body: { type: string } user: { $ref: '#/components/schemas/User' } created_at: { type: string, format: date-time } PullRequest: type: object properties: id: { type: integer } number: { type: integer } title: { type: string } state: { type: string } body: { type: string } html_url: { type: string } head: { type: object, additionalProperties: true } base: { type: object, additionalProperties: true } mergeable: { type: boolean } Organization: type: object properties: id: { type: integer } login: { type: string } name: { type: string } url: { type: string } Gist: type: object properties: id: { type: string } description: { type: string } public: { type: boolean } html_url: { type: string } files: { type: object, additionalProperties: true } created_at: { type: string, format: date-time } WebhookInput: type: object required: [url] properties: url: { type: string, description: The endpoint Gitee posts events to. } password: { type: string } push_events: { type: boolean } issues_events: { type: boolean } merge_requests_events: { type: boolean } Webhook: allOf: - { $ref: '#/components/schemas/WebhookInput' } - type: object properties: id: { type: integer } created_at: { type: string, format: date-time }