Skip to main content

orgs

Creates, updates, deletes, gets or lists an orgs resource.

Overview​

Nameorgs
TypeResource
Idgithub.orgs.orgs

Fields​

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idinteger
namestring (example: github)
node_idstring (example: MDEyOk9yZ2FuaXphdGlvbjE=)
advanced_security_enabled_for_new_repositoriesbooleanEndpoint closing down notice. Please use code security configurations instead. Whether GitHub Advanced Security is enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role.
archived_atstring (date-time)
avatar_urlstring (example: https://github.com/images/error/octocat_happy.gif)
billing_emailstring (email) (example: org@example.com)
blogstring (uri) (example: https://github.com/blog)
collaboratorsintegerThe number of collaborators on private repositories. This field may be null if the number of private repositories is over 50,000.
companystring (example: GitHub)
created_atstring (date-time) (example: 2008-01-14T04:33:35Z)
default_repository_branchstringThe default branch for repositories created in this organization. (example: main)
default_repository_permissionstring
dependabot_alerts_enabled_for_new_repositoriesbooleanEndpoint closing down notice. Please use code security configurations instead. Whether Dependabot alerts are automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role.
dependabot_security_updates_enabled_for_new_repositoriesbooleanEndpoint closing down notice. Please use code security configurations instead. Whether Dependabot security updates are automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role.
dependency_graph_enabled_for_new_repositoriesbooleanEndpoint closing down notice. Please use code security configurations instead. Whether dependency graph is automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role.
deploy_keys_enabled_for_repositoriesbooleanControls whether or not deploy keys may be added and used for repositories in the organization.
descriptionstring (example: A great organization)
disk_usageinteger
display_commenter_full_name_setting_enabledboolean
emailstring (email) (example: octocat@github.com)
events_urlstring (uri) (example: https://api.github.com/orgs/github/events)
followersinteger
followinginteger
has_organization_projectsboolean
has_repository_projectsboolean
hooks_urlstring (example: https://api.github.com/orgs/github/hooks)
html_urlstring (uri) (example: https://github.com/octocat)
is_verifiedboolean
issues_urlstring (example: https://api.github.com/orgs/github/issues)
locationstring (example: San Francisco)
loginstring (example: github)
members_allowed_repository_creation_typestring (example: all)
members_can_change_repo_visibilityboolean
members_can_create_internal_repositoriesboolean
members_can_create_pagesboolean
members_can_create_private_pagesboolean
members_can_create_private_repositoriesboolean
members_can_create_public_pagesboolean
members_can_create_public_repositoriesboolean
members_can_create_repositoriesboolean
members_can_create_teamsboolean
members_can_delete_issuesboolean
members_can_delete_repositoriesboolean
members_can_fork_private_repositoriesboolean
members_can_invite_outside_collaboratorsboolean
members_can_view_dependency_insightsboolean
members_urlstring (example: https://api.github.com/orgs/github/members{/member})
owned_private_reposinteger
planobject
private_gistsinteger
public_gistsinteger
public_members_urlstring (example: https://api.github.com/orgs/github/public_members{/member})
public_reposinteger
readers_can_create_discussionsboolean
repos_urlstring (uri) (example: https://api.github.com/orgs/github/repos)
secret_scanning_enabled_for_new_repositoriesbooleanEndpoint closing down notice. Please use code security configurations instead. Whether secret scanning is automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role.
secret_scanning_push_protection_custom_linkstringAn optional URL string to display to contributors who are blocked from pushing a secret. (example: https://github.com/test-org/test-repo/blob/main/README.md)
secret_scanning_push_protection_custom_link_enabledbooleanWhether a custom link is shown to contributors who are blocked from pushing a secret by push protection.
secret_scanning_push_protection_enabled_for_new_repositoriesbooleanEndpoint closing down notice. Please use code security configurations instead. Whether secret scanning push protection is automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role.
total_private_reposinteger
twitter_usernamestring (example: github)
two_factor_requirement_enabledboolean
typestring (example: Organization)
updated_atstring (date-time)
urlstring (uri) (example: https://api.github.com/orgs/github)
web_commit_signoff_requiredboolean

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectorgGets information about an organization.

When the value of two_factor_requirement_enabled is true, the organization requires all members, billing managers, outside collaborators, guest collaborators, repository collaborators, or everyone with access to any repository within the organization to enable two-factor authentication.

To see the full details about an organization, the authenticated user must be an organization owner.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to see the full details about an organization.

To see information about an organization's GitHub plan, GitHub Apps need the Organization plan permission.
list_for_userselectusernameper_page, pageList 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.
listselectsince, per_pageLists all organizations, in the order that they were created.

> [!NOTE]
> Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of organizations.
updateupdateorg> [!WARNING]
> Closing down notice: GitHub 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.

> [!WARNING]
> Closing down notice: Code security product enablement for new repositories through the organization API is closing down. Please use code security configurations to set defaults instead. For more information on setting a default security configuration, see the changelog.

Updates the organization's profile and member privileges.

The authenticated user must be an organization owner to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:org or repo scope to use this endpoint.
deletedeleteorgDeletes an organization and all its repositories.

The organization login will be unavailable for 90 days after deletion.

Please review the Terms of Service regarding account deletion before using this endpoint:

https://docs.github.com/site-policy/github-terms/github-terms-of-service
enable_or_disable_security_product_on_all_org_reposexecorg, security_product, enablement> [!WARNING]
> Closing down notice: The ability to enable or disable a security feature for all eligible repositories in an organization is closing down. Please use code security configurations instead. For more information, see the changelog.

Enables or disables the specified security feature for all eligible repositories in an organization. For more information, see "Managing security managers in your organization."

The authenticated user must be an organization owner or be member of a team with the security manager role to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:org, write:org, or repo scopes to use this endpoint.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
enablementstringThe 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.
orgstringThe organization name. The name is not case sensitive.
security_productstringThe security feature to enable or disable.
usernamestringThe handle for the GitHub user account.
pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
sinceintegerAn organization ID. Only return organizations with an ID greater than this ID.

SELECT examples​

Gets information about an organization.

When the value of two_factor_requirement_enabled is true, the organization requires all members, billing managers, outside collaborators, guest collaborators, repository collaborators, or everyone with access to any repository within the organization to enable two-factor authentication.

To see the full details about an organization, the authenticated user must be an organization owner.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to see the full details about an organization.

To see information about an organization's GitHub plan, GitHub Apps need the Organization plan permission.

SELECT
id,
name,
node_id,
advanced_security_enabled_for_new_repositories,
archived_at,
avatar_url,
billing_email,
blog,
collaborators,
company,
created_at,
default_repository_branch,
default_repository_permission,
dependabot_alerts_enabled_for_new_repositories,
dependabot_security_updates_enabled_for_new_repositories,
dependency_graph_enabled_for_new_repositories,
deploy_keys_enabled_for_repositories,
description,
disk_usage,
display_commenter_full_name_setting_enabled,
email,
events_url,
followers,
following,
has_organization_projects,
has_repository_projects,
hooks_url,
html_url,
is_verified,
issues_url,
location,
login,
members_allowed_repository_creation_type,
members_can_change_repo_visibility,
members_can_create_internal_repositories,
members_can_create_pages,
members_can_create_private_pages,
members_can_create_private_repositories,
members_can_create_public_pages,
members_can_create_public_repositories,
members_can_create_repositories,
members_can_create_teams,
members_can_delete_issues,
members_can_delete_repositories,
members_can_fork_private_repositories,
members_can_invite_outside_collaborators,
members_can_view_dependency_insights,
members_url,
owned_private_repos,
plan,
private_gists,
public_gists,
public_members_url,
public_repos,
readers_can_create_discussions,
repos_url,
secret_scanning_enabled_for_new_repositories,
secret_scanning_push_protection_custom_link,
secret_scanning_push_protection_custom_link_enabled,
secret_scanning_push_protection_enabled_for_new_repositories,
total_private_repos,
twitter_username,
two_factor_requirement_enabled,
type,
updated_at,
url,
web_commit_signoff_required
FROM github.orgs.orgs
WHERE org = '{{ org }}' -- required
;

UPDATE examples​

> [!WARNING]
> Closing down notice: GitHub 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.

> [!WARNING]
> Closing down notice: Code security product enablement for new repositories through the organization API is closing down. Please use code security configurations to set defaults instead. For more information on setting a default security configuration, see the changelog.

Updates the organization's profile and member privileges.

The authenticated user must be an organization owner to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:org or repo scope to use this endpoint.

UPDATE github.orgs.orgs
SET
billing_email = '{{ billing_email }}',
company = '{{ company }}',
email = '{{ email }}',
twitter_username = '{{ twitter_username }}',
location = '{{ location }}',
name = '{{ name }}',
description = '{{ description }}',
has_organization_projects = {{ has_organization_projects }},
has_repository_projects = {{ has_repository_projects }},
default_repository_permission = '{{ default_repository_permission }}',
members_can_create_repositories = {{ members_can_create_repositories }},
members_can_create_internal_repositories = {{ members_can_create_internal_repositories }},
members_can_create_private_repositories = {{ members_can_create_private_repositories }},
members_can_create_public_repositories = {{ members_can_create_public_repositories }},
members_allowed_repository_creation_type = '{{ members_allowed_repository_creation_type }}',
members_can_create_pages = {{ members_can_create_pages }},
members_can_create_public_pages = {{ members_can_create_public_pages }},
members_can_create_private_pages = {{ members_can_create_private_pages }},
members_can_fork_private_repositories = {{ members_can_fork_private_repositories }},
web_commit_signoff_required = {{ web_commit_signoff_required }},
blog = '{{ blog }}',
advanced_security_enabled_for_new_repositories = {{ advanced_security_enabled_for_new_repositories }},
dependabot_alerts_enabled_for_new_repositories = {{ dependabot_alerts_enabled_for_new_repositories }},
dependabot_security_updates_enabled_for_new_repositories = {{ dependabot_security_updates_enabled_for_new_repositories }},
dependency_graph_enabled_for_new_repositories = {{ dependency_graph_enabled_for_new_repositories }},
secret_scanning_enabled_for_new_repositories = {{ secret_scanning_enabled_for_new_repositories }},
secret_scanning_push_protection_enabled_for_new_repositories = {{ secret_scanning_push_protection_enabled_for_new_repositories }},
secret_scanning_push_protection_custom_link_enabled = {{ secret_scanning_push_protection_custom_link_enabled }},
secret_scanning_push_protection_custom_link = '{{ secret_scanning_push_protection_custom_link }}',
deploy_keys_enabled_for_repositories = {{ deploy_keys_enabled_for_repositories }}
WHERE
org = '{{ org }}' --required
RETURNING
id,
name,
node_id,
advanced_security_enabled_for_new_repositories,
archived_at,
avatar_url,
billing_email,
blog,
collaborators,
company,
created_at,
default_repository_branch,
default_repository_permission,
dependabot_alerts_enabled_for_new_repositories,
dependabot_security_updates_enabled_for_new_repositories,
dependency_graph_enabled_for_new_repositories,
deploy_keys_enabled_for_repositories,
description,
disk_usage,
display_commenter_full_name_setting_enabled,
email,
events_url,
followers,
following,
has_organization_projects,
has_repository_projects,
hooks_url,
html_url,
is_verified,
issues_url,
location,
login,
members_allowed_repository_creation_type,
members_can_change_repo_visibility,
members_can_create_internal_repositories,
members_can_create_pages,
members_can_create_private_pages,
members_can_create_private_repositories,
members_can_create_public_pages,
members_can_create_public_repositories,
members_can_create_repositories,
members_can_create_teams,
members_can_delete_issues,
members_can_delete_repositories,
members_can_fork_private_repositories,
members_can_invite_outside_collaborators,
members_can_view_dependency_insights,
members_url,
owned_private_repos,
plan,
private_gists,
public_gists,
public_members_url,
public_repos,
readers_can_create_discussions,
repos_url,
secret_scanning_enabled_for_new_repositories,
secret_scanning_push_protection_custom_link,
secret_scanning_push_protection_custom_link_enabled,
secret_scanning_push_protection_enabled_for_new_repositories,
total_private_repos,
twitter_username,
two_factor_requirement_enabled,
type,
updated_at,
url,
web_commit_signoff_required;

DELETE examples​

Deletes an organization and all its repositories.

The organization login will be unavailable for 90 days after deletion.

Please review the Terms of Service regarding account deletion before using this endpoint:

https://docs.github.com/site-policy/github-terms/github-terms-of-service

DELETE FROM github.orgs.orgs
WHERE org = '{{ org }}' --required
;

Lifecycle Methods​

> [!WARNING]
> Closing down notice: The ability to enable or disable a security feature for all eligible repositories in an organization is closing down. Please use code security configurations instead. For more information, see the changelog.

Enables or disables the specified security feature for all eligible repositories in an organization. For more information, see "Managing security managers in your organization."

The authenticated user must be an organization owner or be member of a team with the security manager role to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:org, write:org, or repo scopes to use this endpoint.

EXEC github.orgs.orgs.enable_or_disable_security_product_on_all_org_repos
@org='{{ org }}' --required,
@security_product='{{ security_product }}' --required,
@enablement='{{ enablement }}' --required
@@json=
'{
"query_suite": "{{ query_suite }}"
}'
;