Skip to main content
설명서에 자주 업데이트를 게시하며 이 페이지의 번역이 계속 진행 중일 수 있습니다. 최신 정보는 영어 설명서를 참조하세요.
이제 REST API의 버전이 지정되었습니다. 자세한 내용은 "API 버전 관리 정보"를 참조하세요.

조직

REST API를 사용하여 조직과 상호 작용합니다.

List organizations

에서 작동 GitHub Apps

Lists all organizations, in the order that they were created on GitHub Enterprise Cloud.

Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of organizations.

"List organizations"에 대한 매개 변수

헤더
속성, 형식, Description
acceptstring

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

쿼리 매개 변수
속성, 형식, Description
sinceinteger

An organization ID. Only return organizations with an ID greater than this ID.

per_pageinteger

The number of results per page (max 100).

기본값: 30

"List organizations"에 대한 HTTP 응답 상태 코드

상태 코드Description
200

OK

304

Not modified

"List organizations"에 대한 코드 샘플

get/organizations
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>"\ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/organizations

Response

Status: 200
[ { "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" } ]

Get an organization

에서 작동 GitHub Apps

To see many of the organization response values, you need to be an authenticated organization owner with the admin:org scope. When the value of two_factor_requirement_enabled is true, the organization requires all members, billing managers, and outside collaborators to enable two-factor authentication.

GitHub Apps with the Organization plan permission can use this endpoint to retrieve information about an organization's GitHub Enterprise Cloud plan. See "Authenticating with GitHub Apps" for details. For an example response, see 'Response with GitHub Enterprise Cloud plan information' below."

"Get an organization"에 대한 매개 변수

헤더
속성, 형식, Description
acceptstring

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

경로 매개 변수
속성, 형식, Description
orgstring필수

The organization name. The name is not case sensitive.

"Get an organization"에 대한 HTTP 응답 상태 코드

상태 코드Description
200

OK

404

Resource not found

"Get an organization"에 대한 코드 샘플

get/orgs/{org}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>"\ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG

Response

Status: 200
{ "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", "name": "github", "company": "GitHub", "blog": "https://github.com/blog", "location": "San Francisco", "email": "octocat@github.com", "twitter_username": "github", "is_verified": true, "has_organization_projects": true, "has_repository_projects": true, "public_repos": 2, "public_gists": 1, "followers": 20, "following": 0, "html_url": "https://github.com/octocat", "created_at": "2008-01-14T04:33:35Z", "type": "Organization", "total_private_repos": 100, "owned_private_repos": 100, "private_gists": 81, "disk_usage": 10000, "collaborators": 8, "billing_email": "mona@github.com", "plan": { "name": "Medium", "space": 400, "private_repos": 20, "filled_seats": 4, "seats": 5 }, "default_repository_permission": "read", "members_can_create_repositories": true, "two_factor_requirement_enabled": true, "members_allowed_repository_creation_type": "all", "members_can_create_public_repositories": false, "members_can_create_private_repositories": false, "members_can_create_internal_repositories": false, "members_can_create_pages": true, "members_can_create_public_pages": true, "members_can_create_private_pages": true, "members_can_fork_private_repositories": false, "web_commit_signoff_required": false, "updated_at": "2014-03-03T18:58:10Z", "dependency_graph_enabled_for_new_repositories": false, "dependabot_alerts_enabled_for_new_repositories": false, "dependabot_security_updates_enabled_for_new_repositories": false, "advanced_security_enabled_for_new_repositories": false, "secret_scanning_enabled_for_new_repositories": false, "secret_scanning_push_protection_enabled_for_new_repositories": false, "secret_scanning_push_protection_custom_link": false, "secret_scanning_push_protection_custom_link_enabled": "https://github.com/octo-org/octo-repo/blob/main/im-blocked.md" }

Update an organization

에서 작동 GitHub Apps

Parameter Deprecation Notice: GitHub Enterprise Cloud will replace and discontinue members_allowed_repository_creation_type in favor of more granular permissions. The new input parameters are members_can_create_public_repositories, members_can_create_private_repositories for all organizations and members_can_create_internal_repositories for organizations associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. For more information, see the blog post.

Enables an authenticated organization owner with the admin:org scope to update the organization's profile and member privileges.

"Update an organization"에 대한 매개 변수

헤더
속성, 형식, Description
acceptstring

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

경로 매개 변수
속성, 형식, Description
orgstring필수

The organization name. The name is not case sensitive.

본문 매개 변수
속성, 형식, Description
billing_emailstring

Billing email address. This address is not publicized.

companystring

The company name.

emailstring

The publicly visible email address.

twitter_usernamestring

The Twitter username of the company.

locationstring

The location.

namestring

The shorthand name of the company.

descriptionstring

The description of the company.

has_organization_projectsboolean

Whether an organization can use organization projects.

has_repository_projectsboolean

Whether repositories that belong to the organization can use repository projects.

default_repository_permissionstring

Default permission level members have for organization repositories.

기본값: read

다음 중 하나일 수 있습니다.: read, write, admin, none

members_can_create_repositoriesboolean

Whether of non-admin organization members can create repositories. Note: A parameter can override this parameter. See members_allowed_repository_creation_type in this table for details.

기본값: true

members_can_create_internal_repositoriesboolean

Whether organization members can create internal repositories, which are visible to all enterprise members. You can only allow members to create internal repositories if your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. For more information, see "Restricting repository creation in your organization" in the GitHub Help documentation.

members_can_create_private_repositoriesboolean

Whether organization members can create private repositories, which are visible to organization members with permission. For more information, see "Restricting repository creation in your organization" in the GitHub Help documentation.

members_can_create_public_repositoriesboolean

Whether organization members can create public repositories, which are visible to anyone. For more information, see "Restricting repository creation in your organization" in the GitHub Help documentation.

members_allowed_repository_creation_typestring

Specifies which types of repositories non-admin organization members can create. private is only available to repositories that are part of an organization on GitHub Enterprise Cloud. Note: This parameter is deprecated and will be removed in the future. Its return value ignores internal repositories. Using this parameter overrides values set in members_can_create_repositories. See the parameter deprecation notice in the operation description for details.

다음 중 하나일 수 있습니다.: all, private, none

members_can_create_pagesboolean

Whether organization members can create GitHub Pages sites. Existing published sites will not be impacted.

기본값: true

members_can_create_public_pagesboolean

Whether organization members can create public GitHub Pages sites. Existing published sites will not be impacted.

기본값: true

members_can_create_private_pagesboolean

Whether organization members can create private GitHub Pages sites. Existing published sites will not be impacted.

기본값: true

members_can_fork_private_repositoriesboolean

Whether organization members can fork private organization repositories.

기본값: false

web_commit_signoff_requiredboolean

Whether contributors to organization repositories are required to sign off on commits they make through GitHub's web interface.

기본값: false

blogstring
advanced_security_enabled_for_new_repositoriesboolean

Whether GitHub Advanced Security is automatically enabled for new repositories.

To use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see "Managing security managers in your organization."

You can check which security and analysis features are currently enabled by using a GET /orgs/{org} request.

dependabot_alerts_enabled_for_new_repositoriesboolean

Whether Dependabot alerts is automatically enabled for new repositories.

To use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see "Managing security managers in your organization."

You can check which security and analysis features are currently enabled by using a GET /orgs/{org} request.

dependabot_security_updates_enabled_for_new_repositoriesboolean

Whether Dependabot security updates is automatically enabled for new repositories.

To use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see "Managing security managers in your organization."

You can check which security and analysis features are currently enabled by using a GET /orgs/{org} request.

dependency_graph_enabled_for_new_repositoriesboolean

Whether dependency graph is automatically enabled for new repositories.

To use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see "Managing security managers in your organization."

You can check which security and analysis features are currently enabled by using a GET /orgs/{org} request.

secret_scanning_enabled_for_new_repositoriesboolean

Whether secret scanning is automatically enabled for new repositories.

To use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see "Managing security managers in your organization."

You can check which security and analysis features are currently enabled by using a GET /orgs/{org} request.

secret_scanning_push_protection_enabled_for_new_repositoriesboolean

Whether secret scanning push protection is automatically enabled for new repositories.

To use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see "Managing security managers in your organization."

You can check which security and analysis features are currently enabled by using a GET /orgs/{org} request.

secret_scanning_push_protection_custom_link_enabledboolean

Whether a custom link is shown to contributors who are blocked from pushing a secret by push protection.

secret_scanning_push_protection_custom_linkstring

If secret_scanning_push_protection_custom_link_enabled is true, the URL that will be displayed to contributors who are blocked from pushing a secret.

"Update an organization"에 대한 HTTP 응답 상태 코드

상태 코드Description
200

OK

409

Conflict

422

Validation failed

"Update an organization"에 대한 코드 샘플

patch/orgs/{org}
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>"\ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG \ -d '{"billing_email":"mona@github.com","company":"GitHub","email":"mona@github.com","twitter_username":"github","location":"San Francisco","name":"github","description":"GitHub, the company.","default_repository_permission":"read","members_can_create_repositories":true,"members_allowed_repository_creation_type":"all"}'

Response

Status: 200
{ "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", "name": "github", "company": "GitHub", "blog": "https://github.com/blog", "location": "San Francisco", "email": "octocat@github.com", "twitter_username": "github", "is_verified": true, "has_organization_projects": true, "has_repository_projects": true, "public_repos": 2, "public_gists": 1, "followers": 20, "following": 0, "html_url": "https://github.com/octocat", "created_at": "2008-01-14T04:33:35Z", "type": "Organization", "total_private_repos": 100, "owned_private_repos": 100, "private_gists": 81, "disk_usage": 10000, "collaborators": 8, "billing_email": "mona@github.com", "plan": { "name": "Medium", "space": 400, "private_repos": 20, "filled_seats": 4, "seats": 5 }, "default_repository_permission": "read", "members_can_create_repositories": true, "two_factor_requirement_enabled": true, "members_allowed_repository_creation_type": "all", "members_can_create_public_repositories": false, "members_can_create_private_repositories": false, "members_can_create_internal_repositories": false, "members_can_create_pages": true, "members_can_create_public_pages": true, "members_can_create_private_pages": true, "members_can_fork_private_repositories": false, "web_commit_signoff_required": false, "updated_at": "2014-03-03T18:58:10Z", "dependency_graph_enabled_for_new_repositories": false, "dependabot_alerts_enabled_for_new_repositories": false, "dependabot_security_updates_enabled_for_new_repositories": false, "advanced_security_enabled_for_new_repositories": false, "secret_scanning_enabled_for_new_repositories": false, "secret_scanning_push_protection_enabled_for_new_repositories": false, "secret_scanning_push_protection_custom_link": false, "secret_scanning_push_protection_custom_link_enabled": "https://github.com/octo-org/octo-repo/blob/main/im-blocked.md" }

Get the audit log for an organization

에서 작동 GitHub Apps

Gets the audit log for an organization. For more information, see "Reviewing the audit log for your organization."

To use this endpoint, you must be an organization owner, and you must use an access token with the read:audit_log scope. GitHub Apps must have the organization_administration read permission to use this endpoint.

By default, the response includes up to 30 events from the past three months. Use the phrase parameter to filter results and retrieve older events. For example, use the phrase parameter with the created qualifier to filter events based on when the events occurred. For more information, see "Reviewing the audit log for your organization."

Use pagination to retrieve fewer or more than 30 events. For more information, see "Resources in the REST API."

"Get the audit log for an organization"에 대한 매개 변수

헤더
속성, 형식, Description
acceptstring

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

경로 매개 변수
속성, 형식, Description
orgstring필수

The organization name. The name is not case sensitive.

쿼리 매개 변수
속성, 형식, Description
phrasestring

A search phrase. For more information, see Searching the audit log.

includestring

The event types to include:

  • web - returns web (non-Git) events.
  • git - returns Git events.
  • all - returns both web and Git events.

The default is web.

다음 중 하나일 수 있습니다.: web, git, all

afterstring

A cursor, as given in the Link header. If specified, the query only searches for events after this cursor.

beforestring

A cursor, as given in the Link header. If specified, the query only searches for events before this cursor.

orderstring

The order of audit log events. To list newest events first, specify desc. To list oldest events first, specify asc.

The default is desc.

다음 중 하나일 수 있습니다.: desc, asc

per_pageinteger

The number of results per page (max 100).

기본값: 30

"Get the audit log for an organization"에 대한 HTTP 응답 상태 코드

상태 코드Description
200

OK

"Get the audit log for an organization"에 대한 코드 샘플

get/orgs/{org}/audit-log
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>"\ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/audit-log

Response

Status: 200
[ { "@timestamp": 1606929874512, "action": "team.add_member", "actor": "octocat", "created_at": 1606929874512, "_document_id": "xJJFlFOhQ6b-5vaAFy9Rjw", "org": "octo-corp", "team": "octo-corp/example-team", "user": "monalisa" }, { "@timestamp": 1606507117008, "action": "org.create", "actor": "octocat", "created_at": 1606507117008, "_document_id": "Vqvg6kZ4MYqwWRKFDzlMoQ", "org": "octocat-test-org" }, { "@timestamp": 1605719148837, "action": "repo.destroy", "actor": "monalisa", "created_at": 1605719148837, "_document_id": "LwW2vpJZCDS-WUmo9Z-ifw", "org": "mona-org", "repo": "mona-org/mona-test-repo", "visibility": "private" } ]

List SAML SSO authorizations for an organization

에서 작동 GitHub Apps

Listing and deleting credential authorizations is available to organizations with GitHub Enterprise Cloud. For more information, see GitHub's products.

An authenticated organization owner with the read:org scope can list all credential authorizations for an organization that uses SAML single sign-on (SSO). The credentials are either personal access tokens or SSH keys that organization members have authorized for the organization. For more information, see About authentication with SAML single sign-on.

"List SAML SSO authorizations for an organization"에 대한 매개 변수

헤더
속성, 형식, Description
acceptstring

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

경로 매개 변수
속성, 형식, Description
orgstring필수

The organization name. The name is not case sensitive.

쿼리 매개 변수
속성, 형식, Description
per_pageinteger

The number of results per page (max 100).

기본값: 30

pageinteger

Page token

loginstring

Limits the list of credentials authorizations for an organization to a specific login

"List SAML SSO authorizations for an organization"에 대한 HTTP 응답 상태 코드

상태 코드Description
200

OK

"List SAML SSO authorizations for an organization"에 대한 코드 샘플

get/orgs/{org}/credential-authorizations
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>"\ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/credential-authorizations

Response

Status: 200
[ { "login": "octocat", "credential_id": 161195, "credential_type": "personal access token", "token_last_eight": "71c3fc11", "credential_authorized_at": "2011-01-26T19:06:43Z", "credential_accessed_at": "2011-01-26T19:06:43Z", "authorized_credential_expires_at": "2011-02-25T19:06:43Z", "scopes": [ "user", "repo" ] }, { "login": "hubot", "credential_id": 161196, "credential_type": "personal access token", "token_last_eight": "Ae178B4a", "credential_authorized_at": "2019-03-29T19:06:43Z", "credential_accessed_at": "2011-01-26T19:06:43Z", "authorized_credential_expires_at": "2019-04-28T19:06:43Z", "scopes": [ "repo" ] } ]

Remove a SAML SSO authorization for an organization

에서 작동 GitHub Apps

Listing and deleting credential authorizations is available to organizations with GitHub Enterprise Cloud. For more information, see GitHub's products.

An authenticated organization owner with the admin:org scope can remove a credential authorization for an organization that uses SAML SSO. Once you remove someone's credential authorization, they will need to create a new personal access token or SSH key and authorize it for the organization they want to access.

"Remove a SAML SSO authorization for an organization"에 대한 매개 변수

헤더
속성, 형식, Description
acceptstring

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

경로 매개 변수
속성, 형식, Description
orgstring필수

The organization name. The name is not case sensitive.

credential_idinteger필수

"Remove a SAML SSO authorization for an organization"에 대한 HTTP 응답 상태 코드

상태 코드Description
204

No Content

404

Resource not found

"Remove a SAML SSO authorization for an organization"에 대한 코드 샘플

delete/orgs/{org}/credential-authorizations/{credential_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>"\ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/credential-authorizations/CREDENTIAL_ID

Response

Status: 204

List app installations for an organization

에서 작동 GitHub Apps

Lists all GitHub Apps in an organization. The installation count includes all GitHub Apps installed on repositories in the organization. You must be an organization owner with admin:read scope to use this endpoint.

"List app installations for an organization"에 대한 매개 변수

헤더
속성, 형식, Description
acceptstring

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

경로 매개 변수
속성, 형식, Description
orgstring필수

The organization name. The name is not case sensitive.

쿼리 매개 변수
속성, 형식, Description
per_pageinteger

The number of results per page (max 100).

기본값: 30

pageinteger

Page number of the results to fetch.

기본값: 1

"List app installations for an organization"에 대한 HTTP 응답 상태 코드

상태 코드Description
200

OK

"List app installations for an organization"에 대한 코드 샘플

get/orgs/{org}/installations
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>"\ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/installations

Response

Status: 200
{ "total_count": 1, "installations": [ { "id": 25381, "account": { "login": "octo-org", "id": 6811672, "node_id": "MDEyOk9yZ2FuaXphdGlvbjY4MTE2NzI=", "avatar_url": "https://avatars3.githubusercontent.com/u/6811672?v=4", "gravatar_id": "", "url": "https://api.github.com/users/octo-org", "html_url": "https://github.com/octo-org", "followers_url": "https://api.github.com/users/octo-org/followers", "following_url": "https://api.github.com/users/octo-org/following{/other_user}", "gists_url": "https://api.github.com/users/octo-org/gists{/gist_id}", "starred_url": "https://api.github.com/users/octo-org/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octo-org/subscriptions", "organizations_url": "https://api.github.com/users/octo-org/orgs", "repos_url": "https://api.github.com/users/octo-org/repos", "events_url": "https://api.github.com/users/octo-org/events{/privacy}", "received_events_url": "https://api.github.com/users/octo-org/received_events", "type": "Organization", "site_admin": false }, "repository_selection": "selected", "access_tokens_url": "https://api.github.com/app/installations/25381/access_tokens", "repositories_url": "https://api.github.com/installation/repositories", "html_url": "https://github.com/organizations/octo-org/settings/installations/25381", "app_id": 2218, "target_id": 6811672, "target_type": "Organization", "permissions": { "deployments": "write", "metadata": "read", "pull_requests": "read", "statuses": "read" }, "events": [ "deployment", "deployment_status" ], "created_at": "2017-05-16T08:47:09.000-07:00", "updated_at": "2017-06-06T11:23:23.000-07:00", "single_file_name": "config.yml", "has_multiple_single_files": true, "single_file_paths": [ "config.yml", ".github/issue_TEMPLATE.md" ], "app_slug": "github-actions", "suspended_at": null, "suspended_by": null } ] }

Enable or disable a security feature for an organization

에서 작동 GitHub Apps

Enables or disables the specified security feature for all eligible repositories in an organization.

To use this endpoint, you must be an organization owner or be member of a team with the security manager role. A token with the 'write:org' scope is also required.

GitHub Apps must have the organization_administration:write permission to use this endpoint.

For more information, see "Managing security managers in your organization."

"Enable or disable a security feature for an organization"에 대한 매개 변수

헤더
속성, 형식, Description
acceptstring

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

경로 매개 변수
속성, 형식, Description
orgstring필수

The organization name. The name is not case sensitive.

security_productstring필수

The security feature to enable or disable.

다음 중 하나일 수 있습니다.: dependency_graph, dependabot_alerts, dependabot_security_updates, advanced_security, code_scanning_default_setup, secret_scanning, secret_scanning_push_protection

enablementstring필수

The action to take.

enable_all means to enable the specified security feature for all repositories in the organization. disable_all means to disable the specified security feature for all repositories in the organization.

다음 중 하나일 수 있습니다.: enable_all, disable_all

"Enable or disable a security feature for an organization"에 대한 HTTP 응답 상태 코드

상태 코드Description
204

Action started

422

The action could not be taken due to an in progress enablement, or a policy is preventing enablement

"Enable or disable a security feature for an organization"에 대한 코드 샘플

post/orgs/{org}/{security_product}/{enablement}
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>"\ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/SECURITY_PRODUCT/ENABLEMENT

Action started

Status: 204

List organizations for the authenticated user

List organizations for the authenticated user.

OAuth scope requirements

This only lists organizations that your authorization allows you to operate on in some way (e.g., you can list teams with read:org scope, you can publicize your organization membership with user scope, etc.). Therefore, this API requires at least user or read:org scope. OAuth requests with insufficient scope receive a 403 Forbidden response.

"List organizations for the authenticated user"에 대한 매개 변수

헤더
속성, 형식, Description
acceptstring

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

쿼리 매개 변수
속성, 형식, Description
per_pageinteger

The number of results per page (max 100).

기본값: 30

pageinteger

Page number of the results to fetch.

기본값: 1

"List organizations for the authenticated user"에 대한 HTTP 응답 상태 코드

상태 코드Description
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

"List organizations for the authenticated user"에 대한 코드 샘플

get/user/orgs
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>"\ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/user/orgs

Response

Status: 200
[ { "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" } ]

List organizations for a user

에서 작동 GitHub Apps

List public organization memberships for the specified user.

This method only lists public memberships, regardless of authentication. If you need to fetch all of the organization memberships (public and private) for the authenticated user, use the List organizations for the authenticated user API instead.

"List organizations for a user"에 대한 매개 변수

헤더
속성, 형식, Description
acceptstring

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

경로 매개 변수
속성, 형식, Description
usernamestring필수

The handle for the GitHub user account.

쿼리 매개 변수
속성, 형식, Description
per_pageinteger

The number of results per page (max 100).

기본값: 30

pageinteger

Page number of the results to fetch.

기본값: 1

"List organizations for a user"에 대한 HTTP 응답 상태 코드

상태 코드Description
200

OK

"List organizations for a user"에 대한 코드 샘플

get/users/{username}/orgs
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>"\ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/users/USERNAME/orgs

Response

Status: 200
[ { "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" } ]