curl -X GET "https://api.submagic.co/health"
const response = await fetch("https://api.submagic.co/health");
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://api.submagic.co/health')
data = response.json()
print(data)
{
"status": "healthy",
"service": "submagic-public-api",
"timestamp": "2024-01-15T10:30:00.000Z"
}
API Reference
Health Check
Check the health status of the Submagic API
GET
/
health
curl -X GET "https://api.submagic.co/health"
const response = await fetch("https://api.submagic.co/health");
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://api.submagic.co/health')
data = response.json()
print(data)
{
"status": "healthy",
"service": "submagic-public-api",
"timestamp": "2024-01-15T10:30:00.000Z"
}
Health Check
The health endpoint provides a simple way to check if the Submagic API is operational. This endpoint does not require authentication and can be used for monitoring and health checks.This endpoint does not require authentication and is not subject to rate
limiting.
Request
void
This endpoint does not accept any parameters.
Response
string
The current status of the API service
string
The name of the service
string
ISO 8601 timestamp of when the response was generated
curl -X GET "https://api.submagic.co/health"
const response = await fetch("https://api.submagic.co/health");
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://api.submagic.co/health')
data = response.json()
print(data)
{
"status": "healthy",
"service": "submagic-public-api",
"timestamp": "2024-01-15T10:30:00.000Z"
}
Use Cases
Uptime Monitoring
Use this endpoint to monitor API availability in your monitoring systems
Load Balancer Health Checks
Configure your load balancer to use this endpoint for health checks
CI/CD Pipeline Validation
Verify API availability before running integration tests
Status Page Integration
Include this endpoint in your status page monitoring
Status Values
| Status | Description |
|---|---|
healthy | API is operational and ready to accept requests |
degraded | API is operational but experiencing issues |
unhealthy | API is not operational |
Example Monitoring Script
Here’s a simple monitoring script you can use:#!/bin/bash
response=$(curl -s -o /dev/null -w "%{http_code}" https://api.submagic.co/health)
if [ $response -eq 200 ]; then
echo "API is healthy"
exit 0
else
echo "API is not responding (HTTP $response)"
exit 1
fi
const checkHealth = async () => {
try {
const response = await fetch("https://api.submagic.co/health");
const data = await response.json();
if (response.ok && data.status === "healthy") {
console.log("✅ API is healthy");
return true;
} else {
console.log("❌ API is not healthy:", data);
return false;
}
} catch (error) {
console.log("❌ Failed to check API health:", error.message);
return false;
}
};
// Run health check every 30 seconds
setInterval(checkHealth, 30000);
import requests
import time
import sys
def check_health():
try:
response = requests.get('https://api.submagic.co/health', timeout=10)
data = response.json()
if response.status_code == 200 and data.get('status') == 'healthy':
print('✅ API is healthy')
return True
else:
print(f'❌ API is not healthy: {data}')
return False
except Exception as e:
print(f'❌ Failed to check API health: {e}')
return False
if __name__ == '__main__':
is_healthy = check_health()
sys.exit(0 if is_healthy else 1)
The health endpoint is designed to respond quickly (typically under 100ms) to
provide fast health check results for monitoring systems.

