GitHub: Create an organization invitation
GitHub orgs.orgsCreateInvitation: arguments, response, policy and SDK examples.
← Orgs operations · Get started
Operation github.orgs_create_invitation
Provider route: POST /orgs/{org}/invitations. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/github with npm, or alter-sdk-github with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { GitHubIntegration } from "@alter-ai/github";
async function execute(input: Parameters<GitHubIntegration["orgs"]["orgsCreateInvitation"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new GitHubIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.orgs.orgsCreateInvitation(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_github import GitHubIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = GitHubIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.orgs.orgs_create_invitation(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.org | string | Required within parent | |
body | object | Optional | |
body.email | string | Optional | Required unless you provide `invitee_id`. Email address of the person you are inviting, which can be an existing GitHub user. |
body.invitee_id | integer | Optional | Required unless you provide `email`. GitHub user ID for the person you are inviting. |
body.role | string | Optional | The role for the new member. * `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. * `reinstate` - The previous role assigned to the invitee before they were removed from your organization. Can be one of the roles listed above. Only works if the invitee was previously part of your organization. Default: direct_member One of: admin, direct_member, billing_manager, reinstate |
body.team_ids | array | Optional | Specify IDs for the teams you want to invite new members to. |
body.team_ids[] | integer | Each item |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Create an organization invitation — response body |
Referenced models: Create an organization invitation — response body
Schemas
Section titled “Schemas”Create an organization invitation — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Organization Invitation |
created_at | string | Required within parent | |
email | JSON | Required within parent | |
email (anyOf 1) | string | Alternative | |
email (anyOf 2) | null | Alternative | |
failed_at | JSON | Optional | |
failed_at (anyOf 1) | string | Alternative | |
failed_at (anyOf 2) | null | Alternative | |
failed_reason | JSON | Optional | |
failed_reason (anyOf 1) | string | Alternative | |
failed_reason (anyOf 2) | null | Alternative | |
id | JSON | Required within parent | |
id (anyOf 1) | integer | Alternative | Format: int64 |
id (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
invitation_source | string | Optional | |
invitation_teams_url | string | Required within parent | |
inviter | Model | Required within parent | Expand List users — response body — item |
login | JSON | Required within parent | |
login (anyOf 1) | string | Alternative | |
login (anyOf 2) | null | Alternative | |
node_id | string | Required within parent | |
role | string | Required within parent | |
team_count | JSON | Required within parent | |
team_count (anyOf 1) | integer | Alternative | |
team_count (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Referenced models: List users — response body — item
List users — response body — item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A GitHub user. |
avatar_url | string | Required within parent | Format: uri |
email | JSON | Optional | |
email (anyOf 1) | string | Alternative | |
email (anyOf 2) | null | Alternative | |
events_url | string | Required within parent | |
followers_url | string | Required within parent | Format: uri |
following_url | string | Required within parent | |
gists_url | string | Required within parent | |
gravatar_id | JSON | Required within parent | |
gravatar_id (anyOf 1) | string | Alternative | |
gravatar_id (anyOf 2) | null | Alternative | |
html_url | string | Required within parent | Format: uri |
id | JSON | Required within parent | |
id (anyOf 1) | integer | Alternative | Format: int64 |
id (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
login | string | Required within parent | |
name | JSON | Optional | |
name (anyOf 1) | string | Alternative | |
name (anyOf 2) | null | Alternative | |
node_id | string | Required within parent | |
organizations_url | string | Required within parent | Format: uri |
received_events_url | string | Required within parent | Format: uri |
repos_url | string | Required within parent | Format: uri |
site_admin | boolean | Required within parent | |
starred_at | string | Optional | |
starred_url | string | Required within parent | |
subscriptions_url | string | Required within parent | Format: uri |
type | string | Required within parent | |
url | string | Required within parent | Format: uri |
user_view_type | string | Optional |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: github.orgs_create_invitation. Catalog operation: orgs/create-invitation. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Pinned headers: {"X-GitHub-Api-Version": "2026-03-10", "User-Agent": "Alter", "Accept": "application/vnd.github+json"}