Organization Memberships API
Users are added to organizations by inviting them to join. Once accepted, they become members of the organization. The Organization Membership resource represents this membership.
You can invite users who already have an account, as well as new users. If the user has an existing account with the same email address used to invite them, they can reuse the same login.
Note: Once a user is a member of the organization, you can manage their team memberships using the Team Membership API.
Invite a User to an Organization
POST /organizations/:organization_name/organization-memberships
Parameter | Description |
---|---|
:organization_name | The name of the organization the user will be invited to join. The inviting user must have permission to manage organization memberships. |
Note: Organization membership management is restricted to members of the owners team, the owners team API token, and the organization API token.
Status | Response | Reason |
---|---|---|
201 | JSON API document | Successfully invited the user |
400 | JSON API error object | Unable to invite user due to organization limits |
404 | JSON API error object | Organization not found, or user unauthorized to perform action |
422 | JSON API error object | Unable to invite user due to validation errors |
Request Body
This POST endpoint requires a JSON object with the following properties as a request payload.
Properties without a default value are required.
Key path | Type | Default | Description |
---|---|---|---|
data.type | string | Must be "organization-memberships" . | |
data.attributes.email | string | The email address of the user to be invited. | |
data.relationships.teams.data[] | array[object] | A list of resource identifier objects that defines which teams the invited user will be a member of. These objects must contain id and type properties, and the type property must be teams (e.g. { "id": "team-GeLZkdnK6xAVjA5H", "type": "teams" } ). Obtain team IDs from the List Teams endpoint. All users must be added to at least one team. |
Sample Payload
Sample Request
Sample Response
List Memberships for an Organization
GET /organizations/:organization_name/organization-memberships
Parameter | Description |
---|---|
:organization_name | The name of the organization to list the memberships of. |
Query Parameters
This endpoint supports pagination with standard URL query parameters. Remember to percent-encode [
as %5B
and ]
as %5D
if your tooling doesn't automatically encode URLs.
Parameter | Description |
---|---|
q | Optional. A search query string. Organization memberships are searchable by user name and email. |
filter[status] | Optional. If specified, restricts results to those with the matching status value. Valid values are invited and active . |
filter[email] | Optional. If specified, restricts results to those with a matching user email address. If multiple comma separated values are specified, results matching any of the values are returned. |
page[number] | Optional. If omitted, the endpoint will return the first page. |
page[size] | Optional. If omitted, the endpoint will return 20 users per page. |
Sample Request
Sample Response
List User's Own Memberships
GET /organization-memberships
Sample Request
Sample Response
Show a Membership
GET /organization-memberships/:organization_membership_id
Parameter | Description |
---|---|
:organization_membership_id | The organization membership |
Status | Response | Reason |
---|---|---|
200 | JSON API document (type: "organization-memberships" ) | The request was successful |
404 | JSON API error object | Organization membership not found, or user unauthorized to perform action |
Sample Request
Sample Response
Remove User from Organization
DELETE /organization-memberships/:organization_membership_id
Parameter | Description |
---|---|
:organization_membership_id | The organization membership |
Status | Response | Reason |
---|---|---|
204 | Empty body | Successfully removed the user from the organization |
403 | JSON API error object | Unable to remove the user: you cannot remove yourself from organizations which you own |
404 | JSON API error object | Organization membership not found, or user unauthorized to perform action |
Sample Request
Available Related Resources
The GET endpoints above can optionally return related resources, if requested with the include
query parameter. The following resource types are available: