1. Base URL & Versioning
The current stable endpoint is:
https://api.cmfile.net/v1/api
Breaking changes will appear under new version paths (/v2/
, /v3/
, …).
2. Rate Limits
- 100 requests per hour per account.
- If the limit is exceeded the API returns
HTTP 400
and aRetry-After
header (seconds to wait).
3. Transport & Data Formats
- HTTPS only.
- Request & response body: UTF-8 encoded JSON.
- Select the response format via the
Accept
header (application/json
,application/xml
,application/php
) or by appending an extension (e.g./lists.json
).
4. Authentication & Request Signature
- Create an Access Token and Shared Secret under Settings → API in Creamailer.
- For every call compute a SHA-1 hash:
signature = sha1(API_URL + route + json_body + unix_timestamp + shared_secret)
- Send these headers with each request:
X-Access-Token: <ACCESS_TOKEN> X-Request-Signature: <signature> X-Request-Timestamp: <unix_timestamp>
Example (PHP)
$signature = sha1( 'https://api.cmfile.net/v1/api/lists.json' . '{"name":"My list","language":"fi","auto_suppress":true}' . time() . $sharedSecret );
5. Endpoints
All endpoints accept/return .json
, .xml
, or .php
(serialized). Examples below use JSON.
5.1 Mailing Lists (/lists
)
Action | Method & Path | Notes |
---|---|---|
Create list | POST /lists | Body: {"name":"List name","language":"fi","auto_suppress":true}
|
Get one | GET /lists/{LIST_ID} | |
Get all | GET /lists | |
Update | PUT /lists/{LIST_ID} | Same fields as create |
Delete | DELETE /lists/{LIST_ID} | |
List subscribers | GET /lists/subscribers/{LIST_ID}?status=all&pagesize=1000&page=0&date=YYYY-MM-DD | Optional filters |
Field definitions: id
(int, auto), name
(2–50 chars), language
(fi
, en
, es
…), auto_suppress
(bool).
5.2 Subscribers (/subscribers
)
Action | Method & Path | Notes |
---|---|---|
Add one | POST /subscribers/{LIST_ID} | Body at minimum {"email":"user@example.com"}
|
Bulk add/update | POST /subscribers/import/{LIST_ID} | Up to 500 entries; add "update_existing":true to upsert |
Get one | GET /subscribers/{LIST_ID}?email=user@example.com | |
Update one | PUT /subscribers/{LIST_ID} | Supports changing email via new_email
|
Delete / unsubscribe | DELETE /subscribers/{LIST_ID}?email=user@example.com | Sets status to deleted
|
Important fields: email
(required), name
, status
(active
, unsubscribed
, bounced
, spamreport
, deleted
), custom fields array.
5.3 Suppression List (/suppressions
)
Action | Method & Path | Notes |
---|---|---|
Add address | POST /suppressions | Body {"email":"user@example.com"}
|
List addresses | GET /suppressions | |
Remove address | DELETE /suppressions?email=user@example.com |
Optional reason
: unsubscribed
, bounced
, spamreport
, deleted
.
6. Retrieving a List ID
Inside the Creamailer UI: Mailing Lists → select list → More actions → Settings, then copy the numeric “ID” field.
7. Error Handling
- 200 OK / 201 Created – success
- 400 Bad Request – validation error or rate-limit; check body
- 401 Unauthorized – invalid token or signature
- 404 Not Found – wrong path or ID
- 5xx – temporary service error (retry with back-off)
8. Example cURL – Create a List
curl -i https://api.cmfile.net/v1/api/lists.json \ -H "X-Access-Token:${ACCESS_TOKEN}" \ -H "X-Request-Signature:${REQUEST_SIGNATURE}" \ -H "X-Request-Timestamp:${TIMESTAMP}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{"name":"My new list","language":"en","auto_suppress":true}' \ -X POST
Successful response:
{ "success": true, "message": "List added", "id": "1234" }
9. Client Implementation Tips
- Calculate the request signature inside your integration code (e.g., JavaScript, Python, PHP).
- If your workload might exceed 100 requests/hour, implement throttling, queuing, or exponential back-off.
- Store Access Token and Shared Secret in environment variables or a secrets-manager; never commit them to source control.
- Paginate large subscriber fetches using the
pagesize
andpage
parameters. - When a response includes
Retry-After
, pause for the indicated seconds before retrying.
10. Need More?
- Join the Creamailer API mailing list for change notifications.
- SDKs and additional language samples are available in the Creamailer Support Center.
Kommentit
0 kommenttia
Kommentointi on poistettu käytöstä.