CountdownMail API
This guide will help you start using the CountdownMail API. It covers how to set up, authenticate, handle errors, and work with countdown timers.
Quickstart
This section will get you ready to use the CountdownMail API and show you how to make your first API request.
- Get your API key:
- Log in to your CountdownMail account.
- Go to Profile » API.
- Copy your API key.
- Make your first API request:
- We’ll use the “Create a Timer” endpoint as an example.
- Use a tool like cURL or Postman to send a POST request to https://countdownmail.com/api/create.
- Add your API key in the Authorization header.
- Include the required timer details in the request body (in JSON format).
Here’s an example using cURL:
Request
curl -v \
-H "Content-Type: application/json" \
-H "Authorization: YOUR_API_KEY" \
-X POST "https://countdownmail.com/api/create" \
-d '{
"skin_id": 1,
"name": "Big Sale!",
"time_end": "2025-04-21 20:00:00",
"time_zone": "America/Los_Angeles",
"font_family": "Roboto-Bold",
"color_primary": "FF3A43",
"color_text": "FFFFFF",
"color_bg": "000000"
}'
- Replace YOUR_API_KEY with your actual API key.
- If everything works, you’ll get a response like this:
Response
{
"status": "success",
"message": {
"id": 1057,
"code": "td",
"src": "http://i.countdownmail.com/td.gif"
}
}
This response includes a timer code (e.g., "td") and a URL for the timer image.
Authentication
To use the CountdownMail API, you need to authenticate every request with your API key. Here’s how:
- Add an Authorization header to your request. The value is your API key.
- Alternatively, use basic authentication: set your API key as the username and leave the password empty.
Example with Authorization Header (cURL):
Request
curl -v \
-H "Content-Type: application/json" \
-H "Authorization: YOUR_API_KEY" \
-X GET "https://countdownmail.com/api/some_endpoint"
- Replace YOUR_API_KEY with your actual API key.
- Always include authentication, or you’ll get a 401 Unauthorized error.
Using Postman
If you use Postman makes it easy to test API requests. To use it with CountdownMail:
Errors
Sometimes, API requests fail. The CountdownMail API uses HTTP status codes to tell you what went wrong. Here’s a list of possible errors, what they mean, and what to do:
Code | Status Name | Description | Suggested Action | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
400 | Bad Request | Something’s wrong with your request. | Check your request matches the documentation and uses correct syntax. | ||||||||
401 | Unauthorized | You don’t have permission to make this request. | Ensure you’re using a valid API key in the Authorization header. | ||||||||
404 | Not Found | The server can’t find what you asked for. | Verify your URL matches a valid API endpoint. | ||||||||
405 | Method Not Allowed | The endpoint doesn’t support that method. | Use the correct HTTP method (e.g., GET, POST) as shown in the docs. | ||||||||
429 | Too Many Requests | The client has sent too many requests in 1 minute. | You can use the headers that are sent with each response to determine the current status of your rate limit.
| ||||||||
500 | Internal Server Error | Something broke on CountdownMail’s side. | Try again later. If it keeps happening, contact support. | ||||||||
503 | Service Unavailable | The server is too busy right now. | Wait a bit and try again. |
Example Error Response (401 Unauthorized):
Response
{
"status": "error",
"message": "Unauthorized"
}
If you see an error, check the status code and message, then follow the suggested action.
Timer Model
The Timer resource contains all the information about countdown timer. These are the fields available for defining a countdown timer:
Property | Type | Description | Required | Notes |
---|---|---|---|---|
skin_id | integer | The timer’s design style (template). | Yes | Must be a number between 1 and 23. |
name | string | The timer’s name. | Yes | Max 100 characters. Example: Big Sale! |
time_end | string | When the timer ends (YYYY-MM-DD HH:MM:SS). | Yes | Example: 2025-04-09 04:57:16 |
time_zone | string | The timer’s timezone. | Yes | Example: America/Los_Angeles. See all available time_zone values. |
font_family | string | Font for the timer text. | No | Example: Roboto-Bold. See all available font_family values. |
label_font_family | string | Font for timer labels. | No | Example: Roboto-Bold. See all available font_family values. |
color_primary | string | Main color (hex code). | No | Example: FF3A43 (red). |
color_text | string | Text color (hex code). | No | Example: FFFFFF (white). |
color_bg | string | Background color (hex code). | No | Example: 000000 (black). |
font_size | integer | Size of the timer text. | No | Between 14 and 73. |
label_font_size | integer | Size of the label text. | No | Between 0 and 50. |
day | integer | Show days (0 = no, 1 = yes). | No | Must be 0 or 1. |
lang | string | Language code (ISO 2-letter). | No | Example: en (English). Valid values are: 'ar', 'bg', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'he', 'hi', 'hu', 'it', 'ja', 'ko', 'lt', 'nl', 'no', 'pl', 'pt', 'ro', 'ru', 'sk', 'sv', 'th', 'tr', 'uk', 'vi', 'zh' |
transparent | integer | Background: 0 = solid, 1 = transparent. | No | Must be 0 or 1. |
expired_mes_on | integer | Show expiry message (0 = no, 1 = yes). | No | Must be 0 or 1. |
expired_mes | string | Message when timer expires. | No | Max 100 characters. Example: This offer has expired. |
labels | integer | Use custom labels (0 = no, 1 = yes). | No | Must be 0 or 1. |
days | string | Label for days. | No | Max 15 characters. Example: days. |
hours | string | Label for hours. | No | Max 15 characters. Example: hours. |
minutes | string | Label for minutes. | No | Max 15 characters. Example: minutes. |
seconds | string | Label for seconds. | No | Max 15 characters. Example: seconds. |
advanced_params | object | Extra settings (e.g., separator color). | No | Example
|
Create a Timer
This endpoint allows you to create a timer. To create a new timer, you must provide all required properties.
Example Request:
Request
{
"skin_id":3,
"name":"Big Sale!",
"time_end":"2025-05-12 20:00:00",
"time_zone":"America\/Los_Angeles",
"font_family":"Roboto-Bold",
"color_primary":"FF3A43",
"color_text":"FFFFFF",
"color_bg":"000000",
"transparent":"0",
"lang_local":"0",
"font_size":"38",
"day":"1",
"lang":"en",
"expired_mes_on":"1",
"expired_mes":"This offer has expired",
"labels":"1",
"days":"days",
"hours":"hours",
"minutes":"minutes",
"seconds":"seconds"
}
Response
{
"status": "success",
"message": {
"id": 1057,
"code": "td",
"src": "http://i.countdownmail.com/td.gif"
}
}
Update a Timer
This endpoint allows you to update any timer attribute. To update a timer, send a PUT request to /update/{code} with the fields you want to update. Replace {code} with the timer’s code (e.g., "td").
Example Request:
Request
{
"skin_id":6,
"name":"Flash Sale!",
"time_end":"2025-05-12 20:00:00"
}
Response
{
"status": "success",
"message": {
"id": 1057,
"code": "td",
"src": "http://i.countdownmail.com/td.gif"
}
}
Duplicate a Timer
To make a copy of an existing timer, send a POST request to /duplicate/{code}. Replace {code} with the unique code of the timer you want to copy. This will create a new timer that starts with the same settings as the original one.
You can also update some details of the new timer by adding a JSON object in the request body. This lets you change specific attributes, like the end time or name, while keeping everything else the same as the original. The attributes you can update are the same ones you can set when creating a new timer (check the Timer Model section for the full list). If you don’t include an attribute in the request body, it will stay the same as it was in the original timer.
Important: The original timer does not change. Only the new timer is affected by the updates you send in the request.
Example Request:
Request
{
"skin_id":6,
"name":"Flash Sale!",
"time_end":"2025-05-12 20:00:00"
}
Response
{
"status": "success",
"message": {
"id": 1057,
"code": "td",
"src": "http://i.countdownmail.com/td.gif"
}
}
Deactivate a Timer
To stop a timer (archive), send a GET request to /deactivate/{code}. Replace {code} with the timer’s code.
Activate a Timer
To activate a timer again, send a GET request to /activate/{code}. Replace {code} with the timer’s code.
Delete a Timer
To delete a timer, send a DELETE request to /delete/{code}. Replace {code} with the timer’s code.
This guide should give you everything you need to start using the CountdownMail API. Keep your API key safe, and refer to the official documentation for more details on fields like timezones or fonts!