Team members
Team accounts allow you to invite other users to access your account. Members can be assigned different roles, which control what they can do within the account.
The team member model
Not all endpoints return all account data - particularly around billing as that can require additinoal calls to third parties to verify. Below is a breakdown of fields you can expect to get back when interacting with accounts.
Properties
- Name
user_id
- Type
- uuid
- Description
Unique identifier for a user.
- Name
account_role
- Type
- string
- Description
The current user's role within the account. Typically
member
orowner
.
- Name
is_primary_owner
- Type
- boolean
- Description
Tells you if the current user is the primary owner of the account.
- Name
name
- Type
- string
- Description
The name of the user
- Name
email
- Type
- string
- Description
The email address of the user
List all members
Returns a list of all members on a given account.
Required attributes
- Name
account_id
- Type
- uuid
- Description
Unique UUID for the account you're trying to lookup
Optional attributes
- Name
results_limit
- Type
- integer
- Description
Limit the number of results returned. Default is 50.
- Name
results_offset
- Type
- integer
- Description
Offset the results returned. Default is 0.
Request
curl -G https://YOUR_SUPABASE/rest/v1/rpc/get_account_members \
-X POST \
-H "Authorization: Bearer SUPABASE_AUTH_TOKEN" \
-H "apikey: SUPABASE_ANON_KEY" \
-H "Content-Type: application/json"
-d '{"account_id": "uuid"}'
Response
[
{
"user_id": "uuid",
"account_role": "member",
"is_primary_owner": true,
"name": "Frank Smith",
"email": "test@test.com"
},
...
]
Remove Team Member
Returns a list of all members on a given account.
Required attributes
- Name
account_id
- Type
- uuid
- Description
Unique UUID for the account you're removing the member from
- Name
user_id
- Type
- uuid
- Description
Unique UUID for the user you're trying to remove
Request
curl -G https://YOUR_SUPABASE/rest/v1/rpc/get_account_members \
-X POST \
-H "Authorization: Bearer SUPABASE_AUTH_TOKEN" \
-H "apikey: SUPABASE_ANON_KEY" \
-H "Content-Type: application/json"
-d '{"account_id": "uuid", "user_id": "uuid"}'
Response
// NO RESPONSE
Update user role
Updates the role of a user in a given account. Also allows you to change the primary owner of an account.
Required attributes
- Name
account_id
- Type
- uuid
- Description
Unique UUID for the account you're trying to lookup
- Name
user_id
- Type
- uuid
- Description
Unique UUID for the user you're trying to update the role for
- Name
new_account_role
- Type
- account_role
- Description
The new role you want to assign to the user. By default can be
member
orowner
unless you've added custom roles.
Optional attributes
- Name
make_primary_owner
- Type
- boolean
- Description
- Defaults toOnly the current primary owner can make this change.
false
. If you want to make the user the primary owner of the account, set this totrue
. You must also set the user's role toowner
when doing this.
Request
curl -G https://YOUR_SUPABASE/rest/v1/rpc/update_account_user_role \
-X POST \
-H "Authorization: Bearer SUPABASE_AUTH_TOKEN" \
-H "apikey: SUPABASE_ANON_KEY" \
-H "Content-Type: application/json"
-d '{"account_id": "uuid", "user_id": "uuid", "new_account_role": "member"}'
Response
empty response