# Uptime Kuma API

## Overview

- **Host:** 10.5.0.10:3001 (Dockge container)
- **Public URL:** https://status.georgsen.dk
- **Credentials:** `~/.config/uptime-kuma/credentials`

## Authentication

```bash
source ~/.config/uptime-kuma/credentials
# Variables: KUMA_HOST, KUMA_PORT, KUMA_API_KEY
```

Use API key as password with empty username for Basic Auth:
```bash
curl -u ":$KUMA_API_KEY" "http://$KUMA_HOST:$KUMA_PORT/metrics"
```

Or Bearer token:
```bash
curl -H "Authorization: Bearer $KUMA_API_KEY" "http://$KUMA_HOST:$KUMA_PORT/api/entry-page"
```

## REST API Endpoints

### Prometheus Metrics
```bash
curl -u ":$KUMA_API_KEY" "http://$KUMA_HOST:$KUMA_PORT/metrics"
```

### Push Monitor (Passive Checks)
For push-type monitors, update status via URL:
```bash
# Basic
curl "http://$KUMA_HOST:$KUMA_PORT/api/push/<pushToken>"

# With parameters
curl "http://$KUMA_HOST:$KUMA_PORT/api/push/<pushToken>?status=up&msg=OK&ping=50"
```

Parameters:
- `status` - "up" or "down" (default: "up")
- `msg` - Status message, ~250 chars max (default: "OK")
- `ping` - Response time in ms

### Status Page Data
```bash
# Get status page info (requires published status page)
curl "http://$KUMA_HOST:$KUMA_PORT/api/status-page/<slug>"

# Get heartbeats and uptime
curl "http://$KUMA_HOST:$KUMA_PORT/api/status-page/heartbeat/<slug>"
```

### Status Badges
```bash
# Status badge (monitor must be in public status page group)
curl "http://$KUMA_HOST:$KUMA_PORT/api/badge/<monitor_id>/status"

# Uptime badge
curl "http://$KUMA_HOST:$KUMA_PORT/api/badge/<monitor_id>/uptime"
curl "http://$KUMA_HOST:$KUMA_PORT/api/badge/<monitor_id>/uptime/24h"
curl "http://$KUMA_HOST:$KUMA_PORT/api/badge/<monitor_id>/uptime/7d"

# Response time badge
curl "http://$KUMA_HOST:$KUMA_PORT/api/badge/<monitor_id>/ping"

# Certificate expiry badge
curl "http://$KUMA_HOST:$KUMA_PORT/api/badge/<monitor_id>/cert-exp"
```

### Entry Page
```bash
curl "http://$KUMA_HOST:$KUMA_PORT/api/entry-page"
```

## Limitations

The REST API is limited to:
- Push monitor updates
- Reading metrics/status
- Badge generation

**Full monitor management** (create, edit, delete monitors) requires the **Socket.IO API**, which is more complex and uses WebSockets. For adding monitors, use the web UI at https://status.georgsen.dk.

## Socket.IO API

Full monitor management (create, edit, delete) is available via Socket.IO. See `kuma_api_doc.png` for complete API documentation screenshot.

## References

- [API Documentation](https://github.com/louislam/uptime-kuma/wiki/API-Documentation)
- [API Keys](https://github.com/louislam/uptime-kuma/wiki/API-Keys)
- [Internal API](https://github.com/louislam/uptime-kuma/wiki/Internal-API)
- `kuma_api_doc.png` - Full API documentation screenshot
