Block a user from an organization

octokit.orgs.blockUser({
org,
username,
});

Parameters

namerequireddescription
orgyes
usernameyes

See also: GitHub Developer Guide documentation.

Cancel an organization invitation

Cancel an organization invitation. In order to cancel an organization invitation, the authenticated user must be an organization owner.

This endpoint triggers notifications.

octokit.orgs.cancelInvitation({
org,
invitation_id,
});

Parameters

namerequireddescription
orgyes
invitation_idyes

invitation_id parameter

See also: GitHub Developer Guide documentation.

Check if a user is blocked by an organization

octokit.orgs.checkBlockedUser({
org,
username,
});

Parameters

namerequireddescription
orgyes
usernameyes

See also: GitHub Developer Guide documentation.

Check organization membership for a user

Check if a user is, publicly or privately, a member of the organization.

octokit.orgs.checkMembershipForUser({
org,
username,
});

Parameters

namerequireddescription
orgyes
usernameyes

See also: GitHub Developer Guide documentation.

Check public organization membership for a user

octokit.orgs.checkPublicMembershipForUser({
org,
username,
});

Parameters

namerequireddescription
orgyes
usernameyes

See also: GitHub Developer Guide documentation.

Convert an organization member to outside collaborator

When an organization member is converted to an outside collaborator, they'll only have access to the repositories that their current team membership allows. The user will no longer be a member of the organization. For more information, see "Converting an organization member to an outside collaborator".

octokit.orgs.convertMemberToOutsideCollaborator({
org,
username,
});

Parameters

namerequireddescription
orgyes
usernameyes

See also: GitHub Developer Guide documentation.

Create an organization invitation

Invite people to an organization by using their GitHub user ID or their email address. In order to create invitations in an organization, the authenticated user must be an organization owner.

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.

octokit.orgs.createInvitation({
org,
});

Parameters

namerequireddescription
orgyes
invitee_idno

Required unless you provide email. GitHub user ID for the person you are inviting.

emailno

Required unless you provide invitee_id. Email address of the person you are inviting, which can be an existing GitHub user.

roleno

Specify role for new member. Can be one of:
* admin - Organization owners with full administrative rights to the organization and complete access to all repositories and teams.
* direct_member - Non-owner organization members with ability to see other members and join teams by invitation.
* billing_manager - Non-owner organization members with ability to manage the billing settings of your organization.

team_idsno

Specify IDs for the teams you want to invite new members to.

See also: GitHub Developer Guide documentation.

Create an organization webhook

Here's how you can create a hook that posts payloads in JSON format:

octokit.orgs.createWebhook({
org,
name,
config,
config.url
})

Parameters

namerequireddescription
orgyes
nameyes

Must be passed as "web".

configyes

Key/value pairs to provide settings for this webhook. These are defined below.

config.urlyes

The URL to which the payloads will be delivered.

config.content_typeno

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

config.secretno

If provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers.

config.insecure_sslno

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.

config.usernameno
config.passwordno
eventsno

Determines what events the hook is triggered for.

activeno

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

See also: GitHub Developer Guide documentation.

Delete an organization webhook

octokit.orgs.deleteWebhook({
org,
hook_id,
});

Parameters

namerequireddescription
orgyes
hook_idyes

See also: GitHub Developer Guide documentation.

Get an organization

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 plan. See "Authenticating with GitHub Apps" for details. For an example response, see 'Response with GitHub plan information' below."

octokit.orgs.get({
org,
});

Parameters

namerequireddescription
orgyes

See also: GitHub Developer Guide documentation.

Get an organization membership for the authenticated user

octokit.orgs.getMembershipForAuthenticatedUser({
org,
});

Parameters

namerequireddescription
orgyes

See also: GitHub Developer Guide documentation.

Get organization membership for a user

In order to get a user's membership with an organization, the authenticated user must be an organization member.

octokit.orgs.getMembershipForUser({
org,
username,
});

Parameters

namerequireddescription
orgyes
usernameyes

See also: GitHub Developer Guide documentation.

Get an organization webhook

Returns a webhook configured in an organization. To get only the webhook config properties, see "Get a webhook configuration for an organization."

octokit.orgs.getWebhook({
org,
hook_id,
});

Parameters

namerequireddescription
orgyes
hook_idyes

See also: GitHub Developer Guide documentation.

Get a webhook configuration for an organization

Returns the webhook configuration for an organization. To get more information about the webhook, including the active state and events, use "Get an organization webhook ."

Access tokens must have the admin:org_hook scope, and GitHub Apps must have the organization_hooks:read permission.

octokit.orgs.getWebhookConfigForOrg({
org,
hook_id,
});

Parameters

namerequireddescription
orgyes
hook_idyes

See also: GitHub Developer Guide documentation.

List organizations

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

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

octokit.orgs.list();

Parameters

namerequireddescription
sinceno

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

per_pageno

Results per page (max 100)

See also: GitHub Developer Guide documentation.

List app installations for an organization

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.

octokit.orgs.listAppInstallations({
org,
});

Parameters

namerequireddescription
orgyes
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List users blocked by an organization

List the users blocked by an organization.

octokit.orgs.listBlockedUsers({
org,
});

Parameters

namerequireddescription
orgyes

See also: GitHub Developer Guide documentation.

List failed organization invitations

The return hash contains failed_at and failed_reason fields which represent the time at which the invitation failed and the reason for the failure.

octokit.orgs.listFailedInvitations({
org,
});

Parameters

namerequireddescription
orgyes
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

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.

octokit.orgs.listForAuthenticatedUser();

Parameters

namerequireddescription
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List organizations for a user

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.

octokit.orgs.listForUser({
username,
});

Parameters

namerequireddescription
usernameyes
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List organization invitation teams

List all teams associated with an invitation. In order to see invitations in an organization, the authenticated user must be an organization owner.

octokit.orgs.listInvitationTeams({
org,
invitation_id,
});

Parameters

namerequireddescription
orgyes
invitation_idyes

invitation_id parameter

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List organization members

List all users who are members of an organization. If the authenticated user is also a member of this organization then both concealed and public members will be returned.

octokit.orgs.listMembers({
org,
});

Parameters

namerequireddescription
orgyes
filterno

Filter members returned in the list. Can be one of:
* 2fa_disabled - Members without two-factor authentication enabled. Available for organization owners.
* all - All members the authenticated user can see.

roleno

Filter members returned by their role. Can be one of:
* all - All members of the organization, regardless of role.
* admin - Organization owners.
* member - Non-owner organization members.

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List organization memberships for the authenticated user

octokit.orgs.listMembershipsForAuthenticatedUser();

Parameters

namerequireddescription
stateno

Indicates the state of the memberships to return. Can be either active or pending. If not specified, the API returns both active and pending memberships.

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List outside collaborators for an organization

List all users who are outside collaborators of an organization.

octokit.orgs.listOutsideCollaborators({
org,
});

Parameters

namerequireddescription
orgyes
filterno

Filter the list of outside collaborators. Can be one of:
* 2fa_disabled: Outside collaborators without two-factor authentication enabled.
* all: All outside collaborators.

per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List pending organization invitations

The return hash contains a role field which refers to the Organization Invitation role and will be one of the following values: direct_member, admin, billing_manager, hiring_manager, or reinstate. If the invitee is not a GitHub member, the login field in the return hash will be null.

octokit.orgs.listPendingInvitations({
org,
});

Parameters

namerequireddescription
orgyes
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List public organization members

Members of an organization can choose to have their membership publicized or not.

octokit.orgs.listPublicMembers({
org,
});

Parameters

namerequireddescription
orgyes
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List organization webhooks

octokit.orgs.listWebhooks({
org,
});

Parameters

namerequireddescription
orgyes
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

Ping an organization webhook

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

octokit.orgs.pingWebhook({
org,
hook_id,
});

Parameters

namerequireddescription
orgyes
hook_idyes

See also: GitHub Developer Guide documentation.

Remove an organization member

Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories.

octokit.orgs.removeMember({
org,
username,
});

Parameters

namerequireddescription
orgyes
usernameyes

See also: GitHub Developer Guide documentation.

Remove organization membership for a user

In order to remove a user's membership with an organization, the authenticated user must be an organization owner.

If the specified user is an active member of the organization, this will remove them from the organization. If the specified user has been invited to the organization, this will cancel their invitation. The specified user will receive an email notification in both cases.

octokit.orgs.removeMembershipForUser({
org,
username,
});

Parameters

namerequireddescription
orgyes
usernameyes

See also: GitHub Developer Guide documentation.

Remove outside collaborator from an organization

Removing a user from this list will remove them from all the organization's repositories.

octokit.orgs.removeOutsideCollaborator({
org,
username,
});

Parameters

namerequireddescription
orgyes
usernameyes

See also: GitHub Developer Guide documentation.

Remove public organization membership for the authenticated user

octokit.orgs.removePublicMembershipForAuthenticatedUser({
org,
username,
});

Parameters

namerequireddescription
orgyes
usernameyes

See also: GitHub Developer Guide documentation.

Set organization membership for a user

Only authenticated organization owners can add a member to the organization or update the member's role.

  • If the authenticated user is adding a member to the organization, the invited user will receive an email inviting them to the organization. The user's membership status will be pending until they accept the invitation.
  • Authenticated users can update a user's membership by passing the role parameter. If the authenticated user changes a member's role to admin, the affected user will receive an email notifying them that they've been made an organization owner. If the authenticated user changes an owner's role to member, no email will be sent.

Rate limits

To prevent abuse, the authenticated user is limited to 50 organization invitations per 24 hour period. If the organization is more than one month old or on a paid plan, the limit is 500 invitations per 24 hour period.

octokit.orgs.setMembershipForUser({
org,
username,
});

Parameters

namerequireddescription
orgyes
usernameyes
roleno

The role to give the user in the organization. Can be one of:
* admin - The user will become an owner of the organization.
* member - The user will become a non-owner member of the organization.

See also: GitHub Developer Guide documentation.

Set public organization membership for the authenticated user

The user can publicize their own membership. (A user cannot publicize the membership for another user.)

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

octokit.orgs.setPublicMembershipForAuthenticatedUser({
org,
username,
});

Parameters

namerequireddescription
orgyes
usernameyes

See also: GitHub Developer Guide documentation.

Unblock a user from an organization

octokit.orgs.unblockUser({
org,
username,
});

Parameters

namerequireddescription
orgyes
usernameyes

See also: GitHub Developer Guide documentation.

Update an organization

Parameter Deprecation 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.

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

octokit.orgs.update({
org,
});

Parameters

namerequireddescription
orgyes
billing_emailno

Billing email address. This address is not publicized.

companyno

The company name.

emailno

The publicly visible email address.

twitter_usernameno

The Twitter username of the company.

locationno

The location.

nameno

The shorthand name of the company.

descriptionno

The description of the company.

has_organization_projectsno

Toggles whether an organization can use organization projects.

has_repository_projectsno

Toggles whether repositories that belong to the organization can use repository projects.

default_repository_permissionno

Default permission level members have for organization repositories:
* read - can pull, but not push to or administer this repository.
* write - can pull and push, but not administer this repository.
* admin - can pull, push, and administer this repository.
* none - no permissions granted by default.

members_can_create_repositoriesno

Toggles the ability of non-admin organization members to create repositories. Can be one of:
* true - all organization members can create repositories.
* false - only organization owners can create repositories.
Default: true
Note: A parameter can override this parameter. See members_allowed_repository_creation_type in this table for details. Note: A parameter can override this parameter. See members_allowed_repository_creation_type in this table for details.

members_can_create_internal_repositoriesno

Toggles 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+. Can be one of:
* true - all organization members can create internal repositories.
* false - only organization owners can create internal repositories.
Default: true. For more information, see "Restricting repository creation in your organization" in the GitHub Help documentation.

members_can_create_private_repositoriesno

Toggles whether organization members can create private repositories, which are visible to organization members with permission. Can be one of:
* true - all organization members can create private repositories.
* false - only organization owners can create private repositories.
Default: true. For more information, see "Restricting repository creation in your organization" in the GitHub Help documentation.

members_can_create_public_repositoriesno

Toggles whether organization members can create public repositories, which are visible to anyone. Can be one of:
* true - all organization members can create public repositories.
* false - only organization owners can create public repositories.
Default: true. For more information, see "Restricting repository creation in your organization" in the GitHub Help documentation.

members_allowed_repository_creation_typeno

Specifies which types of repositories non-admin organization members can create. Can be one of:
* all - all organization members can create public and private repositories.
* private - members can create private repositories. This option is only available to repositories that are part of an organization on GitHub Enterprise Cloud.
* none - only admin members can create repositories.
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.

members_can_create_pagesno

Toggles whether organization members can create GitHub Pages sites. Can be one of:
* true - all organization members can create GitHub Pages sites.
* false - no organization members can create GitHub Pages sites. Existing published sites will not be impacted.

members_can_create_public_pagesno

Toggles whether organization members can create public GitHub Pages sites. Can be one of:
* true - all organization members can create public GitHub Pages sites.
* false - no organization members can create public GitHub Pages sites. Existing published sites will not be impacted.

members_can_create_private_pagesno

Toggles whether organization members can create private GitHub Pages sites. Can be one of:
* true - all organization members can create private GitHub Pages sites.
* false - no organization members can create private GitHub Pages sites. Existing published sites will not be impacted.

blogno

See also: GitHub Developer Guide documentation.

Update an organization membership for the authenticated user

octokit.orgs.updateMembershipForAuthenticatedUser({
org,
state,
});

Parameters

namerequireddescription
orgyes
stateyes

The state that the membership should be in. Only "active" will be accepted.

See also: GitHub Developer Guide documentation.

Update an organization webhook

Updates a webhook configured in an organization. When you update a webhook, the secret will be overwritten. If you previously had a secret set, you must provide the same secret or set a new secret or the secret will be removed. If you are only updating individual webhook config properties, use "Update a webhook configuration for an organization."

octokit.orgs.updateWebhook({
org,
hook_id,
config.url
})

Parameters

namerequireddescription
orgyes
hook_idyes
configno

Key/value pairs to provide settings for this webhook. These are defined below.

config.urlyes

The URL to which the payloads will be delivered.

config.content_typeno

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

config.secretno

If provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers.

config.insecure_sslno

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.

eventsno

Determines what events the hook is triggered for.

activeno

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

nameno

See also: GitHub Developer Guide documentation.

Update a webhook configuration for an organization

Updates the webhook configuration for an organization. To update more information about the webhook, including the active state and events, use "Update an organization webhook ."

Access tokens must have the admin:org_hook scope, and GitHub Apps must have the organization_hooks:write permission.

octokit.orgs.updateWebhookConfigForOrg({
org,
hook_id,
});

Parameters

namerequireddescription
orgyes
hook_idyes
urlno

The URL to which the payloads will be delivered.

content_typeno

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

secretno

If provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers.

insecure_sslno

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.

See also: GitHub Developer Guide documentation.