Scheduling the send
These methods schedule the actual send of a draft campaign, once it has been set up through the API. At the chosen date, the campaign goes out to all its recipients, exactly like a campaign scheduled from the Sending > Plan menu of the interface.
They are called with POST, with a JSON body that contains your api_key. Parameter tables do not repeat it. See the common rules.
campaign_schedule actually sends the campaign to its recipients, and the send is debited from your credits. The API does not require a test send: send one with campaign_send_test and have it approved before scheduling.The API does not offer an immediate send. To send as soon as possible, schedule the campaign 10 minutes ahead, the minimum delay.
Schedule a campaign
Access point: https://www.mdworks.fr/api_http/campaign_schedule
This method schedules the send of a campaign at a given date. Credits are debited when the campaign goes out. Scheduling a campaign that is already scheduled simply replaces the date.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
campaign_id | integer | yes | ID of a draft or scheduled campaign (see the statuses) |
send_date | text | yes | send date and time, in the YYYY-MM-DD HH:MM format, Paris time. At least 10 minutes ahead, at most one year |
Example of posted data:
{
"api_key": "YOUR_API_KEY",
"campaign_id": 123456,
"send_date": "2026-12-06 10:00"
}Response:
{
"result": "scheduled",
"campaign_id": 123456,
"scheduled_at": "2026-12-06T10:00:00+01:00",
"recipients": 1842
}| Field | Description |
|---|---|
scheduled_at | send date retained, in ISO 8601 format, Paris time |
recipients | number of recipients who will receive the campaign |
The campaign then moves to the scheduled status in campaign_get and campaign_list. It can no longer be edited: to fix it, first cancel its scheduling with campaign_unschedule.
What is checked before scheduling
Scheduling is refused if one of these conditions is not met:
- the campaign is neither sent, nor automatic, nor set up for a send in waves;
- the processing of its recipients is over: wait until
campagne_import_statusreturns a number; - it has at least one recipient, a subject, a valid sender email and a message;
- your credits cover its recipients, on top of the sends already scheduled on the account. For a sub-account that relies on its main account’s credit, that credit is the one checked.
Errors:
| Message | Cause |
|---|---|
Error campaign_id is missing or is not numeric | |
Error this user don't have access to campaign_id | the campaign does not belong to your account |
Error this campaign is automatic (envoi_mail_auto), it cannot be scheduled or unscheduled | an automatic campaign is triggered with envoi_mail_auto |
Error this campaign has already been sent | |
Error this campaign uses wave sending, it can only be scheduled in the interface | a send in waves is set up in the interface |
Error recipients are being processed, try again in a few minutes | the processing of the recipients is not over, try again later |
Error the campaign has no recipients, use campaign_add_recipients | |
Error the campaign has no subject | |
Error the sender email (from_email) is not a valid address | |
Error the campaign has no message, use campaign_set_message | |
Error the message contains a forbidden keyword, contact support | contact support |
Error send_date is missing or invalid (format YYYY-MM-DD HH:MM, Paris time) | date missing, malformed or nonexistent |
Error send_date must be at least 10 minutes in the future | |
Error send_date must be within one year | |
Error not enough credits (X available, N needed including already scheduled sendings) | credits do not cover this campaign and the sends already scheduled |
Error not enough credits on the parent account, contact your administrator | sub-account: the main account’s credit is not enough |
Error campaign not scheduled, try again | temporary incident, try again |
A refused call schedules nothing.
Cancel a scheduling
Access point: https://www.mdworks.fr/api_http/campaign_unschedule
This method cancels the scheduling of a campaign that has not gone out yet. It goes back to draft and can be edited again, then rescheduled.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
campaign_id | integer | yes | ID of a scheduled campaign |
Example of posted data:
{
"api_key": "YOUR_API_KEY",
"campaign_id": 123456
}Response:
{"result": "unscheduled", "campaign_id": 123456}Errors:
| Message | Cause |
|---|---|
Error this campaign is not scheduled | the campaign is not scheduled |
Error this campaign has already been sent | too late, the campaign has gone out |
Error this campaign is automatic (envoi_mail_auto), it cannot be scheduled or unscheduled | |
Error campaign_id is missing or is not numeric | |
Error this user don't have access to campaign_id | the campaign does not belong to your account |