Get campaigns
This method returns the campaigns in the brand your API key belongs to, newest first, a page at a time. You can filter them by status.
URL
https://dashboard.skry.be/api/campaigns/get-campaigns.php
PARAMETERS(POST)
api_keyyour API key.pagethe page to return, starting at 1. Default is1. (optional)limithow many campaigns per page, from 1 to 100. Default is10. Values outside that range are clamped to it. (optional)statusonly return campaigns with this status:draft,scheduled,preparing,sending,sentorpaused. (optional)
Campaign statuses:
draftnot sent and not scheduledscheduledwaiting for its scheduled timepreparingsent, but delivery hasn't started yetsendingdelivery is in progresssentdelivery has finishedpausedsending was stopped
RESPONSE (JSON)
On success you get a JSON object with one entry per campaign, keyed campaign1, campaign2 and so on in the order returned. Errors are returned as plain text. Every response is returned with HTTP status 200.
{
"campaign1": {
"id": 1234,
"title": "October newsletter",
"subject": "What's new this October",
"status": "sent",
"from_name": "Mayo",
"from_email": "contact@example.com",
"reply_to": "contact@example.com",
"recipients": 5120,
"to_send": 5120,
"sent_at": 1760536800,
"scheduled_at": null,
"timezone": null,
"source": "api"
},
"campaign2": {
"id": 1233,
"title": "Black Friday teaser",
"subject": "Something big is coming",
"status": "scheduled",
"from_name": "Mayo",
"from_email": "contact@example.com",
"reply_to": "contact@example.com",
"recipients": 0,
"to_send": 0,
"sent_at": null,
"scheduled_at": 1763978400,
"timezone": "America/New_York",
"source": "ui"
}
}
titleis the campaign's dashboard label, or its subject when it has no label.recipientsis how many emails have gone out so far;to_sendis how many the send is going to.sent_atis a Unix timestamp of when sending started, ornullif it hasn't.scheduled_atandtimezoneare set only for scheduled campaigns (scheduled_atis a Unix timestamp).sourceis where the campaign was created, eg.ui(the dashboard) orapi.
Error: API key not passed
Error: Invalid API key
Error: Brand does not exist
Error: Invalid status
Error: No campaigns found (also returned for a page past the last one)
EXAMPLES
Example request in JavaScript with fetch API
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
var urlencoded = new URLSearchParams();
urlencoded.append("api_key", "<YOUR_API_KEY>");
urlencoded.append("page", "1");
urlencoded.append("limit", "20");
urlencoded.append("status", "sent");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow'
};
fetch("https://dashboard.skry.be/api/campaigns/get-campaigns.php", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Example request in JavaScript with axios
const axios = require('axios');
const qs = require('qs');
let data = qs.stringify({
'api_key': '<YOUR_API_KEY>',
'page': '1',
'limit': '20',
'status': 'sent'
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://dashboard.skry.be/api/campaigns/get-campaigns.php',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});