Skip to main content

invitations

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

Overview

Nameinvitations
TypeResource
Idgithub.orgs.invitations

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idinteger (int64)
node_idstring (example: "MDIyOk9yZ2FuaXphdGlvbkludml0YXRpb24x")
created_atstring
emailstring
failed_atstring
failed_reasonstring
invitation_sourcestring (example: "member")
invitation_teams_urlstring (example: "https://api.github.com/organizations/16/invitations/1/teams")
inviterobjectA GitHub user. (title: Simple User)
loginstring
rolestring
team_countinteger

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_pending_invitationsselectorgper_page, page, role, invitation_sourceThe 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, or hiring_manager. If the invitee is not a GitHub
member, the login field in the return hash will be null.
create_invitationinsertorgInvite 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 secondary rate limiting. For more information, see "Rate limits for the API"
and "Best practices for using the REST API."
cancel_invitationdeleteorg, invitation_idCancel an organization invitation. In order to cancel an organization invitation, the authenticated user must be an organization owner.

This endpoint triggers notifications.

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
invitation_idintegerThe unique identifier of the invitation.
orgstringThe organization name. The name is not case sensitive.
invitation_sourcestringFilter invitations by their invitation source.
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."
rolestringFilter invitations by their member role.

SELECT examples

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, or hiring_manager. If the invitee is not a GitHub
member, the login field in the return hash will be null.

SELECT
id,
node_id,
created_at,
email,
failed_at,
failed_reason,
invitation_source,
invitation_teams_url,
inviter,
login,
role,
team_count
FROM github.orgs.invitations
WHERE org = '{{ org }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
AND role = '{{ role }}'
AND invitation_source = '{{ invitation_source }}'
;

INSERT examples

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 secondary rate limiting. For more information, see "Rate limits for the API"
and "Best practices for using the REST API."

INSERT INTO github.orgs.invitations (
invitee_id,
email,
role,
team_ids,
org
)
SELECT
{{ invitee_id }},
'{{ email }}',
'{{ role }}',
'{{ team_ids }}',
'{{ org }}'
RETURNING
id,
node_id,
created_at,
email,
failed_at,
failed_reason,
invitation_source,
invitation_teams_url,
inviter,
login,
role,
team_count
;

DELETE examples

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

This endpoint triggers notifications.

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