Accepting organization invitations from the API

The upcoming Team Memberships API gives you the power to invite new GitHub users to your organization via the API. We’re expanding the API to also allow users to view their organization membership statuses and accept any invitations they’ve received.

The new Organization Memberships API

When someone invites you to an organization, your membership with that organization begins in the “pending” state. The new list organization memberships endpoint allows you to find your pending memberships. You can then change them to “active” (accepting the invitation in the process) by using the edit organization membership endpoint.

New Team Membership API response attribute

Previously, responses from the add team membership and get team membership endpoints included a “status” attribute, which could either be “active” or “pending”. We’ve renamed this attribute from “status” to “state” for better consistency with our other API calls.

To give you time to update your apps, we’ll keep the legacy “status” attribute around alongside the new “state” attribute until September 4th, 2014.

Preview period

The new Organization Memberships API is available for developers to preview alongside the Team Memberships API. During this period, we may change aspects of these endpoints. If we do, we will announce the changes on the developer blog, but we will not provide any advance notice.

While these new APIs are in their preview period, you’ll need to provide the following custom media type in the Accept header:

application/vnd.github.the-wasp-preview+json

We expect the preview period to last 30-60 days. At the end of the preview period, the Team and Organization Memberships APIs will become official components of GitHub API v3.

If you have any questions or feedback, please get in touch with us!