Logo
Docs

Before.sh API - Health, Monitoring & Authentication

Overview of public health endpoints and API authentication. Health endpoints are open and show status, readiness, and basic stats. All other endpoints require an API key via X-API-Key header or token query. Rate limits apply; headers include limit, remaining, and reset info. For production keys, contact Before.sh at https://before.sh

API Info

API version info

GET
/

Response Body

<?phprequire 'vendor/autoload.php';use GuzzleHttp\Client;use GuzzleHttp\Exception\GuzzleException;$client = new Client();$options = [  'headers' => [  ],] ;try {  $response = $client->request('GET', 'https://testapi.before.sh/v1', $options);  echo (string) $response->getBody();} catch (GuzzleException $e) {  echo $e->getMessage();}
{
  "status": "running",
  "timestamp": "2025-10-10T22:06:04.014Z",
  "version": "v1",
  "environment": "development"
}

Health

Health and readiness check

GET
/health

Response Body

<?phprequire 'vendor/autoload.php';use GuzzleHttp\Client;use GuzzleHttp\Exception\GuzzleException;$client = new Client();$options = [  'headers' => [  ],] ;try {  $response = $client->request('GET', 'https://testapi.before.sh/v1/health', $options);  echo (string) $response->getBody();} catch (GuzzleException $e) {  echo $e->getMessage();}
{
  "status": "ok",
  "ready": true,
  "timestamp": "2025-10-10T22:06:04.014Z",
  "uptime": "2 hours 15 minutes"
}

Statistics

GET
/health/stats

Response Body

<?phprequire 'vendor/autoload.php';use GuzzleHttp\Client;use GuzzleHttp\Exception\GuzzleException;$client = new Client();$options = [  'headers' => [  ],] ;try {  $response = $client->request('GET', 'https://testapi.before.sh/v1/health/stats', $options);  echo (string) $response->getBody();} catch (GuzzleException $e) {  echo $e->getMessage();}
{
  "status": "ok",
  "timestamp": "2025-10-10T22:06:04.014Z",
  "requests_last_hour": 1234,
  "domains_checked": 56789,
  "memory": {
    "rss": "186 MB",
    "heap_used": "67 MB",
    "heap_total": "56 MB",
    "external": "8 MB"
  }
}