ドキュメントには頻繁に更新が加えられ、その都度公開されています。本ページの翻訳はまだ未完成な部分があることをご了承ください。最新の情報については、英語のドキュメンテーションをご参照ください。本ページの翻訳に問題がある場合はこちらまでご連絡ください。
GitHub AEは、現在限定リリース中です。詳細については営業チームにお問い合わせください。

GitHub Enterprise administration

ここには以下の内容があります:

You can use these endpoints to administer your enterprise. Among the tasks you can perform with this API are many relating to GitHub Actions.

Endpoint URLs

REST API endpoints are prefixed with the following URL:

https://[hostname]/api/v3

Authentication

Your GitHub AE installation's API endpoints accept the same authentication methods as the GitHub.com API. You can authenticate yourself with OAuth tokens or basic authentication.

Enterprise administration API endpoints are only accessible to authenticated GitHub AE site administrators.

Version information

The current version of your enterprise is returned in the response header of every API: X-GitHub-Enterprise-Version: github-ae@latest.0 You can also read the current version by calling the meta endpoint.

GitHub Actions

ノート: GitHub Actionsは現在GitHub AEでベータです。

Get GitHub Actions permissions for an enterprise

Gets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise.

You must authenticate using an access token with the admin:enterprise scope to use this endpoint.

get /enterprises/{enterprise}/actions/permissions

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/permissions
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/permissions', {
  enterprise: 'enterprise'
})

Response

Status: 200 OK
{
  "enabled_organizations": "all",
  "allowed_actions": "selected",
  "selected_actions_url": "https://api.github.com/enterprises/2/actions/permissions/selected-actions"
}

Set GitHub Actions permissions for an enterprise

Sets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise.

You must authenticate using an access token with the admin:enterprise scope to use this endpoint.

put /enterprises/{enterprise}/actions/permissions

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

enabled_organizations string body

Required. The policy that controls the organizations in the enterprise that are allowed to run GitHub Actions. Can be one of: all, none, or selected.

allowed_actions string body

The permissions policy that controls the actions that are allowed to run. Can be one of: all, local_only, or selected.

コードサンプル

Shell
curl \
  -X PUT \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/permissions \
  -d '{"enabled_organizations":"enabled_organizations"}'
JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/permissions', {
  enterprise: 'enterprise',
  enabled_organizations: 'enabled_organizations'
})

Response

Status: 204 No Content

List selected organizations enabled for GitHub Actions in an enterprise

Lists the organizations that are selected to have GitHub Actions enabled in an enterprise. To use this endpoint, the enterprise permission policy for enabled_organizations must be configured to selected. For more information, see "Set GitHub Actions permissions for an enterprise."

You must authenticate using an access token with the admin:enterprise scope to use this endpoint.

get /enterprises/{enterprise}/actions/permissions/organizations

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

per_page integer query

Results per page (max 100)

Default: 30
page integer query

Page number of the results to fetch.

Default: 1

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/permissions/organizations
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/permissions/organizations', {
  enterprise: 'enterprise'
})

Response

Status: 200 OK
{
  "total_count": 1,
  "organizations": [
    {
      "login": "octocat",
      "id": 161335,
      "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
      "url": "https://api.github.com/orgs/octo-org",
      "repos_url": "https://api.github.com/orgs/octo-org/repos",
      "events_url": "https://api.github.com/orgs/octo-org/events",
      "hooks_url": "https://api.github.com/orgs/octo-org/hooks",
      "issues_url": "https://api.github.com/orgs/octo-org/issues",
      "members_url": "https://api.github.com/orgs/octo-org/members{/member}",
      "public_members_url": "https://api.github.com/orgs/octo-org/public_members{/member}",
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "description": "A great organization"
    }
  ]
}

Set selected organizations enabled for GitHub Actions in an enterprise

Replaces the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for enabled_organizations must be configured to selected. For more information, see "Set GitHub Actions permissions for an enterprise."

You must authenticate using an access token with the admin:enterprise scope to use this endpoint.

put /enterprises/{enterprise}/actions/permissions/organizations

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

selected_organization_ids array of integers body

Required. List of organization IDs to enable for GitHub Actions.

コードサンプル

Shell
curl \
  -X PUT \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/permissions/organizations \
  -d '{"selected_organization_ids":[42]}'
JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/permissions/organizations', {
  enterprise: 'enterprise',
  selected_organization_ids: [
    42
  ]
})

Response

Status: 204 No Content

Enable a selected organization for GitHub Actions in an enterprise

Adds an organization to the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for enabled_organizations must be configured to selected. For more information, see "Set GitHub Actions permissions for an enterprise."

You must authenticate using an access token with the admin:enterprise scope to use this endpoint.

put /enterprises/{enterprise}/actions/permissions/organizations/{org_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

org_id integer path

Unique identifier of an organization.

コードサンプル

Shell
curl \
  -X PUT \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/permissions/organizations/42
JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/permissions/organizations/{org_id}', {
  enterprise: 'enterprise',
  org_id: 42
})

Response

Status: 204 No Content

Disable a selected organization for GitHub Actions in an enterprise

Removes an organization from the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for enabled_organizations must be configured to selected. For more information, see "Set GitHub Actions permissions for an enterprise."

You must authenticate using an access token with the admin:enterprise scope to use this endpoint.

delete /enterprises/{enterprise}/actions/permissions/organizations/{org_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

org_id integer path

Unique identifier of an organization.

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/permissions/organizations/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /enterprises/{enterprise}/actions/permissions/organizations/{org_id}', {
  enterprise: 'enterprise',
  org_id: 42
})

Response

Status: 204 No Content

Get allowed actions for an enterprise

Gets the selected actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for allowed_actions must be configured to selected. For more information, see "Set GitHub Actions permissions for an enterprise."

You must authenticate using an access token with the admin:enterprise scope to use this endpoint.

get /enterprises/{enterprise}/actions/permissions/selected-actions

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/permissions/selected-actions
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/permissions/selected-actions', {
  enterprise: 'enterprise'
})

Response

Status: 200 OK
{
  "github_owned_allowed": true,
  "verified_allowed": false,
  "patterns_allowed": [
    "monalisa/octocat@*",
    "docker/*"
  ]
}

Set allowed actions for an enterprise

Sets the actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for allowed_actions must be configured to selected. For more information, see "Set GitHub Actions permissions for an enterprise."

You must authenticate using an access token with the admin:enterprise scope to use this endpoint.

put /enterprises/{enterprise}/actions/permissions/selected-actions

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

github_owned_allowed boolean body

Whether GitHub-owned actions are allowed. For example, this includes the actions in the actions organization.

verified_allowed boolean body

Whether actions in GitHub Marketplace from verified creators are allowed. Set to true to allow all GitHub Marketplace actions by verified creators.

patterns_allowed array of strings body

Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, monalisa/octocat@*, monalisa/octocat@v2, monalisa/*."

コードサンプル

Shell
curl \
  -X PUT \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/permissions/selected-actions \
  -d '{"github_owned_allowed":true}'
JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/permissions/selected-actions', {
  enterprise: 'enterprise',
  github_owned_allowed: true
})

Response

Status: 204 No Content

List self-hosted runner groups for an enterprise

Lists all self-hosted runner groups for an enterprise.

You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.

get /enterprises/{enterprise}/actions/runner-groups

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

per_page integer query

Results per page (max 100)

Default: 30
page integer query

Page number of the results to fetch.

Default: 1

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/runner-groups', {
  enterprise: 'enterprise'
})

Response

Status: 200 OK
{
  "total_count": 3,
  "runner_groups": [
    {
      "id": 1,
      "name": "Default",
      "visibility": "all",
      "default": true,
      "runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner_groups/1/runners",
      "allows_public_repositories": false
    },
    {
      "id": 2,
      "name": "octo-runner-group",
      "visibility": "selected",
      "default": false,
      "selected_organizations_url": "https://api.github.com/enterprises/octo-corp/actions/runner_groups/2/organizations",
      "runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner_groups/2/runners",
      "allows_public_repositories": true
    },
    {
      "id": 3,
      "name": "expensive-hardware",
      "visibility": "private",
      "default": false,
      "runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner_groups/3/runners",
      "allows_public_repositories": true
    }
  ]
}

Create a self-hosted runner group for an enterprise

Creates a new self-hosted runner group for an enterprise.

You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.

post /enterprises/{enterprise}/actions/runner-groups

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

name string body

Required. Name of the runner group.

visibility string body

Visibility of a runner group. You can select all organizations or select individual organization. Can be one of: all or selected

selected_organization_ids array of integers body

List of organization IDs that can access the runner group.

runners array of integers body

List of runner IDs to add to the runner group.

allows_public_repositories boolean body

Whether the runner group can be used by public repositories.

Default: false

コードサンプル

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups \
  -d '{"name":"name"}'
JavaScript (@octokit/core.js)
await octokit.request('POST /enterprises/{enterprise}/actions/runner-groups', {
  enterprise: 'enterprise',
  name: 'name'
})

Response

Status: 201 Created
{
  "id": 2,
  "name": "octo-runner-group",
  "visibility": "selected",
  "default": false,
  "selected_organizations_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/organizations",
  "runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/runners",
  "allows_public_repositories": false
}

Get a self-hosted runner group for an enterprise

Gets a specific self-hosted runner group for an enterprise.

You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.

get /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

runner_group_id integer path

Unique identifier of the self-hosted runner group.

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups/42
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}', {
  enterprise: 'enterprise',
  runner_group_id: 42
})

Response

Status: 200 OK
{
  "id": 2,
  "name": "octo-runner-group",
  "visibility": "selected",
  "default": false,
  "selected_organizations_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/organizations",
  "runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/runners",
  "allows_public_repositories": false
}

Update a self-hosted runner group for an enterprise

Updates the name and visibility of a self-hosted runner group in an enterprise.

You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.

patch /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

runner_group_id integer path

Unique identifier of the self-hosted runner group.

name string body

Name of the runner group.

visibility string body

Visibility of a runner group. You can select all organizations or select individual organizations. Can be one of: all or selected

Default: all
allows_public_repositories boolean body

Whether the runner group can be used by public repositories.

Default: false

コードサンプル

Shell
curl \
  -X PATCH \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups/42 \
  -d '{"name":"name"}'
JavaScript (@octokit/core.js)
await octokit.request('PATCH /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}', {
  enterprise: 'enterprise',
  runner_group_id: 42,
  name: 'name'
})

Response

Status: 200 OK
{
  "id": 2,
  "name": "Expensive hardware runners",
  "visibility": "selected",
  "default": false,
  "selected_organizations_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/organizations",
  "runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/runners",
  "allows_public_repositories": true
}

Delete a self-hosted runner group from an enterprise

Deletes a self-hosted runner group for an enterprise.

You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.

delete /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

runner_group_id integer path

Unique identifier of the self-hosted runner group.

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}', {
  enterprise: 'enterprise',
  runner_group_id: 42
})

Response

Status: 204 No Content

List self-hosted runners in a group for an enterprise

Lists the self-hosted runners that are in a specific enterprise group.

You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.

get /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

runner_group_id integer path

Unique identifier of the self-hosted runner group.

per_page integer query

Results per page (max 100)

Default: 30
page integer query

Page number of the results to fetch.

Default: 1

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups/42/runners
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners', {
  enterprise: 'enterprise',
  runner_group_id: 42
})

Response

Status: 200 OK
{
  "total_count": 2,
  "runners": [
    {
      "id": 23,
      "name": "linux_runner",
      "os": "linux",
      "status": "online",
      "busy": true,
      "labels": [
        {
          "id": 5,
          "name": "self-hosted",
          "type": "read-only"
        },
        {
          "id": 7,
          "name": "X64",
          "type": "read-only"
        },
        {
          "id": 11,
          "name": "Linux",
          "type": "read-only"
        }
      ]
    },
    {
      "id": 24,
      "name": "mac_runner",
      "os": "macos",
      "status": "offline",
      "busy": false,
      "labels": [
        {
          "id": 5,
          "name": "self-hosted",
          "type": "read-only"
        },
        {
          "id": 7,
          "name": "X64",
          "type": "read-only"
        },
        {
          "id": 20,
          "name": "macOS",
          "type": "read-only"
        },
        {
          "id": 21,
          "name": "no-gpu",
          "type": "custom"
        }
      ]
    }
  ]
}

Set self-hosted runners in a group for an enterprise

Replaces the list of self-hosted runners that are part of an enterprise runner group.

You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.

put /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

runner_group_id integer path

Unique identifier of the self-hosted runner group.

runners array of integers body

Required. List of runner IDs to add to the runner group.

コードサンプル

Shell
curl \
  -X PUT \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups/42/runners \
  -d '{"runners":[42]}'
JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners', {
  enterprise: 'enterprise',
  runner_group_id: 42,
  runners: [
    42
  ]
})

Response

Status: 204 No Content

Add a self-hosted runner to a group for an enterprise

Adds a self-hosted runner to a runner group configured in an enterprise.

You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.

put /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

runner_group_id integer path

Unique identifier of the self-hosted runner group.

runner_id integer path

Unique identifier of the self-hosted runner.

コードサンプル

Shell
curl \
  -X PUT \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups/42/runners/42
JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id}', {
  enterprise: 'enterprise',
  runner_group_id: 42,
  runner_id: 42
})

Response

Status: 204 No Content

Remove a self-hosted runner from a group for an enterprise

Removes a self-hosted runner from a group configured in an enterprise. The runner is then returned to the default group.

You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.

delete /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

runner_group_id integer path

Unique identifier of the self-hosted runner group.

runner_id integer path

Unique identifier of the self-hosted runner.

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups/42/runners/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id}', {
  enterprise: 'enterprise',
  runner_group_id: 42,
  runner_id: 42
})

Response

Status: 204 No Content

List self-hosted runners for an enterprise

Lists all self-hosted runners configured for an enterprise.

You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.

get /enterprises/{enterprise}/actions/runners

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

per_page integer query

Results per page (max 100)

Default: 30
page integer query

Page number of the results to fetch.

Default: 1

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runners
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/runners', {
  enterprise: 'enterprise'
})

Response

Status: 200 OK
{
  "total_count": 2,
  "runners": [
    {
      "id": 23,
      "name": "linux_runner",
      "os": "linux",
      "status": "online",
      "busy": true,
      "labels": [
        {
          "id": 5,
          "name": "self-hosted",
          "type": "read-only"
        },
        {
          "id": 7,
          "name": "X64",
          "type": "read-only"
        },
        {
          "id": 11,
          "name": "Linux",
          "type": "read-only"
        }
      ]
    },
    {
      "id": 24,
      "name": "mac_runner",
      "os": "macos",
      "status": "offline",
      "busy": false,
      "labels": [
        {
          "id": 5,
          "name": "self-hosted",
          "type": "read-only"
        },
        {
          "id": 7,
          "name": "X64",
          "type": "read-only"
        },
        {
          "id": 20,
          "name": "macOS",
          "type": "read-only"
        },
        {
          "id": 21,
          "name": "no-gpu",
          "type": "custom"
        }
      ]
    }
  ]
}

Get a self-hosted runner for an enterprise

Gets a specific self-hosted runner configured in an enterprise.

You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.

get /enterprises/{enterprise}/actions/runners/{runner_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

runner_id integer path

Unique identifier of the self-hosted runner.

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runners/42
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/runners/{runner_id}', {
  enterprise: 'enterprise',
  runner_id: 42
})

Response

Status: 200 OK
{
  "id": 23,
  "name": "MBP",
  "os": "macos",
  "status": "online",
  "busy": true,
  "labels": [
    {
      "id": 5,
      "name": "self-hosted",
      "type": "read-only"
    },
    {
      "id": 7,
      "name": "X64",
      "type": "read-only"
    },
    {
      "id": 20,
      "name": "macOS",
      "type": "read-only"
    },
    {
      "id": 21,
      "name": "no-gpu",
      "type": "custom"
    }
  ]
}

Delete a self-hosted runner from an enterprise

Forces the removal of a self-hosted runner from an enterprise. You can use this endpoint to completely remove the runner when the machine you were using no longer exists.

You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.

delete /enterprises/{enterprise}/actions/runners/{runner_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

enterprise string path

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

runner_id integer path

Unique identifier of the self-hosted runner.

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runners/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /enterprises/{enterprise}/actions/runners/{runner_id}', {
  enterprise: 'enterprise',
  runner_id: 42
})

Response

Status: 204 No Content

Admin stats

The Admin Stats API provides a variety of metrics about your installation. It is only available to authenticated site administrators. Normal users will receive a 404 response if they try to access it.

Get all statistics

get /enterprise/stats/all

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprise/stats/all
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/all')

Response

Status: 200 OK
{
  "repos": {
    "total_repos": 212,
    "root_repos": 194,
    "fork_repos": 18,
    "org_repos": 51,
    "total_pushes": 3082,
    "total_wikis": 15
  },
  "hooks": {
    "total_hooks": 27,
    "active_hooks": 23,
    "inactive_hooks": 4
  },
  "pages": {
    "total_pages": 36
  },
  "orgs": {
    "total_orgs": 33,
    "disabled_orgs": 0,
    "total_teams": 60,
    "total_team_members": 314
  },
  "users": {
    "total_users": 254,
    "admin_users": 45,
    "suspended_users": 21
  },
  "pulls": {
    "total_pulls": 86,
    "merged_pulls": 60,
    "mergeable_pulls": 21,
    "unmergeable_pulls": 3
  },
  "issues": {
    "total_issues": 179,
    "open_issues": 83,
    "closed_issues": 96
  },
  "milestones": {
    "total_milestones": 7,
    "open_milestones": 6,
    "closed_milestones": 1
  },
  "gists": {
    "total_gists": 178,
    "private_gists": 151,
    "public_gists": 25
  },
  "comments": {
    "total_commit_comments": 6,
    "total_gist_comments": 28,
    "total_issue_comments": 366,
    "total_pull_request_comments": 30
  }
}

Get comment statistics

get /enterprise/stats/comments

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprise/stats/comments
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/comments')

Response

Status: 200 OK

Get gist statistics

get /enterprise/stats/gists

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprise/stats/gists
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/gists')

Response

Status: 200 OK

Get hooks statistics

get /enterprise/stats/hooks

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprise/stats/hooks
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/hooks')

Response

Status: 200 OK

Get issue statistics

get /enterprise/stats/issues

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprise/stats/issues
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/issues')

Response

Status: 200 OK

Get milestone statistics

get /enterprise/stats/milestones

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprise/stats/milestones
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/milestones')

Response

Status: 200 OK

Get organization statistics

get /enterprise/stats/orgs

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprise/stats/orgs
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/orgs')

Response

Status: 200 OK

Get pages statistics

get /enterprise/stats/pages

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprise/stats/pages
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/pages')

Response

Status: 200 OK

Get pull request statistics

get /enterprise/stats/pulls

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprise/stats/pulls
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/pulls')

Response

Status: 200 OK

Get repository statistics

get /enterprise/stats/repos

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprise/stats/repos
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/repos')

Response

Status: 200 OK

Get users statistics

get /enterprise/stats/users

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprise/stats/users
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/users')

Response

Status: 200 OK

Announcements

The Announcements API allows you to manage the global announcement banner in your enterprise. For more information, see "Customizing user messages for your enterprise."

Get the global announcement banner

Gets the current message and expiration date of the global announcement banner in your enterprise.

get /enterprise/announcement

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprise/announcement
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/announcement')

Default response

Status: 200 OK
{
  "announcement": "Very **important** announcement about _nothing_.",
  "expires_at": "2021-01-01T00:00:00.000+00:00"
}

Set the global announcement banner

Sets the message and expiration time for the global announcement banner in your enterprise.

patch /enterprise/announcement

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

announcement string body

Required. The announcement text in GitHub Flavored Markdown. For more information about GitHub Flavored Markdown, see "Basic writing and formatting syntax."

expires_at string or nullable body

The time at which the announcement expires. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. To set an announcement that never expires, omit this parameter, set it to null, or set it to an empty string.

コードサンプル

Shell
curl \
  -X PATCH \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprise/announcement \
  -d '{"announcement":"announcement"}'
JavaScript (@octokit/core.js)
await octokit.request('PATCH /enterprise/announcement', {
  announcement: 'announcement'
})

Default response

Status: 200 OK
{
  "announcement": "Very **important** announcement about _nothing_.",
  "expires_at": "2021-01-01T00:00:00.000+00:00"
}

Remove the global announcement banner

Removes the global announcement banner in your enterprise.

delete /enterprise/announcement

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprise/announcement
JavaScript (@octokit/core.js)
await octokit.request('DELETE /enterprise/announcement')

Response

Status: 204 No Content

Global webhooks

Global webhooks are installed on your enterprise. You can use global webhooks to automatically monitor, respond to, or enforce rules for users, organizations, teams, and repositories on your enterprise. Global webhooks can subscribe to the organization, user, repository, team, member, membership, fork, and ping event types.

This API is only available to authenticated site administrators. Normal users will receive a 404 response if they try to access it. To learn how to configure global webhooks, see About global webhooks.

List global webhooks

get /admin/hooks

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

accept string header

This API is under preview and subject to change.

Default: application/vnd.github.superpro-preview+json
per_page integer query

Results per page (max 100)

Default: 30
page integer query

Page number of the results to fetch.

Default: 1

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/admin/hooks
JavaScript (@octokit/core.js)
await octokit.request('GET /admin/hooks')

Response

Status: 200 OK
[
  {
    "type": "Global",
    "id": 1,
    "name": "web",
    "active": true,
    "events": [
      "organization",
      "user"
    ],
    "config": {
      "url": "https://example.com",
      "content_type": "json",
      "insecure_ssl": "0",
      "secret": "********"
    },
    "updated_at": "2017-12-07T00:14:59Z",
    "created_at": "2017-12-07T00:14:59Z",
    "url": "https://api.github.com/admin/hooks/1",
    "ping_url": "https://api.github.com/admin/hooks/1/pings"
  }
]

Create a global webhook

post /admin/hooks

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

name string body

Required. Must be passed as "web".

config object body

Required. Key/value pairs to provide settings for this webhook.

Properties of the config object
url (string)

Required. The URL to which the payloads will be delivered.

content_type (string)

The media type used to serialize the payloads. Supported values include json and form. The default is form.

secret (string)

If provided, the secret will be used as the key to generate the HMAC hex digest value in the X-Hub-Signature header.

insecure_ssl (string)

Determines whether the SSL certificate of the host for url will be verified when delivering payloads. Supported values include 0 (verification is performed) and 1 (verification is not performed). The default is 0. We strongly recommend not setting this to 1 as you are subject to man-in-the-middle and other attacks.

events array of strings body

The events that trigger this webhook. A global webhook can be triggered by user and organization events. Default: user and organization.

active boolean body

Determines if notifications are sent when the webhook is triggered. Set to true to send notifications.

Default: true

コードサンプル

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/admin/hooks \
  -d '{"name":"name","config":{"url":"url","content_type":"content_type","secret":"secret","insecure_ssl":"insecure_ssl"}}'
JavaScript (@octokit/core.js)
await octokit.request('POST /admin/hooks', {
  name: 'name',
  config: {
    url: 'url',
    content_type: 'content_type',
    secret: 'secret',
    insecure_ssl: 'insecure_ssl'
  }
})

Response

Status: 201 Created
{
  "type": "Global",
  "id": 1,
  "name": "web",
  "active": true,
  "events": [
    "organization",
    "user"
  ],
  "config": {
    "url": "https://example.com",
    "content_type": "json",
    "insecure_ssl": "0",
    "secret": "********"
  },
  "updated_at": "2017-12-07T00:14:59Z",
  "created_at": "2017-12-07T00:14:59Z",
  "url": "https://api.github.com/admin/hooks/1",
  "ping_url": "https://api.github.com/admin/hooks/1/pings"
}

Get a global webhook

get /admin/hooks/{hook_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

hook_id integer path

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/admin/hooks/42
JavaScript (@octokit/core.js)
await octokit.request('GET /admin/hooks/{hook_id}', {
  hook_id: 42
})

Response

Status: 200 OK
{
  "type": "Global",
  "id": 1,
  "name": "web",
  "active": true,
  "events": [
    "organization",
    "user"
  ],
  "config": {
    "url": "https://example.com",
    "content_type": "json",
    "insecure_ssl": "0",
    "secret": "********"
  },
  "updated_at": "2017-12-07T00:14:59Z",
  "created_at": "2017-12-07T00:14:59Z",
  "url": "https://api.github.com/admin/hooks/1",
  "ping_url": "https://api.github.com/admin/hooks/1/pings"
}

Update a global webhook

Parameters that are not provided will be overwritten with the default value or removed if no default exists.

patch /admin/hooks/{hook_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

hook_id integer path
config object body

Key/value pairs to provide settings for this webhook.

Properties of the config object
url (string)

Required. The URL to which the payloads will be delivered.

content_type (string)

The media type used to serialize the payloads. Supported values include json and form. The default is form.

secret (string)

If provided, the secret will be used as the key to generate the HMAC hex digest value in the X-Hub-Signature header.

insecure_ssl (string)

Determines whether the SSL certificate of the host for url will be verified when delivering payloads. Supported values include 0 (verification is performed) and 1 (verification is not performed). The default is 0. We strongly recommend not setting this to 1 as you are subject to man-in-the-middle and other attacks.

events array of strings body

The events that trigger this webhook. A global webhook can be triggered by user and organization events. Default: user and organization.

active boolean body

Determines if notifications are sent when the webhook is triggered. Set to true to send notifications.

Default: true

コードサンプル

Shell
curl \
  -X PATCH \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/admin/hooks/42 \
  -d '{"config":{"url":"url","content_type":"content_type","secret":"secret","insecure_ssl":"insecure_ssl"}}'
JavaScript (@octokit/core.js)
await octokit.request('PATCH /admin/hooks/{hook_id}', {
  hook_id: 42,
  config: {
    url: 'url',
    content_type: 'content_type',
    secret: 'secret',
    insecure_ssl: 'insecure_ssl'
  }
})

Response

Status: 200 OK
{
  "type": "Global",
  "id": 1,
  "name": "web",
  "active": true,
  "events": [
    "organization"
  ],
  "config": {
    "url": "https://example.com",
    "content_type": "form",
    "insecure_ssl": "0"
  },
  "updated_at": "2017-12-07T00:14:59Z",
  "created_at": "2017-12-07T00:14:59Z",
  "url": "https://api.github.com/admin/hooks/1",
  "ping_url": "https://api.github.com/admin/hooks/1/pings"
}

Delete a global webhook

delete /admin/hooks/{hook_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

accept string header

This API is under preview and subject to change.

Default: application/vnd.github.superpro-preview+json
hook_id integer path

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/admin/hooks/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/hooks/{hook_id}', {
  hook_id: 42
})

Response

Status: 204 No Content

Ping a global webhook

This will trigger a ping event to be sent to the webhook.

post /admin/hooks/{hook_id}/pings

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

accept string header

This API is under preview and subject to change.

Default: application/vnd.github.superpro-preview+json
hook_id integer path

コードサンプル

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/admin/hooks/42/pings
JavaScript (@octokit/core.js)
await octokit.request('POST /admin/hooks/{hook_id}/pings', {
  hook_id: 42
})

Response

Status: 204 No Content

License

The License API provides information on your Enterprise license. It is only available to authenticated site administrators. Normal users will receive a 404 response if they try to access it.

Get license information

get /enterprise/settings/license

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/enterprise/settings/license
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/settings/license')

Response

Status: 200 OK
{
  "seats": 1400,
  "seats_used": 1316,
  "seats_available": 84,
  "kind": "standard",
  "days_until_expiration": 365,
  "expire_at": "2016/02/06 12:41:52 -0600"
}

Organizations

The Organization Administration API allows you to create organizations on your enterprise. It is only available to authenticated site administrators. Normal users will receive a 404 response if they try to access it.

Create an organization

post /admin/organizations

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

login string body

Required. The organization's username.

admin string body

Required. The login of the user who will manage this organization.

profile_name string body

The organization's display name.

コードサンプル

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/admin/organizations \
  -d '{"login":"login","admin":"admin"}'
JavaScript (@octokit/core.js)
await octokit.request('POST /admin/organizations', {
  login: 'login',
  admin: 'admin'
})

Response

Status: 201 Created
{
  "login": "github",
  "id": 1,
  "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
  "url": "https://api.github.com/orgs/github",
  "repos_url": "https://api.github.com/orgs/github/repos",
  "events_url": "https://api.github.com/orgs/github/events",
  "hooks_url": "https://api.github.com/orgs/github/hooks",
  "issues_url": "https://api.github.com/orgs/github/issues",
  "members_url": "https://api.github.com/orgs/github/members{/member}",
  "public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
  "avatar_url": "https://github.com/images/error/octocat_happy.gif",
  "description": "A great organization"
}

Update an organization name

patch /admin/organizations/{org}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

org string path
login string body

Required. The organization's new name.

コードサンプル

Shell
curl \
  -X PATCH \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/admin/organizations/ORG \
  -d '{"login":"login"}'
JavaScript (@octokit/core.js)
await octokit.request('PATCH /admin/organizations/{org}', {
  org: 'org',
  login: 'login'
})

Response

Status: 202 Accepted
{
  "message": "Job queued to rename organization. It may take a few minutes to complete.",
  "url": "https://<hostname>/api/v3/organizations/1"
}

Users

The User Administration API allows you to suspend and unsuspend users on your enterprise. It is only available to authenticated site administrators. Normal users will receive a 403 response if they try to access it.

List public keys

get /admin/keys

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

per_page integer query

Results per page (max 100)

Default: 30
page integer query

Page number of the results to fetch.

Default: 1
direction string query

One of asc (ascending) or desc (descending).

Default: desc
sort string query Default: created
since string query

Only show public keys accessed after the given time.

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/admin/keys
JavaScript (@octokit/core.js)
await octokit.request('GET /admin/keys')

Response

Status: 200 OK
[
  {
    "key": "2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234",
    "id": 2,
    "url": "https://api.github.com/user/keys/2",
    "title": "ssh-rsa AAAAB3NzaC1yc2EAAA",
    "created_at": "2020-06-11T21:31:57Z",
    "verified": false,
    "read_only": false,
    "last_used": "2020-06-11T22:31:57Z",
    "user_id": 1,
    "repository_id": 2
  },
  {
    "key": "9Og8iYjAyymI9LvABpJerYrMxURPc8r+dB7TJyvv1234",
    "id": 3,
    "url": "https://api.github.com/user/keys/2",
    "title": "ssh-rsa AAAAB3NzaC1yc2EAAA",
    "created_at": "2020-06-11T21:31:57Z",
    "verified": false,
    "read_only": false,
    "last_used": "2020-06-11T22:31:57Z",
    "user_id": 1,
    "repository_id": 2
  }
]

Delete a public key

delete /admin/keys/{key_ids}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

key_ids string path

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/admin/keys/KEY_IDS
JavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/keys/{key_ids}', {
  key_ids: 'key_ids'
})

Response

Status: 204 No Content

List personal access tokens

Lists personal access tokens for all users, including admin users.

get /admin/tokens

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

per_page integer query

Results per page (max 100)

Default: 30
page integer query

Page number of the results to fetch.

Default: 1

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/admin/tokens
JavaScript (@octokit/core.js)
await octokit.request('GET /admin/tokens')

Response

Status: 200 OK
[
  {
    "id": 1,
    "url": "https://api.github.com/authorizations/1",
    "scopes": [
      "public_repo"
    ],
    "token": "ghu_16C7e42F292c6912E7710c838347Ae178B4a",
    "token_last_eight": "Ae178B4a",
    "hashed_token": "25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8",
    "app": {
      "url": "http://my-github-app.com",
      "name": "my github app",
      "client_id": "abcde12345fghij67890"
    },
    "note": "optional note",
    "note_url": "http://optional/note/url",
    "updated_at": "2011-09-06T20:39:23Z",
    "created_at": "2011-09-06T17:26:27Z",
    "expires_at": "2011-09-08T17:26:27Z",
    "fingerprint": "jklmnop12345678"
  }
]

Delete a personal access token

Deletes a personal access token. Returns a 403 - Forbidden status when a personal access token is in use. For example, if you access this endpoint with the same personal access token that you are trying to delete, you will receive this error.

delete /admin/tokens/{token_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

token_id integer path

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/admin/tokens/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/tokens/{token_id}', {
  token_id: 42
})

Response

Status: 204 No Content

Delete a user

Deleting a user will delete all their repositories, gists, applications, and personal settings. Suspending a user is often a better option.

You can delete any user account except your own.

delete /admin/users/{username}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

username string path

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/admin/users/USERNAME
JavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/users/{username}', {
  username: 'username'
})

Response

Status: 204 No Content

Create an impersonation OAuth token

post /admin/users/{username}/authorizations

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

username string path
scopes array of strings body

A list of scopes.

コードサンプル

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/admin/users/USERNAME/authorizations \
  -d '{"scopes":["scopes"]}'
JavaScript (@octokit/core.js)
await octokit.request('POST /admin/users/{username}/authorizations', {
  username: 'username',
  scopes: [
    'scopes'
  ]
})

Response

Status: 201 Created
{
  "id": 1,
  "url": "https://api.github.com/authorizations/1",
  "scopes": [
    "public_repo"
  ],
  "token": "ghu_16C7e42F292c6912E7710c838347Ae178B4a",
  "token_last_eight": "Ae178B4a",
  "hashed_token": "25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8",
  "app": {
    "url": "http://my-github-app.com",
    "name": "my github app",
    "client_id": "abcde12345fghij67890"
  },
  "note": "optional note",
  "note_url": "http://optional/note/url",
  "updated_at": "2011-09-06T20:39:23Z",
  "created_at": "2011-09-06T17:26:27Z",
  "expires_at": "2011-10-06T17:26:27Z",
  "fingerprint": ""
}

Delete an impersonation OAuth token

delete /admin/users/{username}/authorizations

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

username string path

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/admin/users/USERNAME/authorizations
JavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/users/{username}/authorizations', {
  username: 'username'
})

Response

Status: 204 No Content

Suspend a user

If your GitHub instance uses LDAP Sync with Active Directory LDAP servers, Active Directory LDAP-authenticated users cannot be suspended through this API. If you attempt to suspend an Active Directory LDAP-authenticated user through this API, it will return a 403 response.

You can suspend any user account except your own.

Note that, if you choose not to pass any parameters, you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."

put /users/{username}/suspended

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

username string path
reason string body

The reason the user is being suspended. This message will be logged in the audit log. If you don't provide a reason, it will default to "Suspended via API by SITE_ADMINISTRATOR", where SITE_ADMINISTRATOR is the person who performed the action.

コードサンプル

Shell
curl \
  -X PUT \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/users/USERNAME/suspended \
  -d '{"reason":"reason"}'
JavaScript (@octokit/core.js)
await octokit.request('PUT /users/{username}/suspended', {
  username: 'username',
  reason: 'reason'
})

Response

Status: 204 No Content

Unsuspend a user

If your GitHub instance uses LDAP Sync with Active Directory LDAP servers, this API is disabled and will return a 403 response. Active Directory LDAP-authenticated users cannot be unsuspended using the API.

delete /users/{username}/suspended

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

username string path
reason string body

The reason the user is being unsuspended. This message will be logged in the audit log. If you don't provide a reason, it will default to "Unsuspended via API by SITE_ADMINISTRATOR", where SITE_ADMINISTRATOR is the person who performed the action.

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://{hostname}/api/v3/users/USERNAME/suspended \
  -d '{"reason":"reason"}'
JavaScript (@octokit/core.js)
await octokit.request('DELETE /users/{username}/suspended', {
  username: 'username',
  reason: 'reason'
})

Response

Status: 204 No Content

このドキュメントは役立ちましたか?

プライバシーポリシー

これらのドキュメントを素晴らしいものにするのを手伝ってください!

GitHubのすべてのドキュメントはオープンソースです。間違っていたり、はっきりしないところがありましたか?Pull Requestをお送りください。

コントリビューションを行う

OR, コントリビューションの方法を学んでください。

問題がまだ解決していませんか?