# Change a teammate's role (https://notert.io/docs/api/reference/change-a-teammate-s-role)

`PATCH /api/v1/teammates/{id}`

Changes a teammate's role, as the team page's role menu does, as the teammate who holds the token's secret: an owner or admin moves an admin to member, and the teammate is emailed their new role, and every owner which token moved them. Making someone an admin or an owner, or moving an owner, takes a person signed in to Notert, on the team page. A role the teammate holds already changes nothing.

Access: A token with people:write.

## Path parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The teammate's m_ id, from GET /teammates. |

## Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `role` | string | Yes | The role to give them: member, owner or admin, of which a token gives member alone. One of: `member`, `admin`, `owner`. |

## Response 200

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | The teammate's id: m_ and their user id, as the people endpoints name them, which a request's ownerIds take. |
| `role` | string | Their role in the workspace: owner, admin or member, the highest where they hold several. One of: `member`, `admin`, `owner`. |

## Errors

| Status | Code | Message |
| --- | --- | --- |
| 400 | `BAD_REQUEST` | Input validation failed. |
| 401 | `UNAUTHORIZED` | Send a valid API token or OAuth access token as a Bearer token. |
| 403 | `CONNECTION_NOT_ALLOWED` | The person who connected this app can't use it in the workspace now. |
| 403 | `FORBIDDEN` | The teammate who holds this API token's secret can't change the team. Only an owner or admin can: one of them should roll it in the workspace's settings. |
| 403 | `HOLDER_NOT_ALLOWED` | The teammate who holds this API token's secret can't do this in the workspace now. A teammate who can should roll it in the workspace's settings. |
| 403 | `INSUFFICIENT_SCOPE` | This API token can't change your customers' traits or your team. Create one that may in the workspace's settings. |
| 403 | `NETWORK_NOT_ALLOWED` | This API token works only from the networks it was made for. Call from one of them, or create a token for this one in the workspace's settings. |
| 403 | `NO_SEAT` | This workspace's plan has no seat for you. |
| 403 | `NOT_ALLOWED` | That teammate is beyond the token's holder: only an owner changes or removes an owner, and no one removes themself through a token. |
| 403 | `SESSION_EXPIRED` | Making or unmaking an owner, and making someone an admin, takes a person signed in to Notert: make that change on the workspace's team page. |
| 403 | `TOKEN_HELD_TO_BOARDS` | A teammate reaches every board, so this token, held to some, can't change one. Use a token that reaches every board. |
| 403 | `WORKSPACE_SUSPENDED` | This workspace is suspended. |
| 404 | `NOT_FOUND` | Not Found. |
| 409 | `CHANGED_MEANWHILE` | Something changed meanwhile. Try again. |
| 409 | `ONLY_OWNER` | The workspace's only owner keeps the role. Make someone else an owner first. |
| 429 | `TOO_MANY_REQUESTS` | Too Many Requests. Its data holds `retryAfter`. |

## Example request

```sh
curl -X PATCH https://app.notert.io/api/v1/teammates/m_5k2m9p4q7r1t \
  -H "Authorization: Bearer $NOTERT_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "role": "member"
}'
```

## Example response 200

```json
{
  "id": "m_5k2m9p4q7r1t",
  "role": "admin"
}
```
