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

# Self-Hosted HTTP API

> Get a local deployment token, write a reading through /api/data, and read it back.

The self-hosted engine exposes `/api/*` on your deployment. It authenticates with that deployment's account tokens. The example below uses the **local Docker demo** and its published demo sign-in code. For the complete route and request schema, open `http://localhost:18060/docs` while the server is running.

## First local API request

Start the [Docker demo](https://docs.mirobody.ai/en/self-host.md#first-local-result), then use a second terminal. The example runs against your own machine at `http://localhost:18060`.

**1. Get a demo account token**

Exchange the demo email and code for an access token:

```bash theme={null}
curl -sS http://localhost:18060/email/verify \
  -H "Content-Type: application/json" \
  -d '{"email":"you@mirobody.ai","code":"111111"}'
```

Copy `data.access_token` from the response into your shell:

```bash theme={null}
export mirobody_demo_token="<data.access_token>"
```

**2. Write one reading**

Send a structured record to the account represented by the token:

```bash theme={null}
curl -sS http://localhost:18060/api/data \
  -H "Authorization: Bearer $mirobody_demo_token" \
  -H "Content-Type: application/json" \
  -d '{"records":[{"indicator":"fasting_glucose","value":97,"unit":"mg/dL","time":"2026-09-28T07:30:00Z"}]}'
```

A successful response includes `"status":"ok"` and `"ingested":1`. Check `standardized` to see whether the reading received a code.

**3. Read the account records**

```bash theme={null}
curl -sS "http://localhost:18060/api/data?limit=10" \
  -H "Authorization: Bearer $mirobody_demo_token"
```

The response has `"object":"list"` and a `data` array. Find the new reading by its indicator, value, and time. The demo also contains seeded readings.

## Accounts and demo codes

`POST /api/data` writes to the account that the token represents.

The demo code is for a local example. Before accepting real records, follow [Deploy on a Server](https://docs.mirobody.ai/en/deployment/production.md) to remove demo accounts and codes.


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