Record a minute of a play session
curl --request POST \
--url https://patch.gg/api/v1/me/play-sessions/{id}/heartbeat \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"seq": 50000,
"idle_seconds": 43200,
"visible": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({seq: 50000, idle_seconds: 43200, visible: true})
};
fetch('https://patch.gg/api/v1/me/play-sessions/{id}/heartbeat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://patch.gg/api/v1/me/play-sessions/{id}/heartbeat"
payload = {
"seq": 50000,
"idle_seconds": 43200,
"visible": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project": "mira/lantern-run",
"version": "<string>",
"client": "desktop",
"started_at": "<string>",
"last_seen_at": "<string>",
"ended_at": "<string>",
"end": "ended",
"heartbeat_s": 123
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}Play
Record a minute of a play session
Heartbeat seq (1, 2, 3…) covers the session’s seq-th minute, so a retried one counts once. idle_seconds is how long since the player’s last keyboard, mouse, touch or controller input. visible is whether the game could be seen (the page in front); leave it out when the client can’t tell.
POST
/
me
/
play-sessions
/
{id}
/
heartbeat
Record a minute of a play session
curl --request POST \
--url https://patch.gg/api/v1/me/play-sessions/{id}/heartbeat \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"seq": 50000,
"idle_seconds": 43200,
"visible": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({seq: 50000, idle_seconds: 43200, visible: true})
};
fetch('https://patch.gg/api/v1/me/play-sessions/{id}/heartbeat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://patch.gg/api/v1/me/play-sessions/{id}/heartbeat"
payload = {
"seq": 50000,
"idle_seconds": 43200,
"visible": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project": "mira/lantern-run",
"version": "<string>",
"client": "desktop",
"started_at": "<string>",
"last_seen_at": "<string>",
"ended_at": "<string>",
"end": "ended",
"heartbeat_s": 123
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}Authorizations
An API key (pch_...) or the token from pch login.
Path Parameters
Body
application/json
Response
Recorded
Example:
"mira/lantern-run"
Example:
"desktop"
Available options:
ended, exited, crashed, timed_out, null Send a heartbeat this often