# changeTeamMemberRole

Change a teammate's ROLE, the team page's Change Role: ADMIN (every permission, and the role every ADMIN-scoped operation needs; moving to it drops the member's permission settings) or MEMBER (what they may do is their permissions, set by an admin in the app). userId comes from listTeamMembers, which also shows the current role. It takes effect at once. Refused when it would leave the organization with no active admin (the only admin demoting themself). Organization admins only. Returns the member with their new organizationRole.

- Call: `POST https://server.goliathdata.com/api/v1/call` with `{ "operationId": "changeTeamMemberRole", "variables": {...} }`
- Scope: `ADMIN`
- Type: mutation
- Idempotency: honors `Idempotency-Key` (24 h)
- Rate-limited: no

## Variables

- `userId`: `ID!` (required)
- `role`: `OrganizationToUserMappingType!` (required, one of `ADMIN`, `MEMBER`)

## Response (data, an example)

```json
{
  "organizationMutation": {
    "changeUserRole": {
      "id": "<ID>",
      "organizationRole": "ADMIN"
    }
  }
}
```

## Example

```bash
curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "operationId": "changeTeamMemberRole",
    "variables": {
      "userId": "<userId>",
      "role": "ADMIN"
    }
  }'
```
