Skip to main content

Checks API

Checks represent individual monitoring results. Each time Sentro pings one of your monitored endpoints, it creates a check record with the response status, latency, and any errors.

Check Object​

{
"id": "chk_abc123def456",
"monitorId": "cly1abc2d0001abcdef012345",
"statusCode": 200,
"latencyMs": 142,
"isUp": true,
"error": null,
"checkedAt": "2025-01-15T09:30:00.000Z"
}
FieldTypeDescription
idstringUnique check identifier
monitorIdstringThe monitor this check belongs to
statusCodenumber|nullHTTP status code returned (null if request failed)
latencyMsnumberResponse time in milliseconds
isUpbooleanWhether the check was successful
errorstring|nullError message if the check failed
checkedAtstringISO 8601 timestamp of when the check was performed

List Checks​

GET /v1/monitors/:monitorId/checks

Returns a paginated list of checks for a specific monitor, ordered by most recent first.

Path Parameters​

ParameterTypeDescription
monitorIdstringThe monitor ID

Query Parameters​

ParameterTypeDefaultDescription
limitnumber50Number of checks to return (max 200)
offsetnumber0Number of checks to skip for pagination

Example Request​

curl "https://api.sentro.dev/v1/monitors/cly1abc2d0001abcdef012345/checks?limit=10&offset=0" \
-H "Authorization: Bearer sentro_sk_live_your_key_here"

Response 200 OK​

{
"data": [
{
"id": "chk_001",
"monitorId": "cly1abc2d0001abcdef012345",
"statusCode": 200,
"latencyMs": 142,
"isUp": true,
"error": null,
"checkedAt": "2025-01-15T09:30:00.000Z"
},
{
"id": "chk_002",
"monitorId": "cly1abc2d0001abcdef012345",
"statusCode": 503,
"latencyMs": 5012,
"isUp": false,
"error": "Expected status 200, got 503",
"checkedAt": "2025-01-15T09:29:00.000Z"
},
{
"id": "chk_003",
"monitorId": "cly1abc2d0001abcdef012345",
"statusCode": null,
"latencyMs": 30000,
"isUp": false,
"error": "Request timed out after 30000ms",
"checkedAt": "2025-01-15T09:28:00.000Z"
}
],
"meta": {
"total": 14523,
"limit": 10,
"offset": 0
}
}

Errors​

Monitor not found:

{
"error": {
"code": "NOT_FOUND",
"message": "Monitor with id 'mon_invalid' not found"
}
}
Try it

Fetch paginated check history for a specific monitor.

GET/v1/monitors/:monitorId/checks?limit=10&offset=0
Path Parameters
Query Parameters
Click ⚙ to configure your API key, then hit Send.

Pagination​

Use limit and offset to paginate through large check histories.

# First page
GET /v1/monitors/:id/checks?limit=50&offset=0

# Second page
GET /v1/monitors/:id/checks?limit=50&offset=50

# Third page
GET /v1/monitors/:id/checks?limit=50&offset=100

The meta.total field tells you the total number of checks available, so you can calculate how many pages exist:

totalPages = Math.ceil(meta.total / limit)

Common Patterns​

Get the Latest Check​

Retrieve just the most recent check result:

GET /v1/monitors/:id/checks?limit=1

Calculate Uptime Percentage​

Fetch a batch of checks and compute uptime:

const response = await fetch(
"https://api.sentro.dev/v1/monitors/mon_123/checks?limit=200",
{ headers: { Authorization: `Bearer ${API_KEY}` } }
);

const { data, meta } = await response.json();
const upCount = data.filter((check) => check.isUp).length;
const uptimePercent = (upCount / data.length) * 100;

console.log(`Uptime: ${uptimePercent.toFixed(2)}% (${data.length} checks)`);