Health check
Answers 200 while the API and its database are reachable.
GET
https://api.switchfile.io/healthExample
Request
curl "https://api.switchfile.io/health"const res = await fetch("https://api.switchfile.io/health");
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
console.log(await res.json());<?php
$ch = curl_init('https://api.switchfile.io/health');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status >= 400) {
throw new RuntimeException("HTTP $status: $response");
}
print_r(json_decode($response, true));import requests
res = requests.get(
"https://api.switchfile.io/health",
)
res.raise_for_status()
print(res.json())Responses
200OK
statusstringrequiredone of "ok"
200 application/json{ "status": "ok" }