Docs / Calendar
Timezone
Returns the timezone for a coordinate or a country.
GET
/v1/timezoneimport { Client } from "@liveapiio/liveapi";
const client = new Client({ token: process.env.LIVEAPI_TOKEN });
const zone = await client.timezone({ latitude: 41.01, longitude: 28.98 });Request
Send Authorization: Bearer YOUR_TOKEN. The token stays on your server. Each library reads it from the environment and calls this endpoint for you.
| Field | Type | Description |
|---|---|---|
| lat | number | Latitude. Send with lon, or send country instead. |
| lon | number | Longitude. Send with lat, or send country instead. |
| country | string | ISO country code. Used when coordinates are omitted. |
Response
A 200 response uses one call. Returns the timezone name, UTC offset, whether daylight saving is in effect, and the local time.
Errors
A failed request returns { "error": { "code", "message" } } and does not use a call.
| Status | Code | When |
|---|---|---|
| 400 | invalid_request | Send lat and lon, or country. |
| 404 | not_found | No time zone for this point or country. |
| 401 | unauthorized | The bearer token is missing or not recognized. |