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 or owner.

  • 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


POST/rpc/get_account_members

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

POST
/rpc/get_account_members
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"
    },
    ...
]

POST/rpc/remove_account_member

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

POST
/rpc/remove_account_member
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

POST/rpc/update_account_user_role

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 or owner unless you've added custom roles.

Optional attributes

  • Name
    make_primary_owner
    Type
    boolean
    Description

    Defaults to false. If you want to make the user the primary owner of the account, set this to true. You must also set the user's role to owner when doing this.

Request

POST
/rpc/update_account_user_role
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