Timer Endpoints
Create, read, update, and delete countdown timers via the API.
GET
/api/v1/timersList all timers in your account.
Response
{
"data": [
{
"id": "abc123",
"name": "Black Friday Sale",
"type": "fixed",
"status": "active",
"targetDate": "2024-11-29T00:00:00Z",
"viewCount": 1542
}
],
"meta": {
"total": 1,
"limit": 20,
"offset": 0
}
}GET
/api/v1/timers/:idGet details of a specific timer.
POST
/api/v1/timersCreate a new countdown timer.
Request Body
{
"name": "Flash Sale Timer",
"type": "fixed",
"targetDate": "2024-12-25T00:00:00Z",
"timezone": "America/New_York",
"template": "bold",
"colors": {
"background": "#1a1a2e",
"text": "#ffffff",
"accent": "#ff6b6b"
}
}Required Fields
name- Timer name (string)type- "fixed", "evergreen", or "recurring"targetDate- ISO 8601 date (for fixed type)
PATCH
/api/v1/timers/:idUpdate an existing timer. Only include fields you want to change.
Example
{
"name": "Updated Timer Name",
"targetDate": "2024-12-31T23:59:59Z"
}DELETE
/api/v1/timers/:idPermanently delete a timer. This cannot be undone.
Response
{
"success": true,
"message": "Timer deleted"
}Complete Example
JavaScript
const response = await fetch('https://www.snaptimers.com/api/v1/timers', {
method: 'POST',
headers: {
'Authorization': 'Bearer st_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Flash Sale Timer',
type: 'fixed',
targetDate: '2024-12-25T00:00:00Z',
timezone: 'America/New_York',
template: 'bold',
colors: {
background: '#1a1a2e',
text: '#ffffff',
accent: '#ff6b6b',
},
}),
});
const { data } = await response.json();
console.log('Timer created:', data.id);
console.log('Embed URL:', data.embedUrl);