# Account endpoints

Every path starts at your [API URL](https://docs.qualithm.com/api.md#find-your-api-url). Every response is JSON, and an error has the [error body](https://docs.qualithm.com/api.md#errors).

## Get the caller's account

`GET /v1/account`

Needs an [API token](https://docs.qualithm.com/api.md#authenticate).

**Response:** `200` with [Account](#account) in `data`.

**[Errors](https://docs.qualithm.com/api.md#errors):** `401`, `404`, `429`, `500`, `503`

```bash
curl "<your-api-url>/v1/account" \
  -H "Authorization: Bearer <your-api-token>"
```

## Get the caller's email preferences

`GET /v1/account/communication-preferences`

Needs an [API token](https://docs.qualithm.com/api.md#authenticate).

**Response:** `200` with [CommunicationPreferences](#communicationpreferences) in `data`.

**[Errors](https://docs.qualithm.com/api.md#errors):** `401`, `404`, `429`, `500`, `503`

```bash
curl "<your-api-url>/v1/account/communication-preferences" \
  -H "Authorization: Bearer <your-api-token>"
```

## Types

### Account

| Field | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| `id` | string | Yes | An account ID: `acc_…` |
| `email` | string | Yes |  |
| `name` | string | Yes |  |
| `termsVersion` | string | Yes | The current Terms of Service version. Ask the person to accept when it differs from `termsAcceptedVersion`. |
| `termsAcceptedVersion` | string or null | Yes | The terms version the person last accepted, or null |
| `termsAcceptedAt` | string (date-time) or null | Yes | When they accepted it |
| `createdAt` | string (date-time) | Yes | UTC time, RFC 3339 |
| `updatedAt` | string (date-time) | Yes | UTC time, RFC 3339 |

### CommunicationPreferences

Which marketing emails the account receives. A preference never set reads as `true`.

| Field | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| `blogArticles` | boolean | Yes |  |
| `educationResources` | boolean | Yes |  |
| `events` | boolean | Yes |  |
| `productNewsPromotions` | boolean | Yes |  |
