Developer API
TimeLocal API
Access time, timezone, and holiday data through our simple REST API. Free to use with generous rate limits.
Fast & Reliable
Global CDN with edge caching for sub-100ms responses worldwide
Free Tier
100 requests/day without API key, 1000/day with free API key
Easy Integration
RESTful JSON API with CORS support for browser and server apps
Base URL
https://timelocal.com/api/v1All endpoints return JSON. Include x-api-key header for higher rate limits.
Endpoints
GET
/api/v1/timeGet current time for any timezone or city
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| timezone | string | Optional | IANA timezone (e.g., America/New_York) |
| city | string | Optional | City name or slug |
GET /api/v1/time?timezone=America/New_YorkGET
/api/v1/citiesSearch and list cities with time zones
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| q | string | Optional | Search query for city name |
| country | string | Optional | Filter by country |
| timezone | string | Optional | Filter by timezone |
| limit | number | Optional | Results per page (max 100) |
| offset | number | Optional | Pagination offset |
GET /api/v1/cities?q=new+york&limit=5GET
/api/v1/holidaysGet holidays by year, month, or country
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| year | number | Optional | Year (defaults to current) |
| month | number | Optional | Month (1-12) |
| country | string | Optional | Filter by country |
| type | string | Optional | Holiday type filter |
| upcoming | boolean | Optional | Only show future holidays |
GET /api/v1/holidays?upcoming=true&limit=5GET
/api/v1/convertConvert time between timezones
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| from | string | Optional | Source timezone (defaults to UTC) |
| to | string | Required | Target timezone |
| datetime | string | Optional | ISO datetime to convert |
GET /api/v1/convert?from=America/New_York&to=Europe/LondonCode Examples
// Get current time in Tokyo
const response = await fetch('https://timelocal.com/api/v1/time?city=tokyo');
const data = await response.json();
console.log(data.local_datetime); // "2024-03-15T19:30:45"
// Convert time between zones
const convert = await fetch(
'https://timelocal.com/api/v1/convert?from=America/New_York&to=Asia/Tokyo'
);
const result = await convert.json();
console.log(result.difference.description);
// Search cities
const cities = await fetch('https://timelocal.com/api/v1/cities?q=london');
const cityData = await cities.json();
cityData.cities.forEach(city => {
console.log(`${city.name}: ${city.current_time}`);
});Rate Limits
Free (No API Key)
100
requests per day
With API Key
1,000
requests per day
Rate limit info is returned in response headers: X-RateLimit-Remaining and X-RateLimit-Reset. Contact us for enterprise plans with higher limits.
Need Higher Limits?
Contact us for enterprise API access with custom rate limits and SLA guarantees.
Contact Us