Scheduled mails

The scheduled object gives you the ability to control when your mails will be sent. You can display a list with upcoming scheduled mails or delete existing ones. To start a scheduled mail set the time when sending a draft.


Renders: [application/json, text/html, application/xml]

Parsers: [application/json, application/x-www-form-urlencoded, multipart/form-data]


Readonly fields

  • id
  • url
  • body
  • plain_text
  • subject
  • sender_id
  • sender_name
  • sender_email
  • time_to_send
  • lists
  • type
  • preview_url
  • css
  • tell_a_friend
  • tracking
  • report_url
  • report_id

Example scheduled mail

{
    "id": 2,
    "url": "https://api.getanewsletter.com/v3/mails/scheduled/1/",
    "body": "<b>Lorem ipsum dolor sit amet.<b>",
    "plain_text": "Lorem ipsum dolor sit amet.",
    "subject": "Mail subject",
    "sender_id": 52,
    "sender_name": "John Doe",
    "sender_email": "john.doe@example.com",
    "time_to_send": "2013-10-07T12:00:00.000Z",
    "lists": [
        {
            "hash": "hiso7tuNb4Z",
            "name": "My list"
        }
    ],
    "type": 0,
    "preview_url": "https://api.getanewsletter.com/v3/mails/sent/2/preview/",
    "css": "",
    "tell_a_friend": null,
    "tracking": [
        {
            "params": {
                "utm_campaign": "cmp_332537",
                "utm_medium": "email",
                "utm_source": "getanewsletter"
            },
            "type": 0
        }
    ],
    "report_url": null,
    "report_id": null
}

GET /mails/scheduled/

Responds with a list of scheduled emails, like usual we provide next, prev, count and the results

Possible url parameters are:

  • page: <int>

Example:

{
    "count": 46,
    "next": "https://api.getanewsletter.com/v3/mails/scheduled/?page=3,
    "previous": "https://api.getanewsletter.com/v3/mails/scheduled/?page=2,
    "results": [
        {
            "id": 2,
            "url": "https://api.getanewsletter.com/v3/mails/scheduled/1/",
            "subject": "Mail subject",
            "sender_id": 52,
            "sender_name": "John Doe",
            "sender_email": "john.doe@example.com",
            "time_to_send": "2013-10-07T12:00:00.000Z",
            "lists": [
                {
                    "hash": "hiso7tuNb4Z",
                    "name": "My list"
                }
            ],
            "type": 0,
            "preview_url": "https://api.getanewsletter.com/v3/mails/sent/2/preview/",
            "report_url": null,
            "report_id": null,
            "updated": "2014-09-04T12:11:45Z",
            "status": 0,
            "queued": false,
            "body": "<b>Lorem ipsum dolor sit amet.<b>",
            "plain_text": "Lorem ipsum dolor sit amet."
        },
        ...
    ]
}

GET /mails/scheduled/<id>/

The details view includes the following additional fields: body, plain_text and css.

Note: Please have in mind that we do not support the creation and editing of block emails via the API, yet. The body and plain_text fields for block emails will be filled with null until the block editor is made available via the API. This means you can still use the block editor from the website to create the email and then send it from the API. Also all of the create/update methods (POST, PUT, PATCH) will raise an exception if the email is a block email.

Example:

{
    "id": 2,
    "url": "https://api.getanewsletter.com/v3/mails/scheduled/1/",
    "body": "<b>Lorem ipsum dolor sit amet.<b>",
    "plain_text": "Lorem ipsum dolor sit amet.",
    "subject": "Mail subject",
    "sender_id": 52,
    "sender_name": "John Doe",
    "sender_email": "john.doe@example.com",
    "time_to_send": "2013-10-07T12:00:00.000Z",
    "lists": [
        {
            "hash": "hiso7tuNb4Z",
            "name": "My list"
        }
    ],
    "type": 0,
    "preview_url": "https://api.getanewsletter.com/v3/mails/sent/2/preview/",
    "css": "",
    "tell_a_friend": null,
    "tracking": [
        {
            "params": {
                "utm_campaign": "cmp_332537",
                "utm_medium": "email",
                "utm_source": "getanewsletter"
            },
            "type": 0
        }
    ],
    "report_url": null,
    "report_id": null
}

DELETE /mails/scheduled/<id>/

Removes the scheduling and resets the mail to a draft.

Example:

DELETE /mails/scheduled/4/

Response
Status 204 No Content