> ## Documentation Index
> Fetch the complete documentation index at: https://docs.uptimeio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Monitor Sparkline

> Retrieve 30 days of daily up/down data for a monitor

## Overview

Return one entry per UTC day for roughly the last 30 days, suitable for drawing a compact uptime strip or chart.

```
GET https://api.uptimeio.com/api/monitors/{id}/sparkline
```

## Authentication

| Header | Required | Description |
| - | - | - |
| `X-API-Key` | Yes (or a Bearer token) | Any API key, including read-only keys. See [Authentication](/api-reference/authentication). |
| `X-Project-ID` | No | Project that contains the monitor. Defaults to your organization's default project. |

## Path parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `id` | UUID | Yes | Monitor ID. |

## Response

### 200 OK

```json theme={null}
{
  "success": true,
  "data": {
    "sparkline": [
      { "timestamp": "2026-09-01T00:00:00.000Z", "status": "success", "successCount": 1440, "failureCount": 0 },
      { "timestamp": "2026-09-02T00:00:00.000Z", "status": "failure", "successCount": 1310, "failureCount": 130 },
      { "timestamp": "2026-09-03T00:00:00.000Z", "status": "no-data", "successCount": 0, "failureCount": 0 }
    ]
  }
}
```

| Field | Type | Description |
| - | - | - |
| `timestamp` | string | Start of the day, ISO 8601, midnight UTC. |
| `status` | enum | `success`, `failure` or `no-data`. |
| `successCount` | integer | Successful checks that day. |
| `failureCount` | integer | Failed checks that day. |

How `status` is chosen:

* A day with results is `success` when successful checks are at least as many as failed ones, otherwise `failure`.
* A day with no results takes the status of the last day that had results.
* Days before the monitor's first result are `no-data`.

For heartbeat monitors the counts come from received and missed pings.

## Errors

| Code | Status | Meaning |
| - | - | - |
| `AUTHENTICATION_REQUIRED` / `MISSING_AUTH` / `INVALID_API_KEY` | 401 | Missing or invalid credentials. |
| `MONITOR_NOT_FOUND` | 404 | No monitor with this ID in the project. |
| `SPARKLINE_FAILED` | 500 | The data could not be loaded. |

## Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.uptimeio.com/api/monitors/MONITOR_ID/sparkline \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch('https://api.uptimeio.com/api/monitors/MONITOR_ID/sparkline', {
    headers: { 'X-API-Key': process.env.UPTIMEIO_API_KEY },
  });
  const { data } = await res.json();
  const failingDays = data.sparkline.filter((d) => d.status === 'failure').length;
  console.log(`${failingDays} failing days`);
  ```

  ```python Python theme={null}
  import os
  import requests

  res = requests.get(
      "https://api.uptimeio.com/api/monitors/MONITOR_ID/sparkline",
      headers={"X-API-Key": os.environ["UPTIMEIO_API_KEY"]},
  )
  days = res.json()["data"]["sparkline"]
  print(sum(1 for d in days if d["status"] == "failure"), "failing days")
  ```
</CodeGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.