orgs
Creates, updates, deletes, gets or lists an orgs resource.
Overview​
| Name | orgs |
| Type | Resource |
| Id | github.orgs.orgs |
Fields​
The following fields are returned by SELECT queries:
- get
- list_for_user
- list
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | |
name | string | (example: github) |
node_id | string | (example: MDEyOk9yZ2FuaXphdGlvbjE=) |
advanced_security_enabled_for_new_repositories | boolean | Endpoint 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_at | string (date-time) | |
avatar_url | string | (example: https://github.com/images/error/octocat_happy.gif) |
billing_email | string (email) | (example: org@example.com) |
blog | string (uri) | (example: https://github.com/blog) |
collaborators | integer | The number of collaborators on private repositories. This field may be null if the number of private repositories is over 50,000. |
company | string | (example: GitHub) |
created_at | string (date-time) | (example: 2008-01-14T04:33:35Z) |
default_repository_branch | string | The default branch for repositories created in this organization. (example: main) |
default_repository_permission | string | |
dependabot_alerts_enabled_for_new_repositories | boolean | Endpoint 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_repositories | boolean | Endpoint 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_repositories | boolean | Endpoint 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_repositories | boolean | Controls whether or not deploy keys may be added and used for repositories in the organization. |
description | string | (example: A great organization) |
disk_usage | integer | |
display_commenter_full_name_setting_enabled | boolean | |
email | string (email) | (example: octocat@github.com) |
events_url | string (uri) | (example: https://api.github.com/orgs/github/events) |
followers | integer | |
following | integer | |
has_organization_projects | boolean | |
has_repository_projects | boolean | |
hooks_url | string | (example: https://api.github.com/orgs/github/hooks) |
html_url | string (uri) | (example: https://github.com/octocat) |
is_verified | boolean | |
issues_url | string | (example: https://api.github.com/orgs/github/issues) |
location | string | (example: San Francisco) |
login | string | (example: github) |
members_allowed_repository_creation_type | string | (example: all) |
members_can_change_repo_visibility | boolean | |
members_can_create_internal_repositories | boolean | |
members_can_create_pages | boolean | |
members_can_create_private_pages | boolean | |
members_can_create_private_repositories | boolean | |
members_can_create_public_pages | boolean | |
members_can_create_public_repositories | boolean | |
members_can_create_repositories | boolean | |
members_can_create_teams | boolean | |
members_can_delete_issues | boolean | |
members_can_delete_repositories | boolean | |
members_can_fork_private_repositories | boolean | |
members_can_invite_outside_collaborators | boolean | |
members_can_view_dependency_insights | boolean | |
members_url | string | (example: https://api.github.com/orgs/github/members{/member}) |
owned_private_repos | integer | |
plan | object | |
private_gists | integer | |
public_gists | integer | |
public_members_url | string | (example: https://api.github.com/orgs/github/public_members{/member}) |
public_repos | integer | |
readers_can_create_discussions | boolean | |
repos_url | string (uri) | (example: https://api.github.com/orgs/github/repos) |
secret_scanning_enabled_for_new_repositories | boolean | Endpoint 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_link | string | An 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_enabled | boolean | Whether a custom link is shown to contributors who are blocked from pushing a secret by push protection. |
secret_scanning_push_protection_enabled_for_new_repositories | boolean | Endpoint 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_repos | integer | |
twitter_username | string | (example: github) |
two_factor_requirement_enabled | boolean | |
type | string | (example: Organization) |
updated_at | string (date-time) | |
url | string (uri) | (example: https://api.github.com/orgs/github) |
web_commit_signoff_required | boolean |
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | |
node_id | string | (example: MDEyOk9yZ2FuaXphdGlvbjE=) |
avatar_url | string | (example: https://github.com/images/error/octocat_happy.gif) |
description | string | (example: A great organization) |
events_url | string (uri) | (example: https://api.github.com/orgs/github/events) |
hooks_url | string | (example: https://api.github.com/orgs/github/hooks) |
issues_url | string | (example: https://api.github.com/orgs/github/issues) |
login | string | (example: github) |
members_url | string | (example: https://api.github.com/orgs/github/members{/member}) |
public_members_url | string | (example: https://api.github.com/orgs/github/public_members{/member}) |
repos_url | string (uri) | (example: https://api.github.com/orgs/github/repos) |
url | string (uri) | (example: https://api.github.com/orgs/github) |
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | |
node_id | string | (example: MDEyOk9yZ2FuaXphdGlvbjE=) |
avatar_url | string | (example: https://github.com/images/error/octocat_happy.gif) |
description | string | (example: A great organization) |
events_url | string (uri) | (example: https://api.github.com/orgs/github/events) |
hooks_url | string | (example: https://api.github.com/orgs/github/hooks) |
issues_url | string | (example: https://api.github.com/orgs/github/issues) |
login | string | (example: github) |
members_url | string | (example: https://api.github.com/orgs/github/members{/member}) |
public_members_url | string | (example: https://api.github.com/orgs/github/public_members{/member}) |
repos_url | string (uri) | (example: https://api.github.com/orgs/github/repos) |
url | string (uri) | (example: https://api.github.com/orgs/github) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | org | 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. | |
list_for_user | select | username | per_page, page | 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 | select | since, per_page | Lists 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. | |
update | update | org | > [!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. | |
delete | delete | org | 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 | |
enable_or_disable_security_product_on_all_org_repos | exec | org, 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.
| Name | Datatype | Description |
|---|---|---|
enablement | string | 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. |
org | string | The organization name. The name is not case sensitive. |
security_product | string | The security feature to enable or disable. |
username | string | The handle for the GitHub user account. |
page | integer | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
per_page | integer | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
since | integer | An organization ID. Only return organizations with an ID greater than this ID. |
SELECT examples​
- get
- list_for_user
- list
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
;
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.
SELECT
id,
node_id,
avatar_url,
description,
events_url,
hooks_url,
issues_url,
login,
members_url,
public_members_url,
repos_url,
url
FROM github.orgs.orgs
WHERE username = '{{ username }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;
Lists 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.
SELECT
id,
node_id,
avatar_url,
description,
events_url,
hooks_url,
issues_url,
login,
members_url,
public_members_url,
repos_url,
url
FROM github.orgs.orgs
WHERE since = '{{ since }}'
AND per_page = '{{ per_page }}'
;
UPDATE examples​
- update
> [!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​
- delete
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​
- enable_or_disable_security_product_on_all_org_repos
> [!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 }}"
}'
;