### Get Status Page Details by Slug Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Fetches the complete configuration details for a specific status page, identified by its unique slug. This includes settings like title, description, theme, and publication status. Requires authentication. ```bash # Get status page by slug curl -X GET 'http://127.0.0.1:8000/statuspages/production-status' \ -H 'Accept: application/json' \ -H "Authorization: Bearer ${TOKEN}" ``` -------------------------------- ### CURL Script for Authentication and Monitor Retrieval Source: https://github.com/medaziz11/uptime-kuma-web-api/blob/main/README.md This script demonstrates how to authenticate with the Uptime-Kuma-Web-API using a username and password to obtain an access token. It then uses this token to retrieve a list of all monitors via a GET request. Requires `jq` for parsing JSON responses. ```bash TOKEN=$(curl -X -L 'POST' -H 'Content-Type: application/x-www-form-urlencoded' --data 'username=admin&password=admin' http://127.0.0.1:8000/login/access-token/ | jq -r ".access_token") curl -L -H 'Accept: application/json' -H "Authorization: Bearer ${TOKEN}" http://127.0.0.1:8000/monitors/ ``` -------------------------------- ### Get Server Information API Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Retrieves essential information about the Uptime Kuma server, including its version, latest available version, and primary base URL. This GET request requires an Accept header for JSON and an Authorization header. ```bash # Get server info curl -X GET 'http://127.0.0.1:8000/info' \ -H 'Accept: application/json' \ -H "Authorization: Bearer ${TOKEN}" ``` -------------------------------- ### Get Uptime Statistics API Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Fetches the overall uptime percentages for all monitored services across different timeframes (e.g., 24 hours, 720 hours, 30 days). This GET request requires Accept and Authorization headers. ```bash # Get uptime stats curl -X GET 'http://127.0.0.1:8000/uptime' \ -H 'Accept: application/json' \ -H "Authorization: Bearer ${TOKEN}" ``` -------------------------------- ### Get All Maintenance Windows API Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Retrieves a list of all scheduled maintenance windows configured in Uptime Kuma. This GET request requires an Accept header for JSON response and an Authorization header for authentication. ```bash # List maintenance windows curl -X GET 'http://127.0.0.1:8000/maintenance' \ -H 'Accept: application/json' \ -H "Authorization: Bearer ${TOKEN}" ``` -------------------------------- ### Get Certificate Information API Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Fetches SSL/TLS certificate details for monitored HTTPS endpoints, including validity status and days remaining until expiration. This GET request requires Accept and Authorization headers. ```bash # Get cert info curl -X GET 'http://127.0.0.1:8000/cert_info' \ -H 'Accept: application/json' \ -H "Authorization: Bearer ${TOKEN}" ``` -------------------------------- ### Get Database Size Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Retrieves the current size of the Uptime Kuma database. ```APIDOC ## GET /database/size ### Description Retrieves the current size of the Uptime Kuma database. ### Method GET ### Endpoint /database/size ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET 'http://127.0.0.1:8000/database/size' \ -H 'Accept: application/json' \ -H "Authorization: Bearer ${TOKEN}" ``` ### Response #### Success Response (200) - **size** (integer) - The size of the database. - **unit** (string) - The unit of the database size (e.g., 'octet'). #### Response Example ```json { "size": 15728640, "unit": "octet" } ``` ``` -------------------------------- ### Initialize FastAPI App and Include Routers (Python) Source: https://github.com/medaziz11/uptime-kuma-web-api/blob/main/diff.txt This snippet demonstrates the initialization of the FastAPI application and the inclusion of various routers for different API functionalities. It sets up the application title, enables redirect slashes, and includes routers for users, settings, database, monitors, status pages, authentication, and more. It also handles the application's startup event by calling an `initialize_app` function. ```python # main.py from fastapi import FastAPI from fastapi.responses import RedirectResponse from routers import ( statuspage, monitor, auth, tags, cert, info, uptime, ping, database, settings as settings_router, user, maintenance ) from config import settings as app_settings from app_setup import initialize_app app = FastAPI(title=app_settings.PROJECT_NAME) app.router.redirect_slashes = True app.include_router(user.router, prefix="/users", tags=["Users"]) app.include_router(settings_router.router, prefix="/settings", tags=["Settings"]) app.include_router(database.router, prefix="/database", tags=["DataBase"]) app.include_router(monitor.router, prefix="/monitors", tags=["Monitor"]) app.include_router(statuspage.router, prefix="/statuspages", tags=["Status Page"]) app.include_router(tags.router, prefix="/tags", tags=["Tags"]) app.include_router(cert.router, prefix="/certificates", tags=["Certificates"]) app.include_router(info.router, prefix="/info", tags=["Info"]) app.include_router(uptime.router, prefix="/uptimes", tags=["Uptime"]) app.include_router(ping.router, prefix="/pings", tags=["Ping"]) app.include_router(maintenance.router, prefix="/maintenances", tags=["Maintenance"]) app.include_router(auth.router, prefix="/login", tags=["Authentication"]) @app.on_event("startup") async def startup_event(): await initialize_app(app) @app.get("/", include_in_schema=False) async def root(): return RedirectResponse("/docs") ``` -------------------------------- ### List All Available Tags Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Retrieves a list of all tags currently configured within Uptime Kuma. This is useful for understanding the existing organizational structure. Requires authentication. ```bash # Get all tags curl -X GET 'http://127.0.0.1:8000/tags' \ -H 'Accept: application/json' \ -H "Authorization: Bearer ${TOKEN}" ``` -------------------------------- ### Get Average Ping API Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Retrieves the average response time (ping) metrics for monitored services over various periods. This GET request requires Accept and Authorization headers to fetch the data in JSON format. ```bash # Get average ping curl -X GET 'http://127.0.0.1:8000/ping' \ -H 'Accept: application/json' \ -H "Authorization: Bearer ${TOKEN}" ``` -------------------------------- ### Monitor Management API Operations (Bash) Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Demonstrates bash commands for managing monitors within Uptime Kuma via its REST API. Includes fetching all monitors, retrieving a specific monitor by ID, creating a new HTTP monitor, and updating an existing monitor. All operations require an `Authorization` header with a valid JWT bearer token. Dependencies: curl. ```bash # List all monitors curl -X GET 'http://127.0.0.1:8000/monitors' \ -H 'Accept: application/json' \ -H "Authorization: Bearer ${TOKEN}" # Response: # { # "monitors": [ # { # "id": 1, # "name": "Production API", # "type": "http", # "url": "https://api.example.com/health", # "interval": 60, # "active": true # } # ] # } # Get monitor details curl -X GET 'http://127.0.0.1:8000/monitors/1' \ -H 'Accept: application/json' \ -H "Authorization: Bearer ${TOKEN}" # Response: # { # "monitor": { # "id": 1, # "name": "Production API", # "type": "http", # "url": "https://api.example.com/health", # "interval": 60, # "retryInterval": 60, # "maxretries": 3, # "active": true, # "method": "GET", # "accepted_statuscodes": ["200-299"] # } # } # Create HTTP monitor with authentication curl -X POST 'http://127.0.0.1:8000/monitors' \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer ${TOKEN}" \ -d '{ "type": "http", "name": "Staging API Health Check", "url": "https://staging.example.com/api/health", "interval": 60, "retryInterval": 60, "resendInterval": 0, "maxretries": 3, "upsideDown": false, "method": "GET", "accepted_statuscodes": ["200-299"], "ignoreTls": false, "maxredirects": 10, "headers": "{\"X-API-Key\": \"secret123\"}", "authMethod": "basic", "basic_auth_user": "api_user", "basic_auth_pass": "api_pass" }' # Response: # { # "msg": "Added Successfully.", # "monitorID": 2 # } # Update Monitor (example - partial update) # PUT /monitors/{monitor_id} endpoint is expected for updates but not provided in detail here. # Example payload structure for update might be similar to create, but with specific fields to modify. ``` -------------------------------- ### Docker Compose for Uptime Kuma and Web API Source: https://github.com/medaziz11/uptime-kuma-web-api/blob/main/README.md This Docker Compose configuration sets up both Uptime Kuma and the Uptime-Kuma-Web-API. It defines services, ports, volumes, environment variables, and dependencies required for both applications to run together. Ensure Uptime Kuma is running before the API. ```yaml version: "3.9" services: kuma: container_name: uptime-kuma image: louislam/uptime-kuma:latest ports: - "3001:3001" restart: always volumes: - uptime-kuma:/app/data api: container_name: backend image: medaziz11/uptimekuma_restapi volumes: - api:/db restart: always environment: - KUMA_SERVER=http://kuma:3001 - KUMA_USERNAME=test - KUMA_PASSWORD=123test. - ADMIN_PASSWORD=admin depends_on: - kuma ports: - "8000:8000" volumes: uptime-kuma: api: ``` -------------------------------- ### Get Monitor Heartbeats Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Retrieve historical heartbeat data for a monitor to analyze its status over time. ```APIDOC ## GET /monitors/{id}/beats ### Description Retrieves historical heartbeat data for a specific monitor, showing its status and response times over a specified period. ### Method GET ### Endpoint `/monitors/{id}/beats` ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the monitor to retrieve heartbeats for. #### Query Parameters - **hours** (integer) - Optional - The number of past hours for which to retrieve heartbeat data. Defaults to 24 hours if not specified. ### Response #### Success Response (200) - **monitor_beats** (array) - A list of heartbeat records for the monitor. - **id** (integer) - The unique ID of the heartbeat record. - **monitorID** (integer) - The ID of the monitor this heartbeat belongs to. - **status** (integer) - The status code of the check (e.g., 1 for OK). - **time** (string) - The timestamp when the check occurred. - **msg** (string) - A message describing the result of the check (e.g., "200 - OK"). - **ping** (integer) - The response time in milliseconds. #### Response Example ```json { "monitor_beats": [ { "id": 1001, "monitorID": 1, "status": 1, "time": "2024-01-15 10:00:00", "msg": "200 - OK", "ping": 145 }, { "id": 1002, "monitorID": 1, "status": 1, "time": "2024-01-15 10:01:00", "msg": "200 - OK", "ping": 152 } ] } ``` ``` -------------------------------- ### JWT Token Creation and Password Hashing Utilities Source: https://github.com/medaziz11/uptime-kuma-web-api/blob/main/diff.txt This module provides utility functions for security operations. `create_access_token` generates a JSON Web Token (JWT) with an expiration time, using a secret key and a specified algorithm. `hash_password` securely hashes a plain-text password using bcrypt, and `verify_password` checks if a given password matches a stored hash. These are fundamental for secure authentication. ```python import jwt from datetime import datetime, timedelta from typing import Optional, Any from fastapi import Depends from passlib.context import CryptContext from config import settings # Create a single instance of CryptContext for better performance and thread safety. pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") ALGORITHM = "HS256" def create_access_token(subject: Union[str, Any], expire_delta: Optional[timedelta] = None) -> str: """ Create an access token with an expiration date. :param subject: The subject for the token (e.g., user ID) :param expire_delta: The timedelta after which the token will expire. If not provided, default value from settings is used. :return: The encoded JWT token as a string """ # Calculate the expiration time expire = datetime.utcnow() + (expire_delta or timedelta(minutes=settings.ACCESS_TOKEN_EXPIRE)) # Create the JWT payload payload = {"exp": expire, "sub": subject} # Encode and return the JWT token return jwt.encode(payload, settings.SECRET_KEY, algorithm=ALGORITHM) def hash_password(password: str) -> str: """ Hash the given password. :param password: The password to hash :return: The hashed password as a string """ return pwd_context.hash(password) def verify_password(password: str, hashed_password: str) -> bool: """ Verify if the given password matches the hashed password. :param password: The password to verify :param hashed_password: The hashed password to compare with :return: True if the password matches, False otherwise """ return pwd_context.verify(password, hashed_password) ``` -------------------------------- ### Get Database Size with cURL Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Retrieves the current size of the Uptime Kuma database. This operation requires an authorization token and accepts JSON. ```bash curl -X GET 'http://127.0.0.1:8000/database/size' \ -H 'Accept: application/json' \ -H "Authorization: Bearer ${TOKEN}" ``` -------------------------------- ### Create Tag for Monitor Organization Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Adds a new tag with a specified name and color to be used for organizing monitors. This operation requires the tag details and authentication. ```bash # Create a tag with name and color curl -X POST 'http://127.0.0.1:8000/tags' \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer ${TOKEN}" \ -d '{ "name": "production", "color": "#FF0000" }' ``` -------------------------------- ### Upload Backup Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Imports Uptime Kuma configuration from a backup file. ```APIDOC ## POST /settings/upload_backup ### Description Imports Uptime Kuma configuration from a backup file. ### Method POST ### Endpoint /settings/upload_backup ### Parameters #### Query Parameters None #### Request Body - **backup** (object) - Required - The backup configuration data. - **import_handle** (string) - Required - Specifies how to handle the import (e.g., 'overwrite'). ### Request Example ```bash curl -X POST 'http://127.0.0.1:8000/settings/upload_backup' \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer ${TOKEN}" \ -d '{ "backup": {...}, "import_handle": "overwrite" }' ``` ### Response #### Success Response (200) - **msg** (string) - A message indicating the success of the import operation (e.g., 'Imported Successfully.'). #### Response Example ```json { "msg": "Imported Successfully." } ``` ``` -------------------------------- ### Get Monitor Heartbeats Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Retrieves historical heartbeat data for a specific monitor, showing its status over a defined period. The 'hours' parameter specifies the duration for which to fetch data. Requires monitor ID and authentication. ```bash # Get last 24 hours of monitor beats curl -X GET 'http://127.0.0.1:8000/monitors/1/beats?hours=24' \ -H 'Accept: application/json' \ -H "Authorization: Bearer ${TOKEN}" ``` -------------------------------- ### Monitor API Source: https://github.com/medaziz11/uptime-kuma-web-api/blob/main/README.md This section details how to interact with the Uptime Kuma API to manage monitors. It includes endpoints for listing monitors and obtaining an access token. ```APIDOC ## GET /monitors/ ### Description Retrieves a list of all monitors configured in Uptime Kuma. ### Method GET ### Endpoint /monitors/ ### Parameters No parameters are required for this endpoint. ### Request Example ```bash TOKEN=$(curl -X -L 'POST' -H 'Content-Type: application/x-www-form-urlencoded' --data 'username=admin&password=admin' http://127.0.0.1:8000/login/access-token/ | jq -r ".access_token") curl -L -H 'Accept: application/json' -H "Authorization: Bearer ${TOKEN}" http://127.0.0.1:8000/monitors/ ``` ### Response #### Success Response (200) - **list** (array) - A list of monitor objects. #### Response Example ```json { "monitors": [ { "id": 1, "name": "Example Monitor", "url": "https://example.com", "interval": 60, "max_redirects": 5, "scrape_interval": 60, "enabled": true, "ignore_tls": false, "public": false, "method": "GET", "keyword_filters": [], "headers": {}, "data": null, "expected_status": 200, "notification_ids": [] } ] } ``` ## POST /login/access-token/ ### Description Obtains an access token for authenticating API requests. Requires admin credentials. ### Method POST ### Endpoint /login/access-token/ ### Parameters #### Request Body - **username** (string) - Required - The admin username. - **password** (string) - Required - The admin password. ### Request Example ```bash curl -X -L 'POST' -H 'Content-Type: application/x-www-form-urlencoded' --data 'username=admin&password=admin' http://127.0.0.1:8000/login/access-token/ ``` ### Response #### Success Response (200) - **access_token** (string) - The JWT access token. - **token_type** (string) - The type of token, usually "bearer". #### Response Example ```json { "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "token_type": "bearer" } ``` ``` -------------------------------- ### User Management API Operations (Bash) Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Provides bash commands for managing users within the Uptime Kuma Web API. This includes creating new users with username and password, listing all existing users, and deleting users by username. All operations require an `Authorization` header with a valid JWT bearer token. Dependencies: curl. ```bash # Create a new user curl -X POST 'http://127.0.0.1:8000/users' \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer ${TOKEN}" \ -d '{ "username": "developer", "password": "secure_password_123" }' # Response: # { # "id": 2, # "username": "developer", # "created_at": "2024-01-15T10:30:00", # "last_visit": null # } # Get all users curl -X GET 'http://127.0.0.1:8000/users' \ -H 'Accept: application/json' \ -H "Authorization: Bearer ${TOKEN}" # Response: # [ # { # "id": 1, # "username": "admin", # "created_at": "2024-01-10T08:00:00", # "last_visit": "2024-01-15T10:00:00" # }, # { # "id": 2, # "username": "developer", # "created_at": "2024-01-15T10:30:00", # "last_visit": null # } # ] # Delete a user by username curl -X DELETE 'http://127.0.0.1:8000/users/developer' \ -H "Authorization: Bearer ${TOKEN}" # Response: # { # "message": "Deleted user developer" # } ``` -------------------------------- ### Upload Backup Configuration with cURL Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Imports Uptime Kuma configuration from a backup file. This POST request requires an authorization token and a JSON payload containing the backup data and import strategy. ```bash curl -X POST 'http://127.0.0.1:8000/settings/upload_backup' \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer ${TOKEN}" \ -d '{ "backup": {...}, "import_handle": "overwrite" }' ``` -------------------------------- ### List All Status Pages Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Retrieves a list of all public status pages configured in Uptime Kuma. This endpoint returns basic information such as slug, title, and publication status for each page. Requires authentication. ```bash # List status pages curl -X GET 'http://127.0.0.1:8000/statuspages' \ -H 'Accept: application/json' \ -H "Authorization: Bearer ${TOKEN}" ``` -------------------------------- ### Tag Management API Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Endpoints for creating, listing, and managing tags for organizing monitors. ```APIDOC ## POST /tags ### Description Creates a new tag with a specified name and color for organizing monitors. ### Method POST ### Endpoint `/tags` ### Parameters #### Request Body - **name** (string) - Required - The name of the tag. - **color** (string) - Optional - The color code for the tag (e.g., "#FF0000"). ### Response #### Success Response (200) - **msg** (string) - Confirmation message. - **tag** (object) - The created tag object. - **id** (integer) - The unique ID of the newly created tag. - **name** (string) - The name of the tag. - **color** (string) - The color of the tag. #### Response Example ```json { "msg": "Added Successfully.", "tag": { "id": 1, "name": "production", "color": "#FF0000" } } ``` ## GET /tags ### Description Retrieves a list of all available tags used for organizing monitors. ### Method GET ### Endpoint `/tags` ### Response #### Success Response (200) - **tags** (array) - A list of tag objects. - **id** (integer) - The unique ID of the tag. - **name** (string) - The name of the tag. - **color** (string) - The color of the tag. #### Response Example ```json { "tags": [ { "id": 1, "name": "production", "color": "#FF0000" }, { "id": 2, "name": "staging", "color": "#00FF00" } ] } ``` ## POST /monitors/{id}/tag ### Description Associates a specific tag with a given monitor. ### Method POST ### Endpoint `/monitors/{id}/tag` ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the monitor to which the tag will be assigned. #### Request Body - **tag_id** (integer) - Required - The unique identifier of the tag to assign. - **value** (string) - Optional - A specific value or description associated with this tag for the monitor. ### Response #### Success Response (200) - **msg** (string) - Confirmation message. #### Response Example ```json { "msg": "Added Successfully." } ``` ## DELETE /monitors/{id}/tag ### Description Removes a previously assigned tag from a specific monitor. ### Method DELETE ### Endpoint `/monitors/{id}/tag` ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the monitor from which the tag will be removed. #### Request Body - **tag_id** (integer) - Required - The unique identifier of the tag to remove. - **value** (string) - Optional - The specific value associated with the tag that needs to be removed. ### Response #### Success Response (200) - **msg** (string) - Confirmation message. #### Response Example ```json { "msg": "Deleted Successfully." } ``` ``` -------------------------------- ### Create a New Status Page Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Adds a new public status page to Uptime Kuma. Requires a unique slug and a title for the status page. Authentication is necessary for this operation. ```bash # Create status page curl -X POST 'http://127.0.0.1:8000/statuspages' \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer ${TOKEN}" \ -d '{ "slug": "api-status", "title": "API Services Status" }' ``` -------------------------------- ### Handle API Exceptions for Status Page Operations (Python) Source: https://github.com/medaziz11/uptime-kuma-web-api/blob/main/diff.txt This Python code defines API routes for managing status pages. It utilizes a `handle_api_exceptions` utility to abstract away common exception handling for `UptimeKumaApi` calls. The routes include fetching all status pages, retrieving a specific status page by slug, adding a new status page, and saving changes to an existing status page. Error logging and specific HTTP exceptions are managed within the utility function. ```python # routers/statuspage.py from fastapi import APIRouter, Depends, Path, Body from uptime_kuma_api import UptimeKumaApi, UptimeKumaException from config import logger as logging from schemas.api import API from utils.deps import get_current_user from utils.exceptions import handle_api_exceptions from schemas.statuspage import ( StatusPageList, StatusPage, AddStatusPageResponse, AddStatusPageRequest, SaveStatusPageRequest, SaveStatusPageResponse, DeleteStatusPageResponse, ) import json router = APIRouter(redirect_slashes=True) @router.get("", response_model=StatusPageList, description="Get all status pages") async def get_all_status_pages(cur_user: API = Depends(get_current_user)): api: UptimeKumaApi = cur_user["api"] return {"statuspages": await handle_api_exceptions(api.get_status_pages)} @router.get("/{slug}", response_model=StatusPage, description="Get a status page") async def get_status_page(slug: str, cur_user: API = Depends(get_current_user)): api: UptimeKumaApi = cur_user["api"] return await handle_api_exceptions(api.get_status_page, slug) @router.post("", response_model=AddStatusPageResponse, description="Add a status page") async def add_status_page( status_page_data: AddStatusPageRequest, cur_user: API = Depends(get_current_user) ): api: UptimeKumaApi = cur_user["api"] return await handle_api_exceptions( api.add_status_page, status_page_data.slug, status_page_data.title ) @router.post( "/{slug}", response_model=SaveStatusPageResponse, description="Save a status page" ) async def save_status_page( slug: str = Path(...), status_page_data: SaveStatusPageRequest = Body(...), cur_user: API = Depends(get_current_user), ): api: UptimeKumaApi = cur_user["api"] return await handle_api_exceptions( api.save_status_page, slug, status_page_data.dict() ) @router.delete("/{slug}", response_model=DeleteStatusPageResponse, description="Delete a status page") async def delete_status_page(slug: str, cur_user: API = Depends(get_current_user)): api: UptimeKumaApi = cur_user["api"] return await handle_api_exceptions(api.delete_status_page, slug) ``` -------------------------------- ### Shrink Database Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Optimizes and compacts the Uptime Kuma database. ```APIDOC ## POST /database/shrink ### Description Optimizes and compacts the Uptime Kuma database. ### Method POST ### Endpoint /database/shrink ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X POST 'http://127.0.0.1:8000/database/shrink' \ -H "Authorization: Bearer ${TOKEN}" ``` ### Response #### Success Response (200) - **message** (string) - A message indicating the status of the shrink operation (e.g., 'DB Shrinked'). - **details** (string) - Additional details about the operation (e.g., 'ok'). #### Response Example ```json { "message": "DB Shrinked", "details": "ok" } ``` ``` -------------------------------- ### Update Status Page Configuration Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Modifies the configuration and content of an existing status page. This endpoint allows for adjustments to various settings like title, description, theme, and publication status. Requires authentication and the status page identifier. ```bash ``` -------------------------------- ### Assign Tag to Monitor Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Associates an existing tag with a specific monitor. This involves providing the monitor ID and the tag ID, along with an optional value for context. Requires authentication. ```bash # Add tag to monitor curl -X POST 'http://127.0.0.1:8000/monitors/1/tag' \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer ${TOKEN}" \ -d '{ "tag_id": 1, "value": "web-server" }' ``` -------------------------------- ### Shrink Database with cURL Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Optimizes and compacts the Uptime Kuma database. This POST request requires an authorization token and returns a confirmation message upon successful execution. ```bash curl -X POST 'http://127.0.0.1:8000/database/shrink' \ -H "Authorization: Bearer ${TOKEN}" ``` -------------------------------- ### Post Incident to Status Page Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Creates a new incident announcement on a specified status page. ```APIDOC ## POST /statuspages/api-status/incident ### Description Posts a new incident announcement to a status page. This is used to inform users about ongoing issues or maintenance. ### Method POST ### Endpoint `/statuspages/api-status/incident` ### Parameters #### Request Body - **title** (string) - Required - The title of the incident. - **content** (string) - Required - The detailed description of the incident. - **style** (string) - Optional - The style or type of incident (e.g., 'warning', 'danger', 'info'). ### Request Example ```json { "title": "Elevated API Response Times", "content": "We are investigating increased response times on our API endpoints. Updates will be posted here.", "style": "warning" } ``` ### Response #### Success Response (200) - **incident** (object) - Contains details of the created incident. - **id** (integer) - The unique identifier for the incident. - **title** (string) - The title of the incident. - **content** (string) - The content of the incident announcement. - **pin** (boolean) - Whether the incident is pinned to the top of the status page. #### Response Example ```json { "incident": { "id": 1, "title": "Elevated API Response Times", "content": "...", "pin": true } } ``` ``` -------------------------------- ### Authentication API Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Endpoints for authenticating with the API and obtaining JWT access tokens. ```APIDOC ## POST /login/access-token ### Description Authenticate with the API using username and password credentials to receive a JWT bearer token. The token wraps the Uptime Kuma session token and expires after the configured duration (default 8 days). ### Method POST ### Endpoint `/login/access-token` ### Parameters #### Query Parameters - **username** (string) - Required - The username for authentication. - **password** (string) - Required - The password for authentication. ### Request Example ```bash curl -X POST 'http://127.0.0.1:8000/login/access-token' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'username=admin&password=admin' ``` ### Response #### Success Response (200) - **access_token** (string) - The JWT bearer token. - **token_type** (string) - The type of token, usually 'bearer'. #### Response Example ```json { "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "token_type": "bearer" } ``` ``` -------------------------------- ### System Information API Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Endpoints for retrieving information about the Uptime Kuma server and its statistics. ```APIDOC ## GET /info ### Description Retrieves the Uptime Kuma server version and other system-related details. ### Method GET ### Endpoint `/info` ### Response #### Success Response (200) - **version** (string) - The current version of Uptime Kuma. - **latestVersion** (string) - The latest available version of Uptime Kuma. - **primaryBaseURL** (string) - The primary base URL for Uptime Kuma services. #### Response Example ```json { "version": "1.21.3", "latestVersion": "1.21.3", "primaryBaseURL": "https://uptime.example.com" } ``` ``` ```APIDOC ## GET /uptime ### Description Fetches overall uptime percentages for all monitors across different time periods. ### Method GET ### Endpoint `/uptime` ### Response #### Success Response (200) - **(object)** - An object where keys are monitor IDs and values are objects containing uptime percentages for different periods (e.g., '24' for 24 hours, '720' for 30 days). - **monitor_id** (object) - **period_in_hours** (float) - Uptime percentage for that period. #### Response Example ```json { "1": { "24": 99.8, "720": 99.5, "30": 100.0 } } ``` ``` ```APIDOC ## GET /ping ### Description Retrieves the average ping response times for monitors over different time periods. ### Method GET ### Endpoint `/ping` ### Response #### Success Response (200) - **(object)** - An object where keys are monitor IDs and values are objects containing average ping times in milliseconds for different periods. - **monitor_id** (object) - **period_in_hours** (integer) - Average ping time in milliseconds for that period. #### Response Example ```json { "1": { "24": 145, "720": 152 } } ``` ``` ```APIDOC ## GET /cert_info ### Description Fetches SSL/TLS certificate information, including validity and days remaining until expiration, for monitored HTTPS endpoints. ### Method GET ### Endpoint `/cert_info` ### Response #### Success Response (200) - **(object)** - An object where keys are monitor IDs and values are objects containing certificate details. - **monitor_id** (object) - **valid** (boolean) - Indicates if the certificate is currently valid. - **daysRemaining** (integer) - The number of days remaining until the certificate expires. #### Response Example ```json { "1": { "valid": true, "daysRemaining": 87 } } ``` ``` -------------------------------- ### Pause and Resume Maintenance Window API Source: https://context7.com/medaziz11/uptime-kuma-web-api/llms.txt Allows pausing and resuming an active maintenance window without deleting it. These are POST requests targeting the specific maintenance window ID with '/pause' or '/resume' endpoints. Authorization is required. ```bash # Pause maintenance curl -X POST 'http://127.0.0.1:8000/maintenance/2/pause' \ -H "Authorization: Bearer ${TOKEN}" # Resume maintenance curl -X POST 'http://127.0.0.1:8000/maintenance/2/resume' \ -H "Authorization: Bearer ${TOKEN}" ```