Forgejo admin API
The admin API from Forgejo — 34 operation(s) for admin.
The admin API from Forgejo — 34 operation(s) for admin.
swagger: '2.0'
info:
description: This documentation describes the Forgejo API.
title: Forgejo activitypub admin API
license:
name: This file is distributed under the MIT license for the purpose of interoperability
url: http://opensource.org/licenses/MIT
version: 16.0.0-dev-465-4b83448b7d+gitea-1.22.0
basePath: /api/v1
schemes:
- https
- http
consumes:
- application/json
- text/plain
produces:
- application/json
- text/html
security:
- BasicAuth: []
- AuthorizationHeaderToken: []
- SudoParam: []
- SudoHeader: []
- TOTPHeader: []
tags:
- name: admin
paths:
/admin/actions/runners:
get:
produces:
- application/json
tags:
- admin
summary: Get all runners, no matter whether they are global runners or scoped to an organization, user, or repository
operationId: getAdminRunners
parameters:
- type: boolean
description: whether to include all visible runners (true) or only those that are directly owned by the instance (false)
name: visible
in: query
- type: integer
description: page number of results to return (1-based)
name: page
in: query
- type: integer
description: page size of results
name: limit
in: query
responses:
'200':
$ref: '#/responses/ActionRunnerList'
'400':
$ref: '#/responses/error'
'404':
$ref: '#/responses/notFound'
post:
consumes:
- application/json
produces:
- application/json
tags:
- admin
summary: Register a new global runner
operationId: registerAdminRunner
parameters:
- name: body
in: body
schema:
$ref: '#/definitions/RegisterRunnerOptions'
responses:
'201':
$ref: '#/responses/RegisterRunnerResponse'
'400':
$ref: '#/responses/error'
'401':
$ref: '#/responses/unauthorized'
'404':
$ref: '#/responses/notFound'
/admin/actions/runners/jobs:
get:
produces:
- application/json
tags:
- admin
summary: Get action run jobs
operationId: adminGetActionRunJobs
parameters:
- type: string
description: a comma separated list of labels to search for
name: labels
in: query
responses:
'200':
$ref: '#/responses/RunJobList'
'403':
$ref: '#/responses/forbidden'
/admin/actions/runners/registration-token:
get:
description: 'This operation has been deprecated in Forgejo 15. Use the web UI or [`/admin/actions/runners`](#/admin/registerAdminRunner) instead.
'
produces:
- application/json
tags:
- admin
summary: Get a runner registration token for registering global runners
operationId: adminGetRunnerRegistrationToken
deprecated: true
responses:
'200':
$ref: '#/responses/RegistrationToken'
/admin/actions/runners/{runner_id}:
get:
produces:
- application/json
tags:
- admin
summary: Get a particular runner, no matter whether it is a global runner or scoped to an organization, user, or repository
operationId: getAdminRunner
parameters:
- type: string
description: ID of the runner
name: runner_id
in: path
required: true
responses:
'200':
$ref: '#/responses/ActionRunner'
'400':
$ref: '#/responses/error'
'404':
$ref: '#/responses/notFound'
delete:
produces:
- application/json
tags:
- admin
summary: Delete a particular runner, no matter whether it is a global runner or scoped to an organization, user, or repository
operationId: deleteAdminRunner
parameters:
- type: string
description: ID of the runner
name: runner_id
in: path
required: true
responses:
'204':
description: runner has been deleted
'400':
$ref: '#/responses/error'
'404':
$ref: '#/responses/notFound'
/admin/cron:
get:
produces:
- application/json
tags:
- admin
summary: List cron tasks
operationId: adminCronList
parameters:
- type: integer
description: page number of results to return (1-based)
name: page
in: query
- type: integer
description: page size of results
name: limit
in: query
responses:
'200':
$ref: '#/responses/CronList'
'403':
$ref: '#/responses/forbidden'
/admin/cron/{task}:
post:
produces:
- application/json
tags:
- admin
summary: Run cron task
operationId: adminCronRun
parameters:
- type: string
description: task to run
name: task
in: path
required: true
responses:
'204':
$ref: '#/responses/empty'
'404':
$ref: '#/responses/notFound'
/admin/emails:
get:
produces:
- application/json
tags:
- admin
summary: List all users' email addresses
operationId: adminGetAllEmails
parameters:
- type: integer
description: page number of results to return (1-based)
name: page
in: query
- type: integer
description: page size of results
name: limit
in: query
responses:
'200':
$ref: '#/responses/EmailList'
'403':
$ref: '#/responses/forbidden'
/admin/emails/search:
get:
produces:
- application/json
tags:
- admin
summary: Search users' email addresses
operationId: adminSearchEmails
parameters:
- type: string
description: keyword
name: q
in: query
- type: integer
description: page number of results to return (1-based)
name: page
in: query
- type: integer
description: page size of results
name: limit
in: query
responses:
'200':
$ref: '#/responses/EmailList'
'403':
$ref: '#/responses/forbidden'
/admin/hooks:
get:
produces:
- application/json
tags:
- admin
summary: List global (system) webhooks
operationId: adminListHooks
parameters:
- type: integer
description: page number of results to return (1-based)
name: page
in: query
- type: integer
description: page size of results
name: limit
in: query
responses:
'200':
$ref: '#/responses/HookListWithoutPagination'
post:
consumes:
- application/json
produces:
- application/json
tags:
- admin
summary: Create a hook
operationId: adminCreateHook
parameters:
- name: body
in: body
required: true
schema:
$ref: '#/definitions/CreateHookOption'
responses:
'201':
$ref: '#/responses/Hook'
/admin/hooks/{id}:
get:
produces:
- application/json
tags:
- admin
summary: Get a hook
operationId: adminGetHook
parameters:
- type: integer
format: int64
description: id of the hook to get
name: id
in: path
required: true
responses:
'200':
$ref: '#/responses/Hook'
delete:
produces:
- application/json
tags:
- admin
summary: Delete a hook
operationId: adminDeleteHook
parameters:
- type: integer
format: int64
description: id of the hook to delete
name: id
in: path
required: true
responses:
'204':
$ref: '#/responses/empty'
patch:
consumes:
- application/json
produces:
- application/json
tags:
- admin
summary: Update a hook
operationId: adminEditHook
parameters:
- type: integer
format: int64
description: id of the hook to update
name: id
in: path
required: true
- name: body
in: body
schema:
$ref: '#/definitions/EditHookOption'
responses:
'200':
$ref: '#/responses/Hook'
/admin/orgs:
get:
produces:
- application/json
tags:
- admin
summary: List all organizations
operationId: adminGetAllOrgs
parameters:
- type: integer
description: page number of results to return (1-based)
name: page
in: query
- type: integer
description: page size of results
name: limit
in: query
responses:
'200':
$ref: '#/responses/OrganizationList'
'403':
$ref: '#/responses/forbidden'
/admin/quota/groups:
get:
produces:
- application/json
tags:
- admin
summary: List the available quota groups
operationId: adminListQuotaGroups
responses:
'200':
$ref: '#/responses/QuotaGroupList'
'403':
$ref: '#/responses/forbidden'
post:
produces:
- application/json
tags:
- admin
summary: Create a new quota group
operationId: adminCreateQuotaGroup
parameters:
- description: Definition of the quota group
name: group
in: body
required: true
schema:
$ref: '#/definitions/CreateQuotaGroupOptions'
responses:
'201':
$ref: '#/responses/QuotaGroup'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'409':
$ref: '#/responses/error'
'422':
$ref: '#/responses/validationError'
/admin/quota/groups/{quotagroup}:
get:
produces:
- application/json
tags:
- admin
summary: Get information about the quota group
operationId: adminGetQuotaGroup
parameters:
- type: string
description: quota group to query
name: quotagroup
in: path
required: true
responses:
'200':
$ref: '#/responses/QuotaGroup'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
delete:
produces:
- application/json
tags:
- admin
summary: Delete a quota group
operationId: adminDeleteQuotaGroup
parameters:
- type: string
description: quota group to delete
name: quotagroup
in: path
required: true
responses:
'204':
$ref: '#/responses/empty'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
/admin/quota/groups/{quotagroup}/rules/{quotarule}:
put:
produces:
- application/json
tags:
- admin
summary: Adds a rule to a quota group
operationId: adminAddRuleToQuotaGroup
parameters:
- type: string
description: quota group to add a rule to
name: quotagroup
in: path
required: true
- type: string
description: the name of the quota rule to add to the group
name: quotarule
in: path
required: true
responses:
'204':
$ref: '#/responses/empty'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
'409':
$ref: '#/responses/error'
'422':
$ref: '#/responses/validationError'
delete:
produces:
- application/json
tags:
- admin
summary: Removes a rule from a quota group
operationId: adminRemoveRuleFromQuotaGroup
parameters:
- type: string
description: quota group to remove a rule from
name: quotagroup
in: path
required: true
- type: string
description: the name of the quota rule to remove from the group
name: quotarule
in: path
required: true
responses:
'201':
$ref: '#/responses/empty'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
/admin/quota/groups/{quotagroup}/users:
get:
produces:
- application/json
tags:
- admin
summary: List users in a quota group
operationId: adminListUsersInQuotaGroup
parameters:
- type: string
description: quota group to list members of
name: quotagroup
in: path
required: true
responses:
'200':
$ref: '#/responses/UserList'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
/admin/quota/groups/{quotagroup}/users/{username}:
put:
produces:
- application/json
tags:
- admin
summary: Add a user to a quota group
operationId: adminAddUserToQuotaGroup
parameters:
- type: string
description: quota group to add the user to
name: quotagroup
in: path
required: true
- type: string
description: username of the user to add to the quota group
name: username
in: path
required: true
responses:
'204':
$ref: '#/responses/empty'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
'409':
$ref: '#/responses/error'
'422':
$ref: '#/responses/validationError'
delete:
produces:
- application/json
tags:
- admin
summary: Remove a user from a quota group
operationId: adminRemoveUserFromQuotaGroup
parameters:
- type: string
description: quota group to remove a user from
name: quotagroup
in: path
required: true
- type: string
description: username of the user to remove from the quota group
name: username
in: path
required: true
responses:
'204':
$ref: '#/responses/empty'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
/admin/quota/rules:
get:
produces:
- application/json
tags:
- admin
summary: List the available quota rules
operationId: adminListQuotaRules
responses:
'200':
$ref: '#/responses/QuotaRuleInfoList'
'403':
$ref: '#/responses/forbidden'
post:
produces:
- application/json
tags:
- admin
summary: Create a new quota rule
operationId: adminCreateQuotaRule
parameters:
- description: Definition of the quota rule
name: rule
in: body
required: true
schema:
$ref: '#/definitions/CreateQuotaRuleOptions'
responses:
'201':
$ref: '#/responses/QuotaRuleInfo'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'409':
$ref: '#/responses/error'
'422':
$ref: '#/responses/validationError'
/admin/quota/rules/{quotarule}:
get:
produces:
- application/json
tags:
- admin
summary: Get information about a quota rule
operationId: adminGetQuotaRule
parameters:
- type: string
description: quota rule to query
name: quotarule
in: path
required: true
responses:
'200':
$ref: '#/responses/QuotaRuleInfo'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
delete:
produces:
- application/json
tags:
- admin
summary: Deletes a quota rule
operationId: adminDeleteQuotaRule
parameters:
- type: string
description: quota rule to delete
name: quotarule
in: path
required: true
responses:
'204':
$ref: '#/responses/empty'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
patch:
produces:
- application/json
tags:
- admin
summary: Change an existing quota rule
operationId: adminEditQuotaRule
parameters:
- type: string
description: Quota rule to change
name: quotarule
in: path
required: true
- name: rule
in: body
required: true
schema:
$ref: '#/definitions/EditQuotaRuleOptions'
responses:
'200':
$ref: '#/responses/QuotaRuleInfo'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
'422':
$ref: '#/responses/validationError'
/admin/runners/jobs:
get:
description: 'This operation has been deprecated in Forgejo 15. Use [`/admin/actions/runners/jobs`](#/admin/adminGetActionRunJobs) instead.
'
produces:
- application/json
tags:
- admin
summary: Search action jobs according to filter conditions
operationId: adminSearchRunJobs
deprecated: true
parameters:
- type: string
description: a comma separated list of run job labels to search for
name: labels
in: query
responses:
'200':
$ref: '#/responses/RunJobList'
'403':
$ref: '#/responses/forbidden'
/admin/runners/registration-token:
get:
description: 'This operation has been deprecated in Forgejo 15. Use the web UI or [`/admin/actions/runners`](#/admin/registerAdminRunner) instead.
'
produces:
- application/json
tags:
- admin
summary: Get a runner registration token for registering global runners
operationId: adminGetRegistrationToken
deprecated: true
responses:
'200':
$ref: '#/responses/RegistrationToken'
/admin/unadopted:
get:
produces:
- application/json
tags:
- admin
summary: List unadopted repositories
operationId: adminUnadoptedList
parameters:
- type: integer
description: page number of results to return (1-based)
name: page
in: query
- type: integer
description: page size of results
name: limit
in: query
- type: string
description: pattern of repositories to search for
name: pattern
in: query
responses:
'200':
$ref: '#/responses/StringSlice'
'403':
$ref: '#/responses/forbidden'
/admin/unadopted/{owner}/{repo}:
post:
produces:
- application/json
tags:
- admin
summary: Adopt unadopted files as a repository
operationId: adminAdoptRepository
parameters:
- type: string
description: owner of the repo
name: owner
in: path
required: true
- type: string
description: name of the repo
name: repo
in: path
required: true
responses:
'204':
$ref: '#/responses/empty'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
delete:
produces:
- application/json
tags:
- admin
summary: Delete unadopted files
operationId: adminDeleteUnadoptedRepository
parameters:
- type: string
description: owner of the repo
name: owner
in: path
required: true
- type: string
description: name of the repo
name: repo
in: path
required: true
responses:
'204':
$ref: '#/responses/empty'
'403':
$ref: '#/responses/forbidden'
/admin/users:
get:
produces:
- application/json
tags:
- admin
summary: Search users according filter conditions
operationId: adminSearchUsers
parameters:
- type: integer
format: int64
description: ID of the user's login source to search for
name: source_id
in: query
- type: string
description: user's login name to search for
name: login_name
in: query
- type: boolean
description: whether or not to filter users with the 2fa enabled
name: is_2fa_enabled
in: query
- enum:
- oldest
- newest
- alphabetically
- reversealphabetically
- recentupdate
- leastupdate
type: string
description: sort order of results
name: sort
in: query
- type: integer
description: page number of results to return (1-based)
name: page
in: query
- type: integer
description: page size of results
name: limit
in: query
responses:
'200':
$ref: '#/responses/UserList'
'403':
$ref: '#/responses/forbidden'
post:
consumes:
- application/json
produces:
- application/json
tags:
- admin
summary: Create a user account
operationId: adminCreateUser
parameters:
- name: body
in: body
schema:
$ref: '#/definitions/CreateUserOption'
responses:
'201':
$ref: '#/responses/User'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'422':
$ref: '#/responses/validationError'
/admin/users/{username}:
delete:
produces:
- application/json
tags:
- admin
summary: Delete user account
operationId: adminDeleteUser
parameters:
- type: string
description: username of user to delete
name: username
in: path
required: true
- type: boolean
description: purge the user from the system completely
name: purge
in: query
responses:
'204':
$ref: '#/responses/empty'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
'422':
$ref: '#/responses/validationError'
patch:
consumes:
- application/json
produces:
- application/json
tags:
- admin
summary: Edit an existing user
operationId: adminEditUser
parameters:
- type: string
description: username of user to edit
name: username
in: path
required: true
- name: body
in: body
schema:
$ref: '#/definitions/EditUserOption'
responses:
'200':
$ref: '#/responses/User'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'422':
$ref: '#/responses/validationError'
/admin/users/{username}/emails:
get:
produces:
- application/json
tags:
- admin
summary: List all email addresses for a user
operationId: adminListUserEmails
parameters:
- type: string
description: username of user to get email addresses of
name: username
in: path
required: true
responses:
'200':
$ref: '#/responses/EmailList'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
delete:
produces:
- application/json
tags:
- admin
summary: Delete email addresses from a user's account
operationId: adminDeleteUserEmails
parameters:
- type: string
description: username of user to delete email addresses from
name: username
in: path
required: true
- name: body
in: body
schema:
$ref: '#/definitions/DeleteEmailOption'
responses:
'204':
$ref: '#/responses/empty'
'403':
$ref: '#/responses/forbidden'
'422':
$ref: '#/responses/validationError'
/admin/users/{username}/keys:
post:
consumes:
- application/json
produces:
- application/json
tags:
- admin
summary: Add an SSH public key to user's account
operationId: adminCreatePublicKey
parameters:
- type: string
description: username of the user
name: username
in: path
required: true
- name: key
in: body
schema:
$ref: '#/definitions/CreateKeyOption'
responses:
'201':
$ref: '#/responses/PublicKey'
'403':
$ref: '#/responses/forbidden'
'422':
$ref: '#/responses/validationError'
/admin/users/{username}/keys/{id}:
delete:
produces:
- application/json
tags:
- admin
summary: Remove a public key from user's account
operationId: adminDeleteUserPublicKey
parameters:
- type: string
description: username of user
name: username
in: path
required: true
- type: integer
format: int64
description: id of the key to delete
name: id
in: path
required: true
responses:
'204':
$ref: '#/responses/empty'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
/admin/users/{username}/orgs:
post:
consumes:
- application/json
produces:
- application/json
tags:
- admin
summary: Create an organization
operationId: adminCreateOrg
parameters:
- type: string
description: username of the user that will own the created organization
name: username
in: path
required: true
- name: organization
in: body
required: true
schema:
$ref: '#/definitions/CreateOrgOption'
responses:
'201':
$ref: '#/responses/Organization'
'403':
$ref: '#/responses/forbidden'
'422':
$ref: '#/responses/validationError'
/admin/users/{username}/quota:
get:
produces:
- application/json
tags:
- admin
summary: Get the user's quota info
operationId: adminGetUserQuota
parameters:
- type: string
description: username of user to query
name: username
in: path
required: true
responses:
'200':
$ref: '#/responses/QuotaInfo'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
'422':
$ref: '#/responses/validationError'
/admin/users/{username}/quota/groups:
post:
produces:
- application/json
tags:
- admin
summary: Set the user's quota groups to a given list.
operationId: adminSetUserQuotaGroups
parameters:
- type: string
description: username of the user to modify the quota groups from
name: username
in: path
required: true
- description: list of groups that the user should be a member of
name: groups
in: body
required: true
schema:
$ref: '#/definitions/SetUserQuotaGroupsOptions'
responses:
'204':
$ref: '#/responses/empty'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
'422':
$ref: '#/responses/validationError'
/admin/users/{username}/rename:
post:
produces:
- application/json
tags:
- admin
summary: Rename a user
operationId: adminRenameUser
parameters:
- type: string
description: existing username of user
name: username
in: path
required: true
- name: body
in: body
required: true
schema:
$ref: '#/definitions/RenameUserOption'
responses:
'204':
$ref: '#/responses/empty'
'403':
$ref: '#/responses/forbidden'
'422':
$ref: '#/responses/validationError'
/admin/users/{username}/repos:
post:
consumes:
- application/json
produces:
- application/json
tags:
- admin
summary: Create a repository on behalf of a user
operationId: adminCreateRepo
parameters:
- type: string
description: username of the user. This user will own the created repository
name: username
in: path
required: true
- name: repository
in: body
required: true
schema:
$ref: '#/definitions/CreateRepoOption'
responses:
'201':
$ref: '#/responses/Repository'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
'409':
$ref: '#/responses/error'
'422':
$ref: '#/responses/validationError'
/admin/users/{username}/tokens:
get:
produces:
- application/json
tags:
- admin
summary: List the specified user's access tokens
operationId: adminListUserAccessTokens
parameters:
- type: string
description: username of user
name: username
in: path
required: true
- type: integer
description: page number of results to return (1-based)
name: page
in: query
- type: integer
description: page size of results
name: limit
in: query
responses:
'200':
$ref: '#/responses/AccessTokenList'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
post:
consumes:
- application/json
produces:
- application/json
tags:
- admin
summary: Create an access token for the specified user
operationId: adminCreateUserAccessToken
parameters:
- type: string
description: username of user
name: username
in: path
required: true
- name: body
in: body
schema:
$ref: '#/definitions/CreateAccessTokenOption'
responses:
'201':
$ref: '#/responses/AccessToken'
'400':
$ref: '#/responses/error'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
/admin/users/{username}/tokens/{token}:
delete:
produces:
- application/json
tags:
- admin
summary: Delete an access token for the specified user
operationId: adminDeleteUserAccessToken
parameters:
- type: string
description: username of user
name: username
in: path
required: true
- type: string
description: token to be deleted, identified by ID and if not available by name
name: token
in: path
required: true
responses:
'204':
$ref: '#/responses/empty'
'403':
$ref: '#/responses/forbidden'
'404':
$ref: '#/responses/notFound'
'422':
$ref: '#/responses/error'
definitions:
Team:
description: Team represents a team in an organization
type: object
properties:
can_create_org_repo:
type: boolean
x-go-name: CanCreateOrgRepo
description:
type: string
x-go-name: Description
id:
type: integer
format: int64
x-go-name: ID
includes_all_repositories:
type: boolean
x-go-name: IncludesA
# --- truncated at 32 KB (75 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/forgejo/refs/heads/main/openapi/forgejo-admin-api-openapi.yml