> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dacard.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update or remove a team member

> Change a member's role, or remove them from the team.

Change a member's role, or remove them from the team. Both actions require admin role. Removing the last admin is rejected.

## Update role

```bash theme={null}
curl -X PATCH https://app.dacard.ai/api/teams/tm_2x1B3y/members/tmm_xyz \
  -H "Authorization: Bearer $DACARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "role": "scorer" }'
```

## Remove member

```bash theme={null}
curl -X DELETE https://app.dacard.ai/api/teams/tm_2x1B3y/members/tmm_xyz \
  -H "Authorization: Bearer $DACARD_API_KEY"
```

| Property | Value |
| - | - |
| **Auth** | Required |
| **Required scope** | Caller must be a team `admin` |
| **Idempotent** | PATCH yes. DELETE yes (returns 404 on second call). |

## Roles

| Role | Can score | Can invite | Can change roles | Can remove members |
| - | - | - | - | - |
| `admin` | yes | yes | yes | yes |
| `scorer` | yes | no | no | no |
| `viewer` | no | no | no | no |

## Errors

| Status | Code | When |
| - | - | - |
| 400 | `role must be one of: admin, scorer, viewer` | Bad role on PATCH. |
| 401 | `AUTH_REQUIRED` | No session. |
| 403 | `Only team admins can change roles` | Caller is not admin. |
| 404 | `Member not found` | Bad `memberId`. |
| 409 | `Cannot remove the last admin` | DELETE on the only admin. |
| 500 | `INTERNAL_ERROR` | Write failed. |

Audit log entries: `team_member_role_changed`, `team_member_removed`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.