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

# System

> Whether the HTS Pilot service is up, and which account and role an API key belongs to.

Two operations for the first minutes of an integration and for monitoring it afterwards.

## Service status

`GET /api/health` (no API key needed)

Answers `200` while the service is up. `status` is `ok` or `degraded`, with the reasons in `issues`. No key is needed.

**Returns** `200` with a JSON object, as in the example.

**Errors**: `500` An unexpected failure.

**Example request**

```bash
curl "https://htspilot.com/api/health"
```

**Example response** `200`

```json
{
  "status": "ok",
  "environment": "development",
  "demo_mode": true,
  "sample_data_markets": [
    "US"
  ],
  "issues": [],
  "background": {
    "query_embedding": "ok",
    "vn_tariff": "disabled"
  },
  "version": null
}
```

Try it: https://docs.htspilot.com/explorer/#/System/getHealth

`GET /api/health` needs no key. It answers `200` while the service is up; `status` is `ok` or `degraded`, and
`issues` names what is degraded. `background` reports things that never change `status`, and `version` names the running build (`null` when the
environment does not name one).

| `background` | Values | Meaning |
| --- | --- | --- |
| `vn_tariff` | `disabled`, `no_release`, `pending`, `loading`, `loaded`, `failed`, `differs`, `unknown` | The load of the bundled Vietnam tariff release. `differs`: the file of that release is not the one that was loaded, and nothing was loaded over it |
| `query_embedding` | `ok`, `paused` | `paused`: lookups run on text search alone for the moment ([Lookups](/lookups.md#the-lookup-object), `result.retrieval`) |

New keys and new values can be added: treat one you do not know as informational. The service status over time is published at <https://status.htspilot.com/>.

## The account behind a key

`GET /api/auth/me`

**Returns** `200` with a JSON object, as in the example.

**Errors**: `401` No valid API key was sent; `403` The role of the key, or the plan of the account, does not allow this call; `422` The request is not valid; `500` An unexpected failure.

**Example request**

```bash
curl "https://htspilot.com/api/auth/me" \
  -H "X-API-Key: hts_EXAMPLE_KEY_REPLACE_ME"
```

**Example response** `200`

```json
{
  "id": "a7ba4a2440c7422fb695a1fd80d65ce5",
  "name": "Administrator (API: Documentation examples)",
  "email": "admin@example.com",
  "role": "admin",
  "role_label": "Admin",
  "via": "api_key",
  "avatar_url": "",
  "credits": 0,
  "unlimited": true
}
```

Try it: https://docs.htspilot.com/explorer/#/System/getMe

| Field | Type | Meaning |
| --- | --- | --- |
| `id`, `name`, `email` | string | The account that created the key. `name` carries the name of the key |
| `role`, `role_label` | string | The effective role of the key ([Authentication](/authentication.md#roles)) |
| `via` | string | `api_key` for a request recognised by its key |
| `credits`, `unlimited` | number, boolean | The balance, and whether the account is exempt |
