ReferenceAPI

Organizations

Organizations API methods, requests, and responses for RawTree Cloud and RawTree BYOC.

Organizations

Organization changes and member management require an organization administrator. Invitation acceptance uses the invited user’s token.

Manage organizations, members, and invitations. Organization membership controls access to the service. Database roles control SQL access in RawTree.

GET /v1/organizations

List accessible organizations.

Use an API key, a permitted workload token, or a user bearer token. Database-role keys support only the operations listed in Authentication.

Request:

# List accessible organizations.
curl -X GET "https://api.rawtree.com/v1/organizations" \
  -H "Authorization: Bearer $RAWTREE_API_KEY"

Expected response: HTTP 200.

{
  "organizations": [
    {
      "organization_id": "22222222-2222-4222-8222-222222222222",
      "name": "team_alpha",
      "role": null,
      "plan_id": "unlimited"
    }
  ]
}

Errors: 401, 403. See API errors.

POST /v1/organizations

Create a new organization.

Use a user session or user OAuth token with full_access. API keys and workload tokens cannot use this method.

Parameters:

FieldLocationTypeRequiredNotes
organization_namebodystringYes—

Request:

# Create a new organization.
curl -X POST "https://api.rawtree.com/v1/organizations" \
  -H "Authorization: Bearer $RAWTREE_USER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "organization_name": "team_alpha"
}'

Expected response: HTTP 201.

{
  "name": "team_alpha"
}

PATCH /v1/organizations/{organization}

Update organization metadata.

Use a user session or user OAuth token with full_access. API keys and workload tokens cannot use this method.

Parameters:

FieldLocationTypeRequiredNotes
organization_namebodystring or nullNo—
spending_limit_usdbodynumber or nullNo—

Request:

# Update organization metadata.
curl -X PATCH "https://api.rawtree.com/v1/organizations/team_alpha" \
  -H "Authorization: Bearer $RAWTREE_USER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "organization_name": "team_beta"
}'

Expected response: HTTP 200.

{
  "name": "team_beta",
  "spending_limit_usd": null
}

DELETE /v1/organizations/{organization}

Delete an organization and all its databases.

Use a user session or user OAuth token with full_access. API keys and workload tokens cannot use this method.

Request:

# Delete an organization and all its databases.
curl -X DELETE "https://api.rawtree.com/v1/organizations/team_alpha" \
  -H "Authorization: Bearer $RAWTREE_USER_TOKEN"

Expected response: HTTP 200.

{
  "deleted": true
}

GET /v1/organizations/{organization}/members

List members of an organization.

Use a user session or user OAuth token with full_access. API keys and workload tokens cannot use this method.

Request:

# List members of an organization.
curl -X GET "https://api.rawtree.com/v1/organizations/team_alpha/members" \
  -H "Authorization: Bearer $RAWTREE_USER_TOKEN"

Expected response: HTTP 200.

{
  "members": [
    {
      "user_id": "11111111-1111-4111-8111-111111111111",
      "email": "reader@example.com",
      "role": "member",
      "created_at": "2026-11-09T10:00:00Z"
    }
  ]
}

POST /v1/organizations/{organization}/members

Create an invite link for organization membership and send invite email.

Use a user session or user OAuth token with full_access. API keys and workload tokens cannot use this method.

Parameters:

FieldLocationTypeRequiredNotes
emailbodystringYes—
rolebodyadmin / memberNo—

Request:

# Create an invite link for organization membership and send invite email.
curl -X POST "https://api.rawtree.com/v1/organizations/team_alpha/members" \
  -H "Authorization: Bearer $RAWTREE_USER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "reader@example.com",
  "role": "member"
}'

Expected response: HTTP 200.

{
  "invited": true,
  "invite_link": "https://rawtree.com/invite/REPLACE_WITH_TOKEN",
  "expires_at_unix": 1794819600
}

GET /v1/organizations/{organization}/invites

List active pending invites of an organization.

Use a user session or user OAuth token with full_access. API keys and workload tokens cannot use this method.

Request:

# List active pending invites of an organization.
curl -X GET "https://api.rawtree.com/v1/organizations/team_alpha/invites" \
  -H "Authorization: Bearer $RAWTREE_USER_TOKEN"

Expected response: HTTP 200.

{
  "invites": [
    {
      "invited_email": "reader@example.com",
      "role": "member",
      "created_at": "2026-11-09T10:00:00Z",
      "expires_at_unix": 1794819600
    }
  ]
}

POST /v1/organizations/invites/accept

Accept an organization invite token for the authenticated user.

Use a user session or user OAuth token with full_access. API keys and workload tokens cannot use this method.

Parameters:

FieldLocationTypeRequiredNotes
tokenbodystringYes—

Request:

# Accept an organization invite token for the authenticated user.
curl -X POST "https://api.rawtree.com/v1/organizations/invites/accept" \
  -H "Authorization: Bearer $RAWTREE_USER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "token": "REPLACE_WITH_TOKEN"
}'

Expected response: HTTP 200.

{
  "accepted": true,
  "already_member": false,
  "name": "team_alpha"
}

PATCH /v1/organizations/{organization}/members/{user_id}

Change organization member role.

Use a user session or user OAuth token with full_access. API keys and workload tokens cannot use this method.

Parameters:

FieldLocationTypeRequiredNotes
rolebodystringYes—

Request:

# Change organization member role.
curl -X PATCH "https://api.rawtree.com/v1/organizations/team_alpha/members/11111111-1111-4111-8111-111111111111" \
  -H "Authorization: Bearer $RAWTREE_USER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "role": "member"
}'

Expected response: HTTP 200.

{
  "role": "member"
}

DELETE /v1/organizations/{organization}/members/{user_id}

Remove a member from an organization.

Use a user session or user OAuth token with full_access. API keys and workload tokens cannot use this method.

Request:

# Remove a member from an organization.
curl -X DELETE "https://api.rawtree.com/v1/organizations/team_alpha/members/11111111-1111-4111-8111-111111111111" \
  -H "Authorization: Bearer $RAWTREE_USER_TOKEN"

Expected response: HTTP 200.

{
  "removed": true
}

DELETE /v1/organizations/{organization}/invites/{invited_email}

Revoke a pending invite from an organization.

Use a user session or user OAuth token with full_access. API keys and workload tokens cannot use this method.

Request:

# Revoke a pending invite from an organization.
curl -X DELETE "https://api.rawtree.com/v1/organizations/team_alpha/invites/reader%40example.com" \
  -H "Authorization: Bearer $RAWTREE_USER_TOKEN"

Expected response: HTTP 200.

{
  "revoked": true
}

POST /v1/organizations/{organization_id}/invite-links

Create an invitation link.

Use a user session or user OAuth token with full_access. API keys and workload tokens cannot use this method.

Parameters:

FieldLocationTypeRequiredNotes
expires_in_secondsbodyinteger or nullNo—

Request:

# Create an invitation link.
curl -X POST "https://api.rawtree.com/v1/organizations/22222222-2222-4222-8222-222222222222/invite-links" \
  -H "Authorization: Bearer $RAWTREE_USER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "expires_in_seconds": 86400
}'

Expected response: HTTP 200.

{
  "id": "11111111-1111-4111-8111-111111111111",
  "organization_id": "22222222-2222-4222-8222-222222222222",
  "invite_link": "https://rawtree.com/join/REPLACE_WITH_TOKEN",
  "role": "member",
  "created_at": "2026-11-09T10:00:00Z",
  "expires_at": "2026-11-10T10:00:00Z",
  "status": "active"
}

List invitation links.

Use a user session or user OAuth token with full_access. API keys and workload tokens cannot use this method.

Request:

# List invitation links.
curl -X GET "https://api.rawtree.com/v1/organizations/22222222-2222-4222-8222-222222222222/invite-links" \
  -H "Authorization: Bearer $RAWTREE_USER_TOKEN"

Expected response: HTTP 200.

{
  "invite_links": [
    {
      "id": "11111111-1111-4111-8111-111111111111",
      "organization_id": "22222222-2222-4222-8222-222222222222",
      "invite_link": "https://rawtree.com/join/REPLACE_WITH_TOKEN",
      "role": "member",
      "created_at": "2026-11-09T10:00:00Z",
      "expires_at": "2026-11-10T10:00:00Z",
      "status": "active"
    }
  ]
}

DELETE /v1/organizations/{organization_id}/invite-links/{id}

Revoke an invitation link.

Use a user session or user OAuth token with full_access. API keys and workload tokens cannot use this method.

Request:

# Revoke an invitation link.
curl -X DELETE "https://api.rawtree.com/v1/organizations/22222222-2222-4222-8222-222222222222/invite-links/11111111-1111-4111-8111-111111111111" \
  -H "Authorization: Bearer $RAWTREE_USER_TOKEN"

Expected response: HTTP 200.

{
  "revoked": true
}

POST /v1/organizations/invite-links/preview

Preview an invitation link.

No authentication required.

Parameters:

FieldLocationTypeRequiredNotes
tokenbodystringYes—

Request:

# Preview an invitation link.
curl -X POST "https://api.rawtree.com/v1/organizations/invite-links/preview" \
  -H "Content-Type: application/json" \
  -d '{
  "token": "REPLACE_WITH_TOKEN"
}'

Expected response: HTTP 200.

{
  "id": "11111111-1111-4111-8111-111111111111",
  "organization_id": "22222222-2222-4222-8222-222222222222",
  "organization_name": "team_alpha",
  "role": "member",
  "expires_at": "2026-11-10T10:00:00Z"
}

POST /v1/organizations/invite-links/accept

Accept an invitation link.

Use a user session or user OAuth token with full_access. API keys and workload tokens cannot use this method.

Parameters:

FieldLocationTypeRequiredNotes
tokenbodystringYes—

Request:

# Accept an invitation link.
curl -X POST "https://api.rawtree.com/v1/organizations/invite-links/accept" \
  -H "Authorization: Bearer $RAWTREE_USER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "token": "REPLACE_WITH_TOKEN"
}'

Expected response: HTTP 200.

{
  "accepted": true,
  "already_member": false,
  "organization_id": "22222222-2222-4222-8222-222222222222"
}