# Team

List, invite and deactivate team members.

List, invite and deactivate team members.

## Invite team member

`POST /v1/team/invites/`

Required scope: `team:write`

### Parameters

| Name | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string (uuid) | Yes | UUID4 identifying one intended write. Reuse it only when retrying that same write. |

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `email` | string (email) | Yes | max length 254 |
| `member_type` | string | Yes | one of `SETTER`, `CLOSER`, `MANAGER`, `FINANCE`, `ASSISTANT` |

### Response (201)

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `member_id` | string | No | read-only |
| `status` | string | No | read-only |

### Responses

- `201` Success
- `400` The request is invalid.
- `401` Authentication is missing, invalid, or revoked.
- `403` The authenticated identity lacks the required scope or capability.
- `404` The resource is unavailable or not visible to this organization.
- `409` The write conflicts with current state or an identical request is still running.
- `422` The write contains fields outside its closed input schema.
- `429` The request-rate budget is exhausted.

```bash
curl -X POST "https://api.themochi.app/v1/team/invites/" \
  -H "Authorization: Bearer $MOCHI_API_KEY" \
  -H "Idempotency-Key: $(uuidgen | tr A-Z a-z)" \
  -H "Content-Type: application/json" \
  -d '{"email":"string","member_type":"SETTER"}'
```

## List team members

`GET /v1/team/members/`

Required scope: `team:read`

### Response (200)

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `data` | object[] | Yes |  |
| `data[].accepted_at` | string (date-time) \| null | No | read-only |
| `data[].email` | string | No | read-only |
| `data[].first_name` | string | No | read-only |
| `data[].is_active` | boolean | No | read-only |
| `data[].language` | string | No | read-only |
| `data[].last_name` | string | No | read-only |
| `data[].member_id` | string | No | read-only |
| `data[].member_type` | string | No | read-only |
| `next_cursor` | string \| null | Yes |  |

### Responses

- `200` Success
- `400` The request is invalid.
- `401` Authentication is missing, invalid, or revoked.
- `403` The authenticated identity lacks the required scope or capability.
- `404` The resource is unavailable or not visible to this organization.
- `429` The request-rate budget is exhausted.

```bash
curl -X GET "https://api.themochi.app/v1/team/members/" \
  -H "Authorization: Bearer $MOCHI_API_KEY"
```

## Deactivate team member

`POST /v1/team/members/{member_id}/deactivate/`

Required scope: `team:write`

### Parameters

| Name | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `member_id` | path | integer | Yes |  |
| `Idempotency-Key` | header | string (uuid) | Yes | UUID4 identifying one intended write. Reuse it only when retrying that same write. |

### Response (201)

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `member_id` | string | No | read-only |
| `status` | string | No | read-only |

### Responses

- `201` Success
- `400` The request is invalid.
- `401` Authentication is missing, invalid, or revoked.
- `403` The authenticated identity lacks the required scope or capability.
- `404` The resource is unavailable or not visible to this organization.
- `409` The write conflicts with current state or an identical request is still running.
- `422` The write contains fields outside its closed input schema.
- `429` The request-rate budget is exhausted.

```bash
curl -X POST "https://api.themochi.app/v1/team/members/<member_id>/deactivate/" \
  -H "Authorization: Bearer $MOCHI_API_KEY" \
  -H "Idempotency-Key: $(uuidgen | tr A-Z a-z)"
```

