Skip to content
Scheduling the send

Scheduling the send

By Loïc Bresler 4 min read

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:

ParameterTypeRequiredDescription
campaign_idintegeryesID of a draft or scheduled campaign (see the statuses)
send_datetextyessend 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
}
FieldDescription
scheduled_atsend date retained, in ISO 8601 format, Paris time
recipientsnumber 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_status returns 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:

MessageCause
Error campaign_id is missing or is not numeric
Error this user don't have access to campaign_idthe campaign does not belong to your account
Error this campaign is automatic (envoi_mail_auto), it cannot be scheduled or unscheduledan 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 interfacea send in waves is set up in the interface
Error recipients are being processed, try again in a few minutesthe 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 supportcontact 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 administratorsub-account: the main account’s credit is not enough
Error campaign not scheduled, try againtemporary 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:

ParameterTypeRequiredDescription
campaign_idintegeryesID of a scheduled campaign

Example of posted data:

{
  "api_key": "YOUR_API_KEY",
  "campaign_id": 123456
}

Response:

{"result": "unscheduled", "campaign_id": 123456}

Errors:

MessageCause
Error this campaign is not scheduledthe campaign is not scheduled
Error this campaign has already been senttoo 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_idthe campaign does not belong to your account
Last updated on