# Write Heart Rate via HTTP

Submit a heart rate reading for the authenticated user.

**Request**

<table><thead><tr><th width="197">name</th><th>value</th></tr></thead><tbody><tr><td>url</td><td><code>https://dev.pulsoid.net/api/v1/data</code></td></tr><tr><td>method</td><td><code>POST</code></td></tr><tr><td>content-type</td><td><code>application/json</code></td></tr><tr><td>scope</td><td><code>data:heart_rate:write</code></td></tr></tbody></table>

**Authentication**

Provide your OAuth2 Bearer token using one of the following methods:

| Method          | Example                            |
| --------------- | ---------------------------------- |
| Query parameter | `?access_token=YOUR_TOKEN`         |
| Header          | `Authorization: Bearer YOUR_TOKEN` |

**Request Body**

```json
{
  "measured_at": 1709312400000,
  "data": {
    "heart_rate": 75
  }
}
```

| Field            | Type    | Required | Description                                                     |
| ---------------- | ------- | -------- | --------------------------------------------------------------- |
| measured\_at     | number  | Yes      | Unix timestamp in milliseconds when the heart rate was measured |
| data.heart\_rate | integer | Yes      | Heart rate in beats per minute. Must be greater than 0          |

{% hint style="info" %}
Heart rate values of 0 or below are silently ignored and will not be stored.
{% endhint %}

**HTTP Status Codes**

| Status | Description                                                                    |
| ------ | ------------------------------------------------------------------------------ |
| `200`  | Heart rate data accepted                                                       |
| `400`  | Malformed request body                                                         |
| `401`  | Missing or invalid token, or token does not have `data:heart_rate:write` scope |
| `500`  | Unexpected server error (error code 6001)                                      |

**cURL Request Example**

```bash
curl -X POST https://dev.pulsoid.net/api/v1/data \
  -H "Authorization: Bearer 8c4da3ce-7ed7-4a19-a1f1-058498661e45" \
  -H "Content-Type: application/json" \
  -d '{"measured_at": 1709312400000, "data": {"heart_rate": 75}}'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pulsoid.net/read-heart-rate/write-heart-rate-via-http.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
