# Manage organization members (/docs/guides/operate/manage-members)



Manage organization members [#manage-organization-members]

Send requests to `https://api.rawtree.com` with a signed-in user session. Only
`admin` and `member` are valid roles.

Invite a member [#invite-a-member]

Send `POST /v1/organizations/{organization}/members` as an organization admin:

```json
{
  "email": "analyst@example.com",
  "role": "member"
}
```

The response contains `invited`, `invite_link`, and `expires_at_unix`. Save the
invite link and expiration. The endpoint also sends an invitation email.

An invited user accepts with `POST /v1/organizations/invites/accept`:

```json
{ "token": "token-from-the-invite-link" }
```

Save the returned organization `name`. The response reports whether the invite
was accepted or the user was already a member.

You can also create a reusable invite link with
`POST /v1/organizations/{organization_id}/invite-links`. This route uses the
organization UUID, not its name:

```json
{ "expires_in_seconds": 86400 }
```

The response includes the link, role `member`, status, and expiration. Save the
`id` to list or revoke this link. Preview a link with
`POST /v1/organizations/invite-links/preview`, then accept it with
`POST /v1/organizations/invite-links/accept`. Both requests use the `token`
from the link. Reusable links add members with the `member` role.

Review and change membership [#review-and-change-membership]

Send `GET /v1/organizations/{organization}/members` to list member IDs, emails,
roles, and creation times. Save the `user_id` for the member you want to update.

Change the role with `PATCH /v1/organizations/{organization}/members/{user_id}`:

```json
{ "role": "admin" }
```

Save the returned `role`. To see pending invitations, call
`GET /v1/organizations/{organization}/invites`. The response includes each
invite's email, role, creation time, and expiration.

Revoke an invite or remove a member [#revoke-an-invite-or-remove-a-member]

Revoke a pending invite with
`DELETE /v1/organizations/{organization}/invites/{invited_email}`. URL-encode
the email address. Save the returned `revoked` value.

List reusable links with `GET /v1/organizations/{organization_id}/invite-links`.
Revoke one with
`DELETE /v1/organizations/{organization_id}/invite-links/{id}`.

Remove a member with
`DELETE /v1/organizations/{organization}/members/{user_id}`. Save the returned
`removed` value. The organization must retain at least one member and one admin.
