Skip to content

Basic health check ​

GET /health

Whether the API is up. No API key needed.

Authentication ​

Public: no API key needed.

Responses ​

200 OK ​

API is healthy

Response fields
  • status string

  • timestamp string (date-time)

  • uptime number

  • environment string

  • loadTestMode boolean

503 Service Unavailable ​

API is unhealthy

bash
#!/usr/bin/env bash
# Whether the API is up: "status": "ok" when it is.
# A public endpoint: no key needed.
set -euo pipefail

curl -sS --max-time 30 https://api.docsocr.com/api/v1/health
python
"""Whether the API is up: "status": "ok" when it is.

A public endpoint: no key needed. Needs the requests package.
"""
import requests

response = requests.get("https://api.docsocr.com/api/v1/health", timeout=30)
response.raise_for_status()
print(response.json()["status"])
js
// Whether the API is up: "status": "ok" when it is.
// A public endpoint: no key needed. Needs Node.js 18+.
const response = await fetch('https://api.docsocr.com/api/v1/health', {
  signal: AbortSignal.timeout(30_000),
})
if (!response.ok) {
  console.error(response.status)
  process.exit(1)
}
console.log((await response.json()).status)
php
<?php
// Whether the API is up: "status": "ok" when it is.
// A public endpoint: no key needed. Needs the curl extension.

$request = curl_init('https://api.docsocr.com/api/v1/health');
curl_setopt_array($request, [CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 30]);
$body = curl_exec($request);
if ($body === false || curl_getinfo($request, CURLINFO_RESPONSE_CODE) !== 200) {
    fwrite(STDERR, 'The API is not up' . PHP_EOL);
    exit(1);
}
echo json_decode($body, true)['status'], PHP_EOL;
java
// Whether the API is up: "status": "ok" when it is.
// A public endpoint: no key needed. Needs Java 17+. Run: java Health.java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

public class Health {
    public static void main(String[] args) throws Exception {
        HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.docsocr.com/api/v1/health"))
            .timeout(Duration.ofSeconds(30))
            .GET()
            .build();
        HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());

        // The answer is JSON, e.g. {"status": "ok", ...}; read it with your JSON library
        System.out.println(response.body());
        if (response.statusCode() != 200) {
            System.exit(1);
        }
    }
}
csharp
// Whether the API is up: "status": "ok" when it is.
// A public endpoint: no key needed. Needs .NET 8+. Run: dotnet run Health.cs (.NET 10)
using System.Text.Json;

using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(30) };
using var response = await http.GetAsync("https://api.docsocr.com/api/v1/health");
if (!response.IsSuccessStatusCode)
{
    Console.Error.WriteLine((int)response.StatusCode);
    return 1;
}

using var health = JsonDocument.Parse(await response.Content.ReadAsStringAsync());
Console.WriteLine(health.RootElement.GetProperty("status").GetString());
return 0;

Try it

Sends this request to the production API.

This call costs no credits.