Skip to main content

Team

Change a role

Move somebody between admin and member, and why the owner's row cannot be touched.

PATCH/team/members/{userId}/role
Change a role
curl --request PATCH \
  --url 'https://truestat.io/api/v1/team/members/{userId}/role' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "role": "admin"
}'
{
  "data": {
    "role": "admin",
    "user_id": "9c9df94f-59f2-4080-bc3c-21b80ebdfe9c"
  },
  "meta": {}
}

Moves somebody between admin and member.

Owner only, like every team write — see inviting for what that means for a key created by an admin.

The owner's row cannot be changed, in either direction

Both halves answer 409 last_owner, and they are refused for different reasons.

Demoting the owner would leave the account with nobody who can invite, nobody who can change the plan, and no way back — the permission needed to undo it would have gone with the change.

Promoting somebody to owner is refused from the other side: owner is not an accepted value in the body at all. An account changes hands deliberately, not through a field in a PATCH.

Addressing the person

{userId} is the user_id that GET /team returns. Somebody who is not on this team answers 404 — there is nothing to hide, since the same call already listed everyone.

What each role opens

memberadmin
Sites, goals, integrations✓✓
Delete a site✓
Create and revoke API keys✓
Billing, and the team

The last row belongs to the owner alone — which is why an admin's key cannot call this endpoint.

Authorizations

Authorizationstringheaderrequired

An API key from Settings → API keys. Scopes available: analytics:read, sites:read, sites:write, settings:read, settings:write, goals:read, goals:write, funnels:read, funnels:write, notes:read, notes:write, alerts:read, alerts:write, team:read, team:write, revenue:read, revenue:write.

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path parameters

userIdstring (uuid)path
The person, as `GET /team` returns them.

Request bodyapplication/json

roleenum<string>bodyrequired
options:adminmember

Response

application/json

The answer.

dataobject
metaobject