Create heartbeat
curl --request POST \
--url https://magicmarkets.com/v2/heartbeats/ \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '{
"timeout": 60
}'import requests
url = "https://magicmarkets.com/v2/heartbeats/"
payload = { "timeout": 60 }
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({timeout: 60})
};
fetch('https://magicmarkets.com/v2/heartbeats/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://magicmarkets.com/v2/heartbeats/"
payload := strings.NewReader("{\n \"timeout\": 60\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"status": "ok",
"data": {
"heartbeat_id": "hb-abc123",
"expiry_time": "2026-06-15T12:01:00+00:00"
}
}{
"status": "error",
"code": "validation_error",
"data": {
"validation_errors": {
"timeout": [
"Ensure this value is less than or equal to 300."
]
}
}
}{
"status": "error",
"code": "auth_error",
"data": {
"detail": "Authentication credentials were not provided."
}
}{
"status": "error",
"code": "forbidden",
"data": null
}{
"status": "error",
"code": "throttled",
"data": {
"message": "Request was throttled. Expected available in 12 seconds.",
"retry_after": 12
}
}{
"status": "error",
"code": "server_error",
"data": [
"An error has occurred, token:",
"ABC123abc456DEF789gh"
]
}Create heartbeat
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.
POST
/
v2
/
heartbeats
/
Create heartbeat
curl --request POST \
--url https://magicmarkets.com/v2/heartbeats/ \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '{
"timeout": 60
}'import requests
url = "https://magicmarkets.com/v2/heartbeats/"
payload = { "timeout": 60 }
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({timeout: 60})
};
fetch('https://magicmarkets.com/v2/heartbeats/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://magicmarkets.com/v2/heartbeats/"
payload := strings.NewReader("{\n \"timeout\": 60\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"status": "ok",
"data": {
"heartbeat_id": "hb-abc123",
"expiry_time": "2026-06-15T12:01:00+00:00"
}
}{
"status": "error",
"code": "validation_error",
"data": {
"validation_errors": {
"timeout": [
"Ensure this value is less than or equal to 300."
]
}
}
}{
"status": "error",
"code": "auth_error",
"data": {
"detail": "Authentication credentials were not provided."
}
}{
"status": "error",
"code": "forbidden",
"data": null
}{
"status": "error",
"code": "throttled",
"data": {
"message": "Request was throttled. Expected available in 12 seconds.",
"retry_after": 12
}
}{
"status": "error",
"code": "server_error",
"data": [
"An error has occurred, token:",
"ABC123abc456DEF789gh"
]
}
