Regions
Utilities for picking the lowest-latency region from the client. The client pings each regional endpoint a few times, averages, and routes subsequent search traffic to the winner.
GET /v1/ping
Measure round-trip latency to a region
Returns the server-side epoch time as plain text. Intended for client- side latency probing: call /v1/ping against each candidate regional endpoint, time the round-trip, and route subsequent search traffic to the fastest one.
The response body itself is the server timestamp in milliseconds, which clients can cross-reference against their own clock if they want a one-way clock-skew estimate — though for region selection only the round-trip matters.
Pattern (JavaScript):
const ranked = await Promise.all(regions.map(async (url) => {
let total = 0;
for (let i = 0; i < samples; i++) {
const started = performance.now();
await fetch(`${url}/v1/ping`);
total += performance.now() - started;
}
return { url, avgMs: total / samples };
}));
ranked.sort((a, b) => a.avgMs - b.avgMs);
return ranked[0].url;
} ```
The endpoint is public, cheap (constant-time), and safe to call repeatedly. No authentication required.
### Example request
```bash
curl -X GET \
'https://api.eztype.io/v1/ping'Responses
200 — Server-side epoch time in milliseconds.