GET
Health Check API
Monitor the API status and verify that the service is running properly.
Overview
Service Monitoring
Use these endpoints to monitor the API health and ensure the service is operational.
The Health Check endpoints provide a simple way to verify that the StayAPI service is running and responding to requests. These endpoints are useful for monitoring, load balancers, and uptime checks.
Root Endpoint
GET https://api.stayapi.com/
Returns basic API information and available endpoints.
Health Endpoint
GET https://api.stayapi.com/health
Returns detailed health status and version information.
V1 Health Endpoint
GET https://api.stayapi.com/v1/health
Returns V1-specific health status.
Parameters
No parameters required for health check endpoints.
Response Format
Field | Type | Description |
---|---|---|
status | string | Current status of the API (e.g., "healthy") |
message | string | Descriptive message about the API status |
version | string | API version information |
Usage Tips
Monitoring Best Practices
- Use the
/health
endpoint for detailed monitoring - The root
/
endpoint is ideal for simple uptime checks - Check for HTTP 200 status code to verify the service is running
- Parse the response body for additional status information
Load Balancer Configuration
Configure your load balancer to use the /health endpoint for health checks with a reasonable interval (e.g., every 30 seconds).
Request
curl -X GET "https://api.stayapi.com/health"
const response = await fetch("https://api.stayapi.com/health"); const data = await response.json(); if (data.status === "healthy") { console.log("API is operational"); } else { console.error("API health check failed"); }
import requests response = requests.get("https://api.stayapi.com/health") data = response.json() if data["status"] == "healthy": print("API is operational") else: print("API health check failed")
$response = file_get_contents("https://api.stayapi.com/health"); $data = json_decode($response, true); if ($data["status"] === "healthy") { echo "API is operational"; } else { echo "API health check failed"; }
require "net/http" require "json" uri = URI("https://api.stayapi.com/health") response = Net::HTTP.get(uri) data = JSON.parse(response) if data["status"] == "healthy" puts "API is operational" else puts "API health check failed" end
Response
{ "status": "healthy", "message": "StayAPI is running", "version": "1.0.0", "timestamp": "2024-01-15T10:30:00Z" }
{ "message": "Welcome to StayAPI", "version": "1.0.0", "endpoints": { "health": "/health", "docs": "/docs", "v1": { "meta": "/v1/meta", "booking": "/v1/booking", "tripadvisor": "/v1/tripadvisor" } } }