---
title: "Create heartbeat"
method: POST
path: "/v2/heartbeats/"
tags: ["Heartbeats"]
---

# Create heartbeat

`POST /v2/heartbeats/`

## Request

- Base URL: `https://magicmarkets.com` (the document declares no server; this is the origin it was published from)
- URL: `https://magicmarkets.com/v2/heartbeats/`
- Auth: API key in header `X-Api-Key`

Open a new heartbeat timer. If the timer expires before being refreshed or cancelled, every open order on the account is closed, including orders placed by other sessions or API keys; only orders created after the expiry instant are spared. Closing cancels the unfilled stake and withdraws unmatched liquidity advertised on the exchange; bets that already matched are unaffected. Expiry is evaluated server-side about once per second.

## Request body

- object
  - `timeout` integer, required: Seconds before the heartbeat expires

## Response `200`

Heartbeat created

- HeartbeatEnvelope
  - `status` 'ok'
  - `data` HeartbeatResponse
    - `heartbeat_id` string
    - `expiry_time` string, date-time

## Other responses

- `400`: `timeout` outside the 10-300 second range
- `401`: Authentication failed - API key missing, malformed, or rejected.
- `403`: Authorization failed - the key is valid but cannot perform this action.
- `429`: Rate limit hit. Honour the `Retry-After` header.
- `500`: Unexpected internal error. Quote `data[1]` (the token) when contacting support.

---

[API](https://skmtc.dev/magicmarkets/apis/magicmarkets-api.md) · [All operations](https://skmtc.dev/magicmarkets/apis/magicmarkets-api/llms.txt) · [OpenAPI document](https://skmtc.dev/magicmarkets/apis/magicmarkets-api/revisions/00c2a7dcce2a?raw)
