NAV Navbar
cURL

Overview

This guide will show you how easy it is to communicate with our REST API. All endpoints have logical url's to make it as easy as possible for you to post and receive data.

URL structure

All API requests start with api.getanewsletter.com/. The next segment of the URI depends on the endpoint.

Limitations

It's great that you use our API but we have to set some limitations. The limit is set to 1000 requests per minute. When you reach the limit you will get an error message as following:

Meaning that you will have to wait 43 seconds before the next request can be made.

JSON & XML

You can post and receive data with JSON or XML. This option is available throughout the entire API.

Authentication

Our REST API uses a simple token-based HTTP Authentication scheme.

To authenticate, the token key should be included in the Authorization HTTP header. The key should be prefixed by the string literal "Token", with whitespace separating the two strings. For example:

Authorization: Token c564288ed9694309a96761909a12706f

Unauthenticated responses that are denied permission will result in an HTTP 401 Unauthorized response with an appropriate WWW-Authenticate header. For example:

WWW-Authenticate: Token

The curl command line tool may be useful for testing token authenticated APIs and we have provided examples for all our endpoints.

Obtaining a token

To obtain a token you need to log in to your account, navigate to "Contacts > API & Forms" and then click on the link "Add token". This action will take you to a new page where you can give the token a name and description. This will help you to separate your different tokens if you have more than one. To read more about how to use the token see the section above, "Authentication".

Step-by-step

  1. Log in to your account
  2. Navigate to "Contacts > API & Forms"
  3. Click the link "Add token".
  4. Enter a name and a description for your token.
  5. Congratulations, your token has been created!

Contacts

The contacts object is where you handle all of your contacts. That includes email, attributes and which lists the contacts subscribes to.

Example contact
    {
        "url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
        "first_name": "John",
        "last_name": "Doe",
        "email": "john.doe@example.com",
        "created": "2011-03-14T13:37:12Z",
        "updated": "2013-08-20T04:41:49Z",
        "attributes": {
            "city": "Stockholm",
            "company": "Example Inc."
        },
        "lists": [
            {
                "subscription_cancelled": null,
                "subscription_id": 6982,
                "hash": "hiso7tuNb4Z",
                "name": "My List",
                "subscription_created": "2013-03-26T08:50:30Z"
            }
        ],
        "active": true
    }

GET /contacts/

    curl https://api.getanewsletter.com/v3/contacts 
    -H 'Authorization: Token <your token>'

    Response
    {
        "count": 46,
        "next": "https://api.getanewsletter.com/v3/contacts/?page=3,
        "previous": "https://api.getanewsletter.com/v3/contacts/?page=2,
        "results": [
            {
                "url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
                "first_name": "John",
                "last_name": "Doe",
                "email": "john.doe@example.com",
                "created": "2011-03-14T13:37:12Z",
                "updated": "2013-08-20T04:41:49Z",
                "attributes": {
                    "city": "Stockholm",
                    "company": "Example Inc."
                },
                "lists": [
                    {
                        "subscription_cancelled": null,
                        "subscription_id": 6982,
                        "hash": "hiso7tuNb4Z",
                        "name": "My List",
                        "subscription_created": "2013-03-26T08:50:30Z"
                    }
                ],
                "active": true
            },
            {...}
        ]
    }'

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

Possible url parameters are:

POST /contacts/

    curl https://api.getanewsletter.com/v3/contacts/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d '
    {
        "email": "john.doe@example.com",
        "first_name": "John",
        "last_name": "Doe",
        "lists": [
            {"hash": "hiso7tuNb4Z"},
            {"hash": "hal332tlgnnf"}
        ],
        "attributes": {
            "city": "Stockholm",
            "company": "Example Inc."
        }
    }'

    Response
    {
        "url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
        "first_name": "John",
        "last_name": "Doe",
        "email": "john.doe@example.com",
        "created": "2013-08-20T04:41:49Z",
        "updated": "2013-08-20T04:41:49Z",
        "attributes": {
            "city": "Stockholm",
            "company": "Example Inc."
        },
        "lists": [
            {
                "subscription_cancelled": null,
                "subscription_id": 6982,
                "hash": "hiso7tuNb4Z",
                "name": "My List",
                "subscription_created": "2013-08-20T04:41:49Z"
            },
            {
                "subscription_cancelled": null,
                "subscription_id": 6982,
                "hash": "hal332tlgnnf",
                "name": "My Other List",
                "subscription_created": "2013-08-20T04:41:49Z"
            }
        ], 
        "active": true
    }

Creates a new contact. The only required parameter is the email

Possible issues / Error message explanation:

You can not confirm the subscription for users that have previously cancelled it. If you do not see this contact as cancelled in your list then it has been deleted after the subscription cancellation.


PUT /contacts/<email>/

    curl -X PUT https://api.getanewsletter.com/v3/contacts/john.doe@example.com/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d '
    {
        "first_name": "John",
        "last_name": "Doe",
        "lists": [
            {"hash": "hiso7tuNb4Z"},
            {"hash": "hal332tlgnnf"}
        ],
        "attributes": {
            "city": "Stockholm",
            "company": "Example Inc."
        }
    }'

    Response
    {
        "url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
        "first_name": "John",
        "last_name": "Doe",
        "email": "john.doe@example.com",
        "created": "2013-08-01T13:17:33Z",
        "updated": "2013-08-20T04:41:49Z",
        "attributes": {
            "city": "Stockholm",
            "company": "Example Inc."
        },
        "lists": [
            {
                "subscription_cancelled": null,
                "subscription_id": 6982,
                "hash": "hiso7tuNb4Z",
                "name": "My List",
                "subscription_created": "2013-08-20T04:41:49Z"
            },
            {
                "subscription_cancelled": null,
                "subscription_id": 6982,
                "hash": "hal332tlgnnf",
                "name": "My Other List",
                "subscription_created": "2013-08-20T04:41:49Z"
            }
        ],
        "active": true
    }

Update or create a contact, if a contact doesn't exist it's created.

Status code is 200 if the contact is updated and 201 if it's created

If you change the email you will get a Location header pointing to the new endpoint for this contact.

201 Created 200 Updated

PATCH /contacts/<email>/

curl -X PATCH https://api.getanewsletter.com/v3/contacts/john.doe@example.com/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d '
    {
        "first_name": "Eric",
        "attributes": {
            "city": "Uppsala"
        }
    }

    Response
    {
        "url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
        "first_name": "Eric",
        "last_name": "Doe",
        "email": "john.doe@example.com",
        "created": "2013-08-01T13:17:33Z",
        "updated": "2013-08-20T04:41:49Z",
        "attributes": {
            "city": "Uppsala",
            "company": "Example Inc."
        },
        "lists": [
            {
                "subscription_cancelled": null,
                "subscription_id": 6982,
                "hash": "hiso7tuNb4Z",
                "name": "My List",
                "subscription_created": "2013-08-20T04:41:49Z"
            },
            {
                "subscription_cancelled": null,
                "subscription_id": 6982,
                "hash": "hal332tlgnnf",
                "name": "My Other List",
                "subscription_created": "2013-08-20T04:41:49Z"
            }
        ],
        "active": true
    }

Patch is used for partial updates. Use it if you want to update a contact but don't want to overwrite all values.

DELETE /contacts/<email>/

curl -X DELETE https://api.getanewsletter.com/v3/contacts/john.doe@example.com/
    -H 'Authorization: Token <your token>'

Deletes the contact.

Response Status 204 No Content

Importing contacts from CSV

This function allows you to import multiple contacts with their attributes and subscribe them to specific lists in a simple two-step process. The data should be in the form of a raw or zipped CSV(comma separated values) file.

This is a two-step process:

  1. Specify the import parameters
  2. Upload your file

Step 1. Specify the import parameters.

POST /contacts/import/file/

curl  https://api.getanewsletter.com/v3/contacts/import/file/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d '
    {
        "lists": [
            "NW3T9uQs4FJwckm",
            "ZWvs8NjJNew92yVt3s"
        ],
        "mapping": {
            "contact": {
                "email": "email column",
                "first_name": "First name",
                "last_name": "Last name"
            },
            "attributes": {
                "city": "City",
                "age": "Age"
            }
        },
        "mode": 1,
        "delimiter": ";",
        "quotechar": "\"",
        "escapechar": "\\"
    }'

Response 202:

    {
        "url": "https://api.getanewsletter.com/v3/contacts/import/file/82Y0lPCe/",
        "hash": "82Y0lPCe",
        "lists": [
            "NW3T9uQs4FJwckm",
            "ZWvs8NjJNew92yVt3s"
        ],
        "mapping": {
            "attributes": {
                "city": "City",
                "age": "Age"
            },
            "contact": {
                "first_name": "First name",
                "last_name": "Last name",
                "email": "email column"
            }
        },
        "mode": 1,
        "delimiter": ";",
        "quotechar": "\"",
        "escapechar": "\\",
        "file": null,
        "status": 0,
        "errors_file": null
    }

Possible parameters are:

Step 2. Upload your file

The second step is to upload the file. When you POST the import parameters you will receive a URL in response. This is the URL you´re going to POST to in order to import your contacts. Both zipped and plain CSV files are supported.

POST https://api.getanewsletter.com/v3/contacts/import/file/82Y0lPCe/

    curl -iv -F file=@$1 https://api.getanewsletter.com/v3/contacts/import/file/82Y0lPCe/
    -H 'Authorization: Token <your token>'

If everything went ok your contacts should start uploading. To confirm this you can navigate to the URL you posted to and hopefully receive the following result:

    curl https://api.getanewsletter.com/v3/contacts/import/file/79M6PkWI1plvP/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 

    Response
    {
    "url": "https://api.getanewsletter.com/v3/contacts/import/file/79M6PkWI1plvP/",
    "hash": "79M6PkWI1plvP",
    "lists": [
        "2Tj209dfCHt"
    ],
    "mapping": {
        "contact": {
            "first_name": "First name",
            "last_name": "Last name",
            "email": "email"
        }
    },
    "mode": 0,
    "delimiter": ";",
    "quotechar": "\"",
    "escapechar": "\\",
    "file": "protected/csv_files/contacts3_7.csv",
    "status": 30,
    "errors_file": "https://api.getanewsletter.com/v3/contacts/import/file/79M6PkWI1plvP/errors_file/"
}

You can see that the only real difference is the values for file, errors_file and status. The file parameter returns the name of the .csv file you uploaded. The errors_file parameter returns a link to a file containing possible errors. The status parameter returns the status for your upload. Possible statuses are:

Statuses

The first step is optional so you can directly upload the file. In this case the following default values are used:

** Default values **

The attribute mode defines the action performed if contacts with the same email address already exists. Possible values are:

Possible issues / Error messages explanation:

Message: You can not provide both file and metadata with one request. Explanation: The metadata and the file can not be provided in a single request. If you want to specify the import metadata send it first and then upload the file.

Message: Unable to find email column. Explanation: There is not a column with label matching the "email" or the provided value if using custom mapping.

Importing contacts multiple contacts

This function allows you to import multiple contacts with their attributes and subscribe them to specific lists using a single API call. You can add a maximum of 100 contacts per bulk insert. Import by file is recommended for larger amounts.

POST /contacts/import/bulk/

curl  https://api.getanewsletter.com/v3/contacts/import/bulk/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d '
    {
        "items": [
            {
                "email": "john.doe@example.com",
                "first_name": "John",
                "last_name": "Doe",
                "lists": [],
                "attributes": {
                    "company": "Example Inc."
                }
            }, {
                "email": "jane.doe@example.com",
                "first_name": "Jane",
                "lists": [
                    "NW3T9uQs4FJwckm",
                    "ZWvs8NjJNew92yVt3s"
                ],
                "attributes": {
                    "city": "Stockholm"
                }
            }
        ],
        "mode": 2
    }'

Response 202:

{
    "items": [
        "Invalid list id(s): NW3T9uQs4FJwckm."
    ]
}

Required fields:

Optional fields:

In case of no errors the response is empty.

** Default values **

The attribute mode defines the action performed if contact with the same email address already exists. Possible values are:

Subscriptions

Lists the existing subscriptions.

Example subscriber
    {
        "id": 13174,
        "url": "https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/subscribers/john.doe@example.com/",
        "contact": "john.doe@example.com",
        "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
        "list": "hiso7tuNb4Z",
        "list_name": "My list",
        "list_url": "https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/",
        "created": "2013-08-26T09:23:47Z",
        "cancelled": null,
        "responders": []
    }

GET /subscriptions/

curl  https://api.getanewsletter.com/v3/subscriptions/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 

Reponse
 {
        "count": 46,
        "next": "http://gantest.com:8000/v3/subscriptions/?page=4",
        "previous": "http://gantest.com:8000/v3/subscriptions/?page=2",
        "results": [
            {
                "id": 613840,
                "url": "http://api.getanewsletter.com/v3/lists/PW4wBjSmaD3AJqL8/subscribers/john.doe2%40example.com/",
                "contact": "john.doe2@example.com",
                "contact_url": "http://api.getanewsletter.com/v3/contacts/john.doe2%40example.com/",
                "list": "PW4wBjSmaD3AJqL8",
                "list_name": "New list for import",
                "list_url": "http://api.getanewsletter.com/v3/lists/PW4wBjSmaD3AJqL8/",
                "created": "2014-06-20T07:28:47Z",
                "cancelled": null,
                "responders": []
            },
            ...
        ]
    }

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

Possible url parameters are:

Example:

For details about the subscription object, please check the subscribers section.

Attributes

Example attribute
    {
        "url": "https://api.getanewsletter.com/v3/attributes/city/",
        "name": "City",
        "code": "city",
        "usage_count": 2
    }

The attributes object contains information about your contacts. As default every contact have attributes for email, first name and last name. You also have the ability to create custom attributes.

GET /attributes/

curl  https://api.getanewsletter.com/v3/attributes/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 

Response
{
  "count": 46,
  "next": "https://api.getanewsletter.com/v3/attributes/?page=3,
  "previous": "https://api.getanewsletter.com/v3/attributes/?page=2,
  "results": [
  {
      "url": "https://api.getanewsletter.com/v3/attributes/city/",
      "name": "City",
      "code": "city",
      "usage_count": 324
  },
  ...
  ]
}

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

Possible url parameters are:

POST /attributes/

Creates a new attribute. The only required parameter is the name.

curl  https://api.getanewsletter.com/v3/attributes/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d 
    '{
        "name": "City"
    }'


Response
{
    "url": "https://api.getanewsletter.com/v3/attributes/city/",
    "name": "City",
    "code": "city",
    "usage_count": 0
}
Location: https://api.getanewsletter.com/v3/attributes/city/

PUT /attributes/<code>/

curl -X PUT https://api.getanewsletter.com/v3/attributes/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d 
    '{
        "name": "City"
    }'

Response
{
    "url": "https://api.getanewsletter.com/v3/attributes/city/",
    "name": "City",
    "code": "city",
    "usage_count": 0
}
201 Created
200 Updated

Update or create an attribute, if an attribute doesn't exist it's created.

Keep in mind that the code cannot be changed after the creation of an attribute.

Status code is 200 if the attribute is updated and 201 if it's created

PATCH /attributes/<code>/

Patch is used for partial updates. Since attributes only has one updatable field it has the same effect as PUT.

DELETE /attributes/<code>/

Deletes the attribute.

curl -X DELETE https://api.getanewsletter.com/v3/attributes/city/
    -H 'Authorization: Token <your token>'

Response
Status 204 No Content

Lists

{
    "url": "https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/",
    "hash": "hiso7tuNb4Z",
    "name": "Standard list",
    "active_subscribers_count": 2,
    "subscribers_count": 4,
    "description": "A list where you can collect yor subscribers",
    "sender": "John Sender",
    "email": "john.doe@example.com",
    "created": "2013-08-26T09:23:47Z",
    "subscribers": "https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/subscribers/",
    "responders_count": 0,
    "responders": []
}

The list object is a collection of contacts. You can group contacts into different lists to make it possible to send different newsletters to different groups of contacts.

GET /lists/

curl https://api.getanewsletter.com/v3/lists/
    -H 'Authorization: Token <your token>'

Response
{
  "count": 46,
  "next": "https://api.getanewsletter.com/v3/lists/?page=3",
  "previous": "https://api.getanewsletter.com/v3/lists/?page=2",
  "results": [
      {
          "url": "https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/",
          "hash": "hiso7tuNb4Z",
          "name": "Standard list",
          "active_subscribers_count": 2,
          "description": "A list where you can collect yor subscribers",
          "sender": "John Sender",
          "email": "john.doe@example.com",
          "created": "2013-08-26T09:23:47Z",
          "subscribers": "https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/subscribers/",
          "responders_count": 0
      },
      ...
  ]
}

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

Possible url parameters are:

POST /lists/

curl https://api.getanewsletter.com/v3/lists/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d 
    '{
        "name": "My new list",
        "sender": "John Sender",
        "email": "newsletter@mycompany.com"
    }'

Response
{
  "url": "https://api.getanewsletter.com/v3/lists/pcbe1/",
  "hash": "pcbe1",
  "name": "My new list",
  "active_subscribers_count": 0,
  "subscribers_count": 0,
  "description": "",
  "sender": "John Sender",
  "email": "newsletter@mycompany.com",
  "created": "2013-08-30T13:42:53.409Z",
  "subscribers": "https://api.getanewsletter.com/v3/lists/pcbe1/subscribers/",
  "responders_count": 0,
  "responders": []
}
Location: https://api.getanewsletter.com/v3/lists/pcbe1/

Creates a new list. The only required parameters are name, sender and email.

PUT /lists/<hash>/

curl -X PUT https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d 
    '{
        "name": "My new list",
        "email": "newsletter@mycompany.com"
    }'

Response
{
  "url": "https://api.getanewsletter.com/v3/lists/oDgEyeHcd2Tb/",
  "hash": "oDgEyeHcd2Tb",
  "name": "My new list",
  "active_subscribers_count": 0,
  "subscribers_count": 0,
  "description": "",
  "sender": "John Sender",
  "email": "newsletter@myothercompany.com"
  "created": "2013-08-30T13:42:02Z",
  "subscribers": "https://api.getanewsletter.com/v3/lists/oDgEyeHcd2Tb/subscribers/",
  "responders_count": 0,
  "responders": []
},
200 Updated

Update or create a list, if the list doesn't exist it's created.

Status code is 200 if the list is updated and 201 if it's created

PATCH /lists/<hash>/

curl -X PATCH https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d 
    '{
        "name": "My awesome list"
    }'

Response
{
    "url": "https://api.getanewsletter.com/v3/lists/oDgEyeHcd2Tb/",
    "hash": "oDgEyeHcd2Tb",
    "name": "My awesome list",
    "active_subscribers_count": 0,
    "subscribers_count": 0,
    "description": "",
    "sender": "John Sender",
    "email": "newsletter@myothercompany.com",
    "created": "2013-08-30T13:42:02Z",
    "subscribers": "https://api.getanewsletter.com/v3/lists/oDgEyeHcd2Tb/subscribers/",
    "responders_count": 0,
    "responders": []
}
200 OK

Patch is used for partial updates. You can update name, sender and email.

DELETE /lists/<hash>/

curl -X DELETE https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/
    -H 'Authorization: Token <your token>'

Response
Status 204 No Content

Deletes the list.

Subscribers

Example subscriber
    {
        "id": 57,
        "url": "https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/subscribers/john.doe@example.com/",
        "contact": "john.doe@example.com",
        "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
        "list": "hiso7tuNb4Z",
        "list_name": "My list",
        "list_url": "https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/",
        "created": "2013-08-26T09:23:47Z",
        "cancelled": null,
        "responders": []
    }

The subscribers object shows which lists your contacts subscribe to. One contact can have several subscriptions. You can add and remove contacts from any given list.

GET /lists/<hash>/subscribers/

curl https://api.getanewsletter.com/v3//lists/<hash>/subscribers/
    -H 'Authorization: Token <your token>'

Response
{
    "count": 46,
    "next": "https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/subscribers/?page=3",
    "previous": "https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/subscribers/?page=2",
    "results": [
        {
            "id": 57,
            "url": "https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/subscribers/john.doe@example.com/",
            "contact": "john.doe@example.com",
            "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
            "list": "hiso7tuNb4Z",
            "list_name": "My list",
            "list_url": "https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/",
            "created": "2013-08-26T09:23:47Z",
            "cancelled": null,
            "responders": []
        },
        ...
    ]
}

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

Possible url parameters are:

POST /lists/<hash>/subscribers/

curl https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/subscribers/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d
    '{
        "contact": "john.doe@example.com"
    }'

Response
{
    "id": 57,
    "url": "https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/subscribers/john.doe@example.com/",
    "contact": "john.doe@example.com",
    "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
    "list": "hiso7tuNb4Z",
    "list_name": "My list",
    "list_url": "https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/",
    "created": "2013-08-26T09:23:47Z",
    "cancelled": null,
    "responders": []
}
Location: https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/subscribers/john.doe@example.com/

Creates a new subscriber. The only required parameter is contact. The contact have to exist on your account to be able to create a new subscription.

If you set cancelled": true the subscription will be cancelled.

PUT /lists/<hash>/subscribers/<subscriber_email>/

curl -X PUT https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/john.doe@example.com/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d
    '{
        "cancelled": true
    }'

Response
{
    "id": 57,
    "url": "https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/subscribers/john.doe@example.com/",
    "contact": "john.doe@example.com",
    "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
    "list": "hiso7tuNb4Z",
    "list_name": "My list",
    "list_url": "https://api.getanewsletter.com/v3/lists/hiso7tuNb4Z/",
    "created": "2013-08-26T09:23:47Z",
    "cancelled": "2014-01-25T03:13:37Z",
    "responders": []
},
201 Created
200 Updated

Update or create a subscriber, if the list doesn't exist it's created.

Status code is 200 if the attribute is updated and 201 if it's created

PATCH /lists/<hash>/subscribers/<subscriber_email>/

Patch is used for partial updates. Since attributes only has one updatable field it has the same effect as PUT.

DELETE /lists/<hash>/subscribers/<subscriber_email>/

curl -X DELETE https://api.getanewsletter.com/v3/list/hiso7tuNb4Z/subscribers/john.doe@example.com/
    -H 'Authorization: Token <your token>'

Response
Status 204 No Content

Removes the subscriber from the list.

Subscription forms

{
        "url": "http://api.getanewsletter.com/v3/subscription_forms/Ml8ScUfjTP/",
        "key": "Ml8ScUfjTP",
        "name": "form-12",
        "lists": [
            "ZKHwZ"
        ],
        "lists_names": "List_34029",
        "next_url": null,
        "button_text": null,
        "first_name": true,
        "last_name": true,
        "attributes": [
            "attributename23",
            "attributename24",
            "attributename25"
        ],
        "form": "<form action=\"http://gansub.com/s/odsk4j4398b/\">\n    <input type=\"hidden\" name=\"newsletter\" value=\"ZKHwZ\" id=\"id_newsletter\" />\n    <input type=\"hidden\" name=\"next_url\" id=\"id_next_url\" value=\"http://example.com/next_url/\"/>\n    <input type=\"hidden\" name=\"api_key\" value=\"Ml8ScUfjTP\" id=\"id_api_key\" />\n\n    <label for=\"email\">Email</label>\n    <input type=\"text\" id=\"email\" name=\"email\" />\n    \n<label for=\"email\">First name</label>\n<input type=\"text\" id=\"first_name\" name=\"first_name\" />\n        \n    \n<label for=\"email\">Last name</label>\n<input type=\"text\" id=\"last_name\" name=\"last_name\" />\n        \n    \n<label for=\"email\">AttributeName23</label>\n<input type=\"text\" id=\"attributename23\" name=\"attributename23\" />\n        \n\n<label for=\"email\">AttributeName24</label>\n<input type=\"text\" id=\"attributename24\" name=\"attributename24\" />\n        \n\n<label for=\"email\">AttributeName25</label>\n<input type=\"text\" id=\"attributename25\" name=\"attributename25\" />\n        \n    <input type=\"submit\" value=\"None\" />\n</form>",
        "form_link": "http://gansub.com/s/odsk4j4398b/",
        "verify_mail_subject": "",
        "verify_mail_text": "",
        "sender": "",
        "email": ""
    }

List of forms you can use to subscribe user to your newsletter(s).

GET /subscription_forms/

curl https://api.getanewsletter.com/v3/subscription_forms/
    -H 'Authorization: Token <your token>'

Response
{
    "count": 6,
    "next": null,
    "previous": null,
    "results": [
        {
          "url": "http://api.getanewsletter.com/v3/subscription_forms/Ml8ScUfjTP/",
          "key": "Ml8ScUfjTP",
          "name": "form-12",
          "lists": [
              "ZKHwZ"
          ],
          "lists_names": "List_34029",
          "next_url": null,
          "button_text": null,
          "first_name": true,
          "last_name": true,
          "attributes": [
              "attributename23",
              "attributename24",
              "attributename25"
          ],
          "form": "<form action=\"http://gansub.com/s/odsk4j4398b/\">\n    <input type=\"hidden\" name=\"newsletter\" value=\"ZKHwZ\" id=\"id_newsletter\" />\n    <input type=\"hidden\" name=\"next_url\" id=\"id_next_url\" value=\"http://example.com/next_url/\"/>\n    <input type=\"hidden\" name=\"api_key\" value=\"Ml8ScUfjTP\" id=\"id_api_key\" />\n\n    <label for=\"email\">Email</label>\n    <input type=\"text\" id=\"email\" name=\"email\" />\n    \n<label for=\"email\">First name</label>\n<input type=\"text\" id=\"first_name\" name=\"first_name\" />\n        \n    \n<label for=\"email\">Last name</label>\n<input type=\"text\" id=\"last_name\" name=\"last_name\" />\n        \n    \n<label for=\"email\">AttributeName23</label>\n<input type=\"text\" id=\"attributename23\" name=\"attributename23\" />\n        \n\n<label for=\"email\">AttributeName24</label>\n<input type=\"text\" id=\"attributename24\" name=\"attributename24\" />\n        \n\n<label for=\"email\">AttributeName25</label>\n<input type=\"text\" id=\"attributename25\" name=\"attributename25\" />\n        \n    <input type=\"submit\" value=\"None\" />\n</form>",
          "form_link": "http://gansub.com/s/odsk4j4398b/",
          "verify_mail_subject": "",
          "verify_mail_text": "",
          "sender": "",
          "email": ""
        },
        ...
}

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

Possible url parameters are:

POST /subscription_forms/

curl https://api.getanewsletter.com/v3//subscription_forms/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d
    '
    {
        "name": "Form name",
        "lists": ["ZKHwZ"],
        "attributes": [],
        "sender": "Sender name",
        "email": "john_doe@example.com"
    }'

Response
{
    "url": "http://api.getanewsletter.com/v3/subscription_forms/kRctg7ko1AcCnZSPO89/",
    "key": "kRctg7ko1AcCnZSPO89",
    "name": "Form name",
    "lists": [
        "ZKHwZ"
    ],
    "lists_names": "List_34029",
    "next_url": null,
    "button_text": null,
    "first_name": false,
    "last_name": false,
    "attributes": [],
    "form": "<form action=\"http://gansub.com/s/odsk4j4398b/\">\n    <input type=\"hidden\" name=\"newsletter\" value=\"ZKHwZ\" id=\"id_newsletter\" />\n    <input type=\"hidden\" name=\"next_url\" id=\"id_next_url\" value=\"http://example.com/next_url/\"/>\n    <input type=\"hidden\" name=\"api_key\" value=\"kRctg7ko1AcCnZSPO89\" id=\"id_api_key\" />\n\n    <label for=\"email\">Email</label>\n    <input type=\"text\" id=\"email\" name=\"email\" />\n    \n    \n    \n    <input type=\"submit\" value=\"None\" />\n</form>",
    "form_link": "http://gansub.com/s/odsk4j4398b/",
    "verify_mail_subject": "",
    "verify_mail_text": "",
    "sender": "Sender name",
    "email": "john_doe@example.com"
}
Location: http://api.getanewsletter.com/v3/subscription_forms/kRctg7ko1AcCnZSPO89/

Creates a new subscription forms.

PUT /subscription_forms/<form_hash>/

curl -X PUT https://api.getanewsletter.com/v3/subscription_forms/kRctg7ko1AcCnZSPO89/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d
    '{
        "name": "Form name",
        "lists": ["ZKHwZ"],
        "attributes": [],
        "sender": "Sender name",
        "email": "john_doe@example.com"
    }'

Response
{
    "url": "http://api.getanewsletter.com/v3/subscription_forms/kRctg7ko1AcCnZSPO89/",
    "key": "kRctg7ko1AcCnZSPO89",
    "name": "Form name",
    "lists": [
        "ZKHwZ"
    ],
    "lists_names": "List_34029",
    "next_url": null,
    "button_text": null,
    "first_name": false,
    "last_name": false,
    "attributes": [],
    "form": "<form action=\"http://gansub.com/s/odsk4j4398b/\">\n    <input type=\"hidden\" name=\"newsletter\" value=\"ZKHwZ\" id=\"id_newsletter\" />\n    <input type=\"hidden\" name=\"next_url\" id=\"id_next_url\" value=\"http://example.com/next_url/\"/>\n    <input type=\"hidden\" name=\"api_key\" value=\"kRctg7ko1AcCnZSPO89\" id=\"id_api_key\" />\n\n    <label for=\"email\">Email</label>\n    <input type=\"text\" id=\"email\" name=\"email\" />\n    \n    \n    \n    <input type=\"submit\" value=\"None\" />\n</form>",
    "form_link": "http://gansub.com/s/odsk4j4398b/",
    "verify_mail_subject": "",
    "verify_mail_text": "",
    "sender": "Sender name",
    "email": "john_doe@example.com"
},
201 Created
200 Updated

Update or create a subscription form.

Status code is 200 if the attribute is updated and 201 if it's created

PATCH /subscription_forms/<form_hash>/

Patch is used for partial updates.

DELETE /subscription_forms/<form_hash>/

curl -X DELETE https://api.getanewsletter.com/v3/subscription_forms/kRctg7ko1AcCnZSPO89/
    -H 'Authorization: Token <your token>'

Response
Status 204 No Content

Removes the subscription form.

Mails

There is a number of options for sending, displaying and alter mails. You can display draft, send mails, control the time for your scheduled mails and much more.

Drafts

The drafts object is created mails that´s not yet sent. You can display current drafts with the GET-method, create new drafts with the POST-method or update drafts with the PUT or PATCH-method.

Send mails

Once you´ve created or updated a draft you probably want to send it aswell. This is possible through the send object.

Sent mails

You can either display a list with link to all your sent mail or display single mails in full. This is all possible through the sent object.

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.

Auto-responder mails

The mails attached to auto-responders. You can list, retrieve and edit auto-responder mails.

Templates

The HTML templates gives you full control over your templates. You have the ability to set subject, body, a plain text version and css.

Draft Mails

    {
        "id": 12
        "url": "https://api.getanewsletter.com/v3/mails/drafts/12/",
        "subject": "Get a Newsletter",
        "body": "<b>This is our weekly newsletter<b>",
        "blockdocument": null,
        "plain_text": "This is our weekly newsletter.",
        "css": "",
        "type": 0,
        "updated": "2013-09-06T07:20:31Z",
        "created": "2013-09-06T07:20:31Z",
        "preview_url": "https://api.getanewsletter.com/v3/mails/drafts/12/preview/",
        "send_url": "https://api.getanewsletter.com/v3/mails/drafts/12/send/"
    }

The drafts object is created mails that´s not yet sent. You can display current drafts with the GET-method, create new drafts with the POST-method or update drafts with the PUT or PATCH-method.

Example draft email

GET /mails/drafts/

curl https://api.getanewsletter.com/v3/mails/drafts/
    -H 'Authorization: Token <your token>'

Response
    {
        "count": 46,
        "next": "https://api.getanewsletter.com/v3/mails/drafts/?page=3,
        "previous": "https://api.getanewsletter.com/v3/mails/drafts/?page=2,
        "results": [
            {
                "url": "https://api.getanewsletter.com/v3/mails/drafts/12/",
                "id": 170,
                "subject": "Mail subject",
                "type": 0,
                "updated": "2013-09-06T07:20:31Z",
                "created": "2013-09-06T07:20:31Z",
                "preview_url": "https://api.getanewsletter.com/v3/mails/drafts/170/preview/",
                "send_url": "https://api.getanewsletter.com/v3/mails/drafts/170/send/",
                "blockdocument_id": null
            }
        ]
    }

Returns list of draft emails, like usual we provide next, prev, count and the results. This list contains both normal HTML emails and block emails.

Possible url parameters are:

Mail types description:

Example:

It is possible to filter by type. Example url mails/drafts/?type=0.

GET /mails/drafts/<id>/

curl https://api.getanewsletter.com/v3/mails/drafts/<id>/
    -H 'Authorization: Token <your token>'
    {
        "count": 46,
        "next": "https://api.getanewsletter.com/v3/mails/drafts/?page=3,
        "previous": "https://api.getanewsletter.com/v3/mails/drafts/?page=2,
        "results": [
            {
                "id": 12
                "url": "https://api.getanewsletter.com/v3/mails/drafts/12/",
                "subject": "Get a Newsletter",
                "body": "<b>This is our weekly newsletter<b>",
                "blockdocument": null,
                "plain_text": "This is our weekly newsletter.",
                "css": "",
                "type": 0,
                "updated": "2013-09-06T07:20:31Z",
                "created": "2013-09-06T07:20:31Z",
                "preview_url": "https://api.getanewsletter.com/v3/mails/drafts/12/preview/",
                "send_url": "https://api.getanewsletter.com/v3/mails/drafts/12/send/"
            }
        ]
    }

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

POST /mails/drafts/

curl -X PUT https://api.getanewsletter.com/v3/mails/drafts/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d 
    '{
        "subject": "Mail subject",
        "body": "<b>This is our weekly newsletter<b>",
        "plain_text": "This is our weekly newsletter.",
        "css": "h1 {color: red }"
    }'

Response
{
    "id": 12
    "url": "https://api.getanewsletter.com/v3/mails/drafts/12/",
    "subject": "Mail subject",
    "body": "<b>This is our weekly newsletter<b>",
    "blockdocument": null,
    "plain_text": "This is our weekly newsletter.",
    "css": "h1 {color: red }",
    "type": 0,
    "updated": "2013-09-06T07:20:31Z",
    "created": "2013-09-06T07:20:31Z",
    "preview_url": "https://api.getanewsletter.com/v3/mails/drafts/12/preview/",
    "send_url": "https://api.getanewsletter.com/v3/mails/drafts/12/send/"
}

Creates a new standard/HTML draft. Required fields are:

Optional fields are:

To create block draft you have to make a POST request to a block template.

Example:

POST /mails/templates/block/7678/draft/

For more information check the block templates section.

PUT /mails/drafts/<id>/

Updates a draft with new data. Required fields are:

Optional fields are:

PATCH mails/drafts/<id>/

curl -X PATCH https://api.getanewsletter.com/v3/mails/drafts/12/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d 
    '{
        "subject": "Mail subject"
    }'

Response
{
    "id": 12
    "url": "https://api.getanewsletter.com/v3/mails/drafts/12/",
    "subject": "Mail subject",
    "body": "<b>This is our weekly newsletter<b>",
    "blockdocument": null,
    "plain_text": "This is our weekly newsletter.",
    "css": "h1 {color: red }",
    "type": 0,
    "updated": "2013-09-06T07:20:31Z",
    "created": "2013-09-06T07:20:31Z",
    "preview_url": "https://api.getanewsletter.com/v3/mails/drafts/12/preview/",
    "send_url": "https://api.getanewsletter.com/v3/mails/drafts/12/send/"
}

Patch is used for partial updates. Use it if you want to update a draft but don't want to overwrite all values.

DELETE /mails/drafts/<id>/

curl -X DELETE https://api.getanewsletter.com/v3/mails/drafts/600/
    -H 'Authorization: Token <your token>'

Response
HTTP 204 NO CONTENT

Deletes the email.

POST /mails/drafts/<id>/copy/

curl -X POST https://api.getanewsletter.com/v3/mails/drafts/598/copy/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 

Response
    HTTP 201 CREATED
    {
        "id": 604,
        "url": "https://api.getanewsletter.com/v3/mails/drafts/604/",
        "subject": "Copy of sdvsdv",
        "body": "sdvsdvsd",
        "blockdocument": null,
        "plain_text": "",
        "css": "sdvsdvsdv",
        "type": 0,
        "updated": "2014-06-25T13:46:38.150Z",
        "created": "2014-06-25T13:46:38.150Z",
        "preview_url": "https://api.getanewsletter.com/v3/mails/drafts/604/preview/",
        "send_url": "https://api.getanewsletter.com/v3/mails/drafts/604/send/"
    }

Creates a copy of the draft.

Send mails

Example send email
    {
        "sender_name": "John Doe",
        "lists": ["hiso7tuNb4Z", "s5NaP93Oojg"],
        "sender_email": "john.doe@example.com",
        "test": true,
        "css": "",
        "tracking": 0,
        "tell_a_friend": "s5NaP93Oojg",
        "time_to_send": "2013-05-07T12:00:00"
    }

Once you´ve created or updated a draft you probably want to send it aswell. This is possible through the send object.

Required fields

Optional fields

Readonly fields

POST /mails/drafts/<id>/send/

To send an email you must first create a draft. This endpoint queues the mail for sending. Set time_to_send to null or just leave it out to send the email now.

Test mails

You can send test mails to make sure that the mail looks good in your email client. Test mails don´t affect your email balance and you can have a maximum of 20 receivers in the list(s). We will ignore the analytics identifier and the mail will still be a draft and available under /mails/drafts/ after you´ve sent it.

It will not be under /mails/sheduled/ or /mails/sent/ because you probably want to send the live version once you verified that everything looks ok in your test mail.

Scheduled mails

To start a scheduled mail you set the time_to_send argument to the desired sending time. If you skip this argument it will be sent immediately as a regular mail.

Tell a friend

The "tell a friend" link gives you the opportunity to include a link in your mail that recipients can open and tell others about your newsletter through a web form. The web form is connected to a specific list on your account.

If you have a "tell a friend"-link and are sending to multiple lists you can choose which of the lists the link will go to by defining the hash of that list. Remember that the list must be one of the lists you are sending to.

Tracking

Example
[{
    "type": 0,
    "params": {
        "utm_source": "newsletter_campaign",
        "utm_campaign": "123456789"
    }
}]
curl https://api.getanewsletter.com/v3/mails/drafts/<id>/send/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d 
    '{
        "sender_name": "John Doe",
        "sender_email": "john.doe@example.com",
        "time_to_send": "2013-05-07T12:00:00",
        "tell_a_friend": "s5NaP93Oojg",
        "lists": ["hiso7tuNb4Z", "s5NaP93Oojg"],
        "tracking": True,
    }'

Response

Status code: 202 Accepted

The tracking attribute allows you to set a tracking method for your newsletter. Currently the only method supported is via Google Analytics. Accepted values:

The type attribute specifies the tracking method used(0 is for Google Analytics) and the params attribute specifies the attributes and their values used by the method.

The response code will be 202 Accepted if there where no problems.

The required parameters are:

Sent mail

Example sent mail
    {
        "id": 1,
        "url": "https://api.getanewsletter.com/v3/mails/sent/123456/",
        "body": "",
        "plain_text": "",
        "subject": "Mail subject",
        "sender_name": "John Doe",
        "sender_email": "john.doe@example.com",
        "time_to_send": "2017-09-13T08:59:31Z",
        "lists": [
            {
                "hash": "hiso7tuNb4Z",
                "name": "My list"
            }
        ],
        "type": 1,
        "preview_url": "https://api.getanewsletter.com/v3/preview_mail/1/?public_key=12345678910",
        "css": "",
        "mail": 1,
        "test": false,
        "tell_a_friend": "12345678920",
        "tracking": [
            {
                "params": {
                    "utm_campaign": "cmp_123456",
                    "utm_medium": "email",
                    "utm_source": "getanewsletter"
                },
                "type": 0
            }
        ],
        "report_url": "https://api.getanewsletter.com/v3/reports/123456/",
        "report_id": 123456,
        "updated": "2017-09-13T08:59:31Z",
        "share_url": "http://gantrack.com/t/pm/12345678910/"
    }

You can either display a list with links to all your sent mails or display single mails in full. This is all possible through the sent object.

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

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

Readonly fields

GET /mails/sent/

curl https://api.getanewsletter.com/v3/mails/sent/
    -H 'Authorization: Token <your token>'

Response
{
  "count": 30,
  "next": "https://api.getanewsletter.com/v3/mails/sent/?page=2",
  "previous": null,
  "results": [
      {
          "id": 1,
          "url": "https://api.getanewsletter.com/v3/mails/sent/1/",
          "subject": "Mail subject",
          "sender_name": "John Doe",
          "sender_email": "john.doe@example.com",
          "time_to_send": "2017-09-13T08:59:31Z",
          "lists": [
              {
                  "hash": "hiso7tuNb4Z",
                  "name": "My list"
              }
          ],
          "type": 1,
          "preview_url": "https://api.getanewsletter.com/v3/preview_mail/1/?public_key=12345678910",
          "mail": 1,
          "report_url": "https://api.getanewsletter.com/v3/reports/123456/",
          "report_id": 123456,
          "updated": "2017-09-13T08:59:31Z",
          "status": 3,
          "queued": true,
          "share_url": "http://gantrack.com/t/pm/12345678910/"
      }
  ]
}

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

Possible url parameters are:

GET /mails/sent/<id>/

curl https://api.getanewsletter.com/v3/mails/sent/<id>/
    -H 'Authorization: Token <your token>'
    {
        "id": 1,
        "url": "https://api.getanewsletter.com/v3/mails/sent/123456/",
        "body": "",
        "plain_text": "",
        "subject": "Mail subject",
        "sender_name": "John Doe",
        "sender_email": "john.doe@example.com",
        "time_to_send": "2017-09-13T08:59:31Z",
        "lists": [
            {
                "hash": "hiso7tuNb4Z",
                "name": "My list"
            }
        ],
        "type": 1,
        "preview_url": "https://api.getanewsletter.com/v3/preview_mail/1/?public_key=12345678910",
        "css": "",
        "mail": 1,
        "test": false,
        "tell_a_friend": "12345678920",
        "tracking": [
            {
                "params": {
                    "utm_campaign": "cmp_123456",
                    "utm_medium": "email",
                    "utm_source": "getanewsletter"
                },
                "type": 0
            }
        ],
        "report_url": "https://api.getanewsletter.com/v3/reports/123456/",
        "report_id": 123456,
        "updated": "2017-09-13T08:59:31Z",
        "share_url": "http://gantrack.com/t/pm/12345678910/"
    }

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.

DELETE /mails/sent/<id>/

Deletes the mail. (not the queue object)

curl -X DELETE https://api.getanewsletter.com/v3/mails/sent/4/
    -H 'Authorization: Token <your token>'

Response
Status 204 No Content

Scheduled mails

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_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
    }

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

GET /mails/scheduled/

curl https://api.getanewsletter.com/v3/mails/scheduled/
    -H 'Authorization: Token <your token>'

Response
{
    "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_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."
        },
        ...
    ]
}

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

Possible url parameters are:

GET /mails/scheduled/<id>/

curl https://api.getanewsletter.com/v3/mails/scheduled/<id>
    -H 'Authorization: Token <your token>'

Response
{
        "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_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
    }

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.

DELETE /mails/scheduled/<id>/

curl -X DELETE https://api.getanewsletter.com/v3/mails/scheduled/4/
    -H 'Authorization: Token <your token>'

Response
Status 204 No Content

Removes the scheduling and resets the mail to a draft.

Auto-responder mails

Example auto-responder mail
    {
        "id": 3,
        "url": "https://api.getanewsletter.com/v3/mails/responders/3/",
        "subject": "Example auto-responder.",
        "body": "<b>Lorem ipsum dolor sit amet.<b>",
        "blockdocument": null,
        "plain_text": "Lorem ipsum dolor sit amet.",
        "css": "",
        "type": 1,
        "updated": "2014-06-02T12:35:56Z",
        "created": "2014-06-02T12:35:56Z",
        "preview_url": "https://api.getanewsletter.com/v3/mails/all/3/preview/"
    }

The mails attached to auto-responders. You can list, retrieve and edit auto-responder mails.

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

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

Readonly fields

GET /mails/responders/

curl https://api.getanewsletter.com/v3/mails/responders/
    -H 'Authorization: Token <your token>'

Response
{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "url": "https://api.getanewsletter.com/v3/mails/responders/596/",
            "id": 596,
            "subject": "Example auto-responder 2.",
            "type": 1,
            "updated": "2014-06-24T11:14:07Z",
            "created": "2014-06-24T11:03:14Z",
            "preview_url": "https://api.getanewsletter.com/v3/mails/all/596/preview/"
        },
        {
            "url": "https://api.getanewsletter.com/v3/mails/responders/550/",
            "id": 550,
            "subject": "Example auto-responder.",
            "type": 1,
            "updated": "2014-06-02T12:35:56Z",
            "created": "2014-06-02T12:35:56Z",
            "preview_url": "https://api.getanewsletter.com/v3/mails/all/550/preview/"
        }
    ]
}

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

Possible url parameters are:

GET /mails/responders/<id>/

curl https://api.getanewsletter.com/v3/mails/responders/<id>
    -H 'Authorization: Token <your token>'

Response
{
    "id": 3,
    "url": "https://api.getanewsletter.com/v3/mails/responders/3/",
    "subject": "Example auto-responder.",
    "body": "<b>Lorem ipsum dolor sit amet.<b>",
    "blockdocument": null,
    "plain_text": "Lorem ipsum dolor sit amet.",
    "css": "",
    "type": 1,
    "updated": "2014-06-02T12:35:56Z",
    "created": "2014-06-02T12:35:56Z",
    "preview_url": "https://api.getanewsletter.com/v3/mails/all/3/preview/"
}

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.

PUT /mails/responders/<id>

curl -X PUT https://api.getanewsletter.com/v3/mails/responders/597/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d 
    '{
        "subject": "New subject",
        "body": "<p>New content</p>",
        "css": "body {\n    color: black;\n}"
    }'

Response
{
    "id": 597,
    "url": "https://api.getanewsletter.com/v3/mails/responders/597/",
    "subject": "New subject",
    "body": "<p>New content</p>",
    "blockdocument": null,
    "plain_text": "",
    "css": "body {\n    color: black;\n}",
    "type": 0,
    "updated": "2014-06-24T11:38:17.115Z",
    "created": "2014-06-24T11:23:13Z",
    "preview_url": "https://api.getanewsletter.com/v3/mails/all/597/preview/"
}
200 Updated

Update an auto-responder mail. Will return status code 200 on successful execution.

Note: Only the emails of paused auto-responders can be edited.

PATCH /mails/responders/<id>

curl -X PATCH https://api.getanewsletter.com/v3/mails/responders/597/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d 
    '{
        "subject": "Updated subject.",
    }'

Response
{
    "id": 597,
    "url": "https://api.getanewsletter.com/v3/mails/responders/597/",
    "subject": "Updated subject",
    "body": "<p>New content</p>",
    "blockdocument": null,
    "plain_text": "",
    "css": "body {\n    color: black;\n}",
    "type": 0,
    "updated": "2014-06-24T11:38:17.115Z",
    "created": "2014-06-24T11:23:13Z",
    "preview_url": "https://api.getanewsletter.com/v3/mails/all/597/preview/"
}
200 Updated

Makes a partial update. Use it when you don't want to overwrite all values.

Note: Only the emails of paused auto-responders can be edited.

Templates

Templates is the base for your newsletters. You can put recurring elements such as logotypes, contact information etc in your templates to avoid repeating yourself.

HTML templates

The HTML templates gives you full control over your templates. You have the ability to set subject, body, a plain text version and css.

Block templates

Our block templates are now fully customizable through the API. You can automate content creation or create a new draft based on the template.

HTML templates

Example HTML template
    {
        "id": 4,
        "url": "https://api.getanewsletter.com/v3/mails/templates/html/4/",
        "subject": "Get a Newsletter template",
        "plain_text": "This is a HTML template.",
        "css": "",
        "body": "<b>This is a HTML template<b>",
        "updated": "2013-09-06T07:20:31Z",
        "created": "2013-09-06T07:20:31Z",
        "preview_url": "https://api.getanewsletter.com/v3/mails/templates/html/4/preview/"
    }

The HTML templates gives you full control over your templates. You have the ability to set subject, body, a plain text version and css.

GET /mails/templates/html/

curl https://api.getanewsletter.com/v3/mails/templates/html/
    -H 'Authorization: Token <your token>'

Response
{
    "count": 46,
    "next": "https://api.getanewsletter.com/v3/mails/templates/html/?page=3",
    "previous": "https://api.getanewsletter.com/v3/mails/templates/html/?page=2",
    "results": [
        {
            "id": 4,
            "url": "https://api.getanewsletter.com/v3/mails/templates/html/4/",
            "subject": "Get a Newsletter template",
            "updated": "2013-09-06T07:20:31Z",
            "created": "2013-09-06T07:20:31Z",
            "preview_url": "https://api.getanewsletter.com/v3/mails/templates/html/4/preview/"
        },
        {
            "id": 5,
            "url": "https://api.getanewsletter.com/v3/mails/templates/html/5/",
            "subject": "Get a Newsletter template",
            "updated": "2013-09-06T07:20:31Z",
            "created": "2013-09-06T07:20:31Z",
            "preview_url": "https://api.getanewsletter.com/v3/mails/templates/html/5/preview/"
        }
    ]
}

Returns a list of HTML templates, like usual we provide next, prev, count and the results.

Possible url parameters are:

GET /mails/templates/html/<id>/

curl https://api.getanewsletter.com/v3/mails/templates/html/<id>/
    -H 'Authorization: Token <your token>'

Response
{
  "id": 4,
  "url": "https://api.getanewsletter.com/v3/mails/templates/html/4/",
  "subject": "Get a Newsletter template",
  "plain_text": "This is a HTML template.",
  "css": "",
  "body": "<b>This is a HTML template<b>",
  "updated": "2013-09-06T07:20:31Z",
  "created": "2013-09-06T07:20:31Z",
  "preview_url": "https://api.getanewsletter.com/v3/mails/templates/html/4/preview/"
}

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

POST /mails/templates/html/

curl https://api.getanewsletter.com/v3/mails/templates/html/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d
    '{
        "subject": "Mail subject",
        "body": "<b>This is a HTML template<b>",
        "plain_text": "This is a HTML template.",
        "css": "h1 {color: red; }"
    }'

Response
{
    "url": "https://api.getanewsletter.com/v3/mails/templates/html/12/",
    "subject": "Get a Newsletter template",
    "body": "<b>This is a HTML template<b>",
    "plain_text": "This is a HTML template.",
    "css": "h1 {color: red; }",
    "type": 0,
    "updated": "2013-09-06T07:20:31Z",
    "created": "2013-09-06T07:20:31Z",
    "preview_url": "https://admin.getanewsletter.com/t/pt/397213042079/"
}

Creates a new template. Required fields are:

Optional fields are:

PUT /mails/templates/html/<id>/

Updates a template. Required fields are:

Optional fields are:

PATCH /mails/templates/html/<id>/

curl -X PATCH https://api.getanewsletter.com/v3/mails/templates/html/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d
    '{
        "subject": "Mail subject"
    }'
Response
{
  "url": "https://api.getanewsletter.com/v3/mails/templates/html/12/",
  "subject": "Get a Newsletter template",
  "body": "<b>This is a HTML template<b>",
  "plain_text": "This is a HTML template.",
  "css": "h1 {color: red; }",
  "type": 0,
  "updated": "2013-09-06T07:20:31Z",
  "created": "2013-09-06T07:20:31Z",
  "preview_url": "https://admin.getanewsletter.com/t/pt/397213042079/"
}

Patch is used for partial updates. Use it if you want to update a template but don't want to overwrite all values.

DELETE /mails/templates/html/<id>/

Deletes the email.

Block templates

GET /mails/templates/block/

curl https://api.getanewsletter.com/v3/mails/templates/block/
    -H 'Authorization: Token <your token>'

Response
{
  "count": 16,
  "next": "http://api.getanewsletter.com/v3/mails/templates/block/?page=2",
  "previous": null,
  "results": [
      {
          "id": 12,
          "url": "http://gantest.com:8000/v3/mails/templates/block/12/",
          "subject": "No header and no columns",
          "updated": "2012-12-21T07:51:02Z",
          "preview_url": "http://gantest.com:8000/v3/mails/templates/block/12/preview/",
          "layout_slug": "",
          "responsive": false
      }
  ]
}

Returns a list of block templates, like usual we provide next, prev, count and the results.

Possible url parameters are:

GET /mails/templates/block/<id>/

curl https://api.getanewsletter.com/v3/mails/templates/block/<id>
    -H 'Authorization: Token <your token>'

Response
{
    "id": 7678,
    "url": "http://gantest.com:8000/v3/mails/templates/block/7678/",
    "subject": "No header and no columns",
    "blockdocument": {
        "body_background": "eeeeee",
        "content_background": "ffffff",
        "h_font_family": "Arial",
        "h_font_size": 30,
        "h_font_color": "333333",
        "p_font_family": "Arial",
        "p_font_size": 14,
        "p_font_color": "333333",
        "p_link_color": "2a5db0",
        "margin_topbottom": 0,
        "margin_leftright": 0,
        "separator_color": "e6e6e6",
        "separator_height": 4,
        "header_footer_font_family": "Arial",
        "header_footer_font_size": 11,
        "header_footer_font_color": "555555",
        "areas": {
            "1": {
                "width": 580
            },
            "2": {
                "width": 580
            }
        },
        "blockdata_set": [
            {
                "area": 1,
                "sort_order": 1,
                "block": {
                    "id": 48,
                    "url": null,
                    "category": 0,
                    "type": 0,
                    "belongs_to": 0,
                    "slug": "responsive-text",
                    "name": "Responsive-Text",
                    "thumb_url": "http://gantest.com:8000/ganeditor/media//static/api_docs/images/blocks/1-txt.gif",
                    "components": [
                        {
                            "type": "text",
                            "name": "txt1"
                        }
                    ],
                    "layout": {
                        "id": 46,
                        "content": "<div  style=\"padding:0 15px\">###txt1###</div>"
                    },
                    "editable": true
                },
                "data": {
                    "txt1-text": "<p align=\"center\">Nyhetsbrev med senaste nytt. Problem att visa det?&nbsp;<a href=\"##view_online##\">Se det i webbl&auml;saren</a>.</p>"
                }
            },
            {
                "area": 2,
                "sort_order": 1,
                "block": {
                    "id": 48,
                    "url": null,
                    "category": 0,
                    "type": 0,
                    "belongs_to": 0,
                    "slug": "responsive-text",
                    "name": "Responsive-Text",
                    "thumb_url": "http://gantest.com:8000/ganeditor/media//static/api_docs/images/blocks/1-txt.gif",
                    "components": [
                        {
                            "type": "text",
                            "name": "txt1"
                        }
                    ],
                    "layout": {
                        "id": 46,
                        "content": "<div  style=\"padding:0 15px\">###txt1###</div>"
                    },
                    "editable": true
                },
                "data": {
                    "txt1-text": "<p align=\"center\">Du f&aring;r detta nyhetsbrev eftersom du &auml;r en kund till oss eller f&ouml;r att du har skrivit upp dig p&aring; v&aring;rt nyhetsbrev.<br /><a href=\"##unsubscribe##\">Skulle du vilja avsluta din prenumeration, klicka h&auml;r</a>.</p>"
                }
            }
        ],
        "layout": {
            "id": 90,
            "content": "<table id=\"document\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"600\">\n    <tr>\n        <td align=\"center\">\n            <div id=\"document_header\">\n                <table width=\"560\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n                    <tbody>\n                        <tr>\n                            <td>\n                                <table style=\"border-spacing:0;\" id=\"area_1\" class=\"area\" width='100%'>\n                                    <tbody>###area1###</tbody>\n                                </table>\n                            </td>\n                        </tr>\n                    </tbody>\n                </table>\n            </div>\n            <table id=\"margins\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"####content_background###\" style=\"border: ###borderWidth### ###borderStyle### ###borderColor###;\">\n                <tr>\n                    <td align=\"center\" id=\"margins_td\">\n                        <table id=\"main_content\" width=\"580\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"resp-measure\">\n                            <tbody>\n\n                                <!-- main-content, one column\n                                ================================================== -->\n                                <tr>\n                                    <td width=\"15\"><img src=\"data:image/gif;base64,R0lGODlhAQABAID/ AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==\" width=\"15\" height=\"1\" /></td>\n                                    <td width=\"550\" class=\"column\"> <!-- one column -->\n                                        <table width=\"100%\" style=\"border-spacing: 0;\" id=\"area_4\" class=\"area content_background\">\n                                            <tbody>###area4###</tbody>\n                                        </table>\n                                    </td>\n                                    <td width=\"15\"><img src=\"data:image/gif;base64,R0lGODlhAQABAID/ AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==\" width=\"15\" height=\"1\" /></td>\n                                </tr>\n\n                                <!-- Footer\n                                ================================================== -->\n                                <tr>\n                                    <td width=\"15\"><img src=\"data:image/gif;base64,R0lGODlhAQABAID/ AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==\" width=\"15\" height=\"1\" /></td>\n                                    <td width=\"550\" class=\"column\"> <!-- one column -->\n                                        <table width=\"100%\" style=\"border-spacing: 0;\" id=\"area_5\" class=\"area footer_background\">\n                                            <tbody>###area5###</tbody>\n                                        </table>\n                                    </td>\n                                    <td width=\"15\"><img src=\"data:image/gif;base64,R0lGODlhAQABAID/ AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==\" width=\"15\" height=\"1\" /></td>\n                                </tr> <!-- /main-content -->\n                            </tbody>\n                        </table>\n                    </td>\n                </tr>\n            </table>\n            <div id=\"document_footer\">\n                <table width=\"560\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n                    <tbody id=\"sortable-tbody\">\n                        <tr>\n                            <td>\n                                <table style=\"border-spacing:0;\" id=\"area_2\" class=\"area\" width=\"100%\">\n                                    <tbody>###area2###</tbody>\n                                </table>\n                            </td>\n                        </tr>\n                    </tbody>\n                </table>\n            </div>\n        </td>\n    </tr>\n</table><!-- End document -->"
        }
    },
    "updated": "2013-06-04T09:26:23Z",
    "preview_url": "http://gantest.com:8000/v3/mails/templates/block/7678/preview/",
    "layout_slug": ""
}

The details view includes the information about the block document, its properties, areas and block data.

PUT /mails/templates/block/<id>/

Updates a template. Required fields are:

PATCH /mails/templates/block/<id>/

curl -X PATCH https://api.getanewsletter.com/v3/mails/templates/block/12/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d 
    '{
        "subject": "Mail subject"
    }'

Response
{
    "url": "https://api.getanewsletter.com/v3/mails/templates/block/12/",
    "subject": "Mail subject",
    ...
}

Patch is used for partial updates. Use it if you want to update a template but don't want to overwrite all values.

DELETE /mails/templates/block/<id>/

curl -X DELETE https://api.getanewsletter.com/v3/mails/templates/block/<id>/
    -H 'Authorization: Token <your token>'

Deletes the email.

Actions

Copy template

POST /mails/templates/block/<id>/copy/

curl  https://api.getanewsletter.com/v3/mails/templates/block/12/copy/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d 
    '{}'

Response
{
    "id": 5,
    "url": "http://api.getanewsletter.com/v3/mails/templates/block/13/",
    "subject": "Copy of Header and right column",
    "blockdocument": {
        ...
    },
    "updated": "2014-06-20T12:13:52.286Z",
    "preview_url": "http://api.getanewsletter.com/v3/mails/templates/block/5/preview/",
    "layout_slug": ""
}

Create draft email

POST /mails/templates/block/<id>/draft/

curl https://api.getanewsletter.com/v3/mails/templates/block/<id>/draft/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d 
    '{}'

Response
{
    "id": 192,
    "url": "http://api.getanewsletter.com/v3/mails/drafts/192/",
    "subject": "No header and no columns",
    "body": null,
    "blockdocument": {
        ...
    },
    "plain_text": null,
    "css": null,
    "type": 1,
    "updated": "2014-06-20T12:24:26.060Z",
    "created": "2014-06-20T12:24:26.060Z",
    "preview_url": "http://api.getanewsletter.com/v3/mails/drafts/192/preview/",
    "send_url": "http://api.getanewsletter.com/v3/mails/drafts/192/send/"
}

Preview template

GET /mails/templates/block/<id>/preview/

curl https://api.getanewsletter.com/v3/mails/templates/block/<id>/preview/
    -H 'Authorization: Token <your token>'

Returns rendered version of the template.

Auto Responders

Example auto-responder

{
    "url": "http://gantest.com:8000/v3/responders/18/",
    "id": 18,
    "mail": {
        "url": "http://gantest.com:8000/v3/mails/responders/597/",
        "id": 597,
        "subject": "Updated subject",
        "type": 0
    },
    "on_hold": "2014-06-24T11:26:15Z",
    "time_to_send": {
        "hours": 6,
        "days": 1
    },
    "list": {
        "url": "http://gantest.com:8000/v3/lists/K9rM2ghf6GrNPBIug5nG/",
        "hash": "K9rM2ghf6GrNPBIug5nG",
        "name": "List_34161"
    },
    "sender_name": "John Doe34161",
    "sender_email": "john.doe34161@example.com",
    "report": 18
}

Auto-responders are agents that send emails to new subscribers at a predefined time after they subscribe.

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

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

Required fields

Readonly fields

GET /responders/

curl https://api.getanewsletter.com/v3/mails/responders/
    -H 'Authorization: Token <your token>'

Response
{
    "count": 3,
    "next": null,
    "previous": null,
    "results": [
        {
            "url": "http://gantest.com:8000/v3/responders/18/",
            "id": 18,
            "mail": {
                "url": "http://gantest.com:8000/v3/mails/responders/597/",
                "id": 597,
                "subject": "Updated subject",
                "type": 0
            },
            "on_hold": "2014-06-24T11:26:15Z",
            "time_to_send": {
                "hours": 6,
                "days": 1
            },
            "list": {
                "url": "http://gantest.com:8000/v3/lists/K9rM2ghf6GrNPBIug5nG/",
                "hash": "K9rM2ghf6GrNPBIug5nG",
                "name": "List_34161"
            },
            "sender_name": "John Doe34161",
            "sender_email": "john.doe34161@example.com",
            "report": 18
        },
        ...
    ]
}

Returns a list of attributes, like usual we provide next, prev, count and the results

Possible url parameters are:

POST /responders/

curl https://api.getanewsletter.com/v3/responders/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d 
    '{
        "draft": "587",
        "list": "K9rM2ghf6GrNPBIug5nG",
        "sender": "K9rM2ghf6GrNPBIug5nG",
        "time_to_send": {
            "hours": "4",
            "days": "1"
        }
    }'

Response
{
    "url": "http://gantest.com:8000/v3/responders/20/",
    "id": 20,
    "mail": {
        "url": "http://gantest.com:8000/v3/mails/responders/587/",
        "id": 587,
        "subject": "No header and no columns",
        "type": 1
    },
    "on_hold": null,
    "time_to_send": {
        "hours": 4,
        "days": 1
    },
    "list": {
        "url": "http://gantest.com:8000/v3/lists/K9rM2ghf6GrNPBIug5nG/",
        "hash": "K9rM2ghf6GrNPBIug5nG",
        "name": "List_34161"
    },
    "sender_name": "John Doe34161",
    "sender_email": "john.doe34161@example.com",
    "report": 20
}

Starts new auto-responder.

Required parameters are:

GET /responders/<id>/

curl https://api.getanewsletter.com/v3/responders/18/
    -H 'Authorization: Token <your token>'

Response
{
    "url": "http://gantest.com:8000/v3/responders/18/",
    "id": 18,
    "mail": {
        "url": "http://gantest.com:8000/v3/mails/responders/597/",
        "id": 597,
        "subject": "Updated subject",
        "type": 0
    },
    "on_hold": "2014-06-24T11:26:15Z",
    "time_to_send": {
        "hours": 6,
        "days": 1
    },
    "list": {
        "url": "http://gantest.com:8000/v3/lists/K9rM2ghf6GrNPBIug5nG/",
        "hash": "K9rM2ghf6GrNPBIug5nG",
        "name": "List_34161"
    },
    "sender_name": "John Doe34161",
    "sender_email": "john.doe34161@example.com",
    "report": 18
}

Returns single report.

PUT /responders/<id>/

curl -X PUT https://api.getanewsletter.com/v3/responders/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d 
    '{
        "time_to_send": {
        "hours": 6,
        "days": 2
    }'

Response
{
    "url": "http://gantest.com:8000/v3/responders/18/",
    "id": 18,
    "mail": {
        "url": "http://gantest.com:8000/v3/mails/responders/597/",
        "id": 597,
        "subject": "Updated subject",
        "type": 0
    },
    "on_hold": "2014-06-24T11:26:15Z",
    "time_to_send": {
        "hours": 6,
        "days": 2
    },
    "list": {
        "url": "http://gantest.com:8000/v3/lists/K9rM2ghf6GrNPBIug5nG/",
        "hash": "K9rM2ghf6GrNPBIug5nG",
        "name": "List_34161"
    },
    "sender_name": "John Doe34161",
    "sender_email": "john.doe34161@example.com",
    "report": 18
}

Used to reschedule an auto-responder.

Note: You can reschedule only paused auto-responders.

PATCH /responders/<id>/

Used for partial updates. Since auto-responders only has one updatable field it has the same effect as PUT.

DELETE /responders/<id>/

curl -X DELETE https://api.getanewsletter.com/v3/responders/<id>
    -H 'Authorization: Token <your token>'

Response
HTTP 204 NO CONTENT

Deletes the auto-responder.

POST /responders/<id>/delete_related/

curl https://api.getanewsletter.com/v3/responders/<id>/delete_related/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json"
    -d '{}'

Response
HTTP 204 NO CONTENT

Deletes the auto-responder and all associated reports.

POST /responders/<id>/pause/

curl https://api.getanewsletter.com/v3/responders/<id>/pause/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json"
    -d '{}'

Response
HTTP 204 NO CONTENT

Pauses the auto-responder. While paused the auto-responder would not send any mails.

POST /responders/<id>/resume/

curl https://api.getanewsletter.com/v3/responders/<id>/resume/
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json"
    -d '{}'

Response
HTTP 204 NO CONTENT

Resumes paused auto-responder.

Profile

Shows the profile of the logged user.

GET /profile/

curl https://api.getanewsletter.com/v3/profile/
    -H 'Authorization: Token <your token>'

Response
 {
    "account_type": 1,
    "subscribed_to_newsletter": false,
    "subscribed_to_status_mail": true,
    "language": "en",
    "different_billing_address": false,
    "balance": 0,
    "subscription": {
        "number_of_emails": 10000,
        "end_time": "2015-03-05",
        "is_free": false,
        "number_of_months": 12,
        "cancelled": null,
        "period_day": 5
    },
    "invoice_delivery": 0,
    "currency_code": "SEK",
    "unseen_messages": 0,
    "unpaid_invoice": true
}

Responds with the profile data for the authenticated user

Address

Shows the address of the logged user.

GET /profile/address/

curl https://api.getanewsletter.com/v3/profile/address/
    -H 'Authorization: Token <your token>'

Response
{
    "country": "DK",
    "company": "",
    "org_number": "",
    "reference": "Reference",
    "address_1": "Address 1",
    "address_2": "Address 2",
    "zip_code": "1000",
    "city": "City",
    "phone": "000 00 00",
    "email": "user@example.com",
    "extra_email": "",
    "vat_id": ""
}

Responds with the address data for the authenticated user

Billing address

curl https://api.getanewsletter.com/v3/profile/billing_address/
    -H 'Authorization: Token <your token>'

Response
{
    "country": "DK",
    "company": "",
    "org_number": "",
    "reference": "Reference",
    "address_1": "Address 1",
    "address_2": "Address 2",
    "zip_code": "1000",
    "city": "City",
    "phone": "000 00 00",
    "email": "user@example.com",
    "extra_email": "",
    "vat_id": ""
}

It has the same structure as address and is used when the different_billing_address in the profile is set to true

Reports

Example report

{
    "id": 4
    "url": "https://api.getanewsletter.com/v3/reports/4/",
    "sent_to": 300,
    "sent_to_lists": [
        "My list"
    ],
    "sent": "2014-08-29T13:59:49Z",
    "sendtime": "-",
    "delivered": 295,
    "total_html_opened": 285
    "unique_html_opened": 285,
    "html_clicks": 175,
    "unsubscribed": 2,
    "bounced": 5,
    "type": 0,
    "finished": "2013-08-24T13:20:40.299Z",
    "preview_url": "http://admin.getanewsletter.com/t/pm/83748573/",
    "bounces_url": "https://api.getanewsletter.com/v3/reports/4/bounces/",
    "unsubscribed_url": "https://api.getanewsletter.com/v3/reports/4/unsubscribed/",
    "links_url": "https://api.getanewsletter.com/v3/reports/4/links/",
    "opens_url": "https://api.getanewsletter.com/v3/reports/4/openuniques/",
    "mail_id": 330517,
    "mail_url": "https://api.getanewsletter.com/v3/mails/sent/330517/",
    "mail_subject": "My Newsletter",
    "sender_name": "John Doe",
    "sender_email": "john.doe@example.com",
    "unique_html_clicks": 98,
    "receivers_who_clicked": 0,
    "receivers_who_clicked_24h": 0,
    "bounced_permanent": 0,
    "bounced_temporary": 0,
    "get_view_online_link": "http://admin.getanewsletter.com/t/pm/83748573/"
}

The reports object give you the ability to track your newsletters. You can – for example – see how many subscribers opened your newsletter and which links they clicked.

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

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

Readonly fields

GET /reports/

curl https://api.getanewsletter.com/v3/reports/
    -H 'Authorization: Token <your token>'

Response
{
    "count": 46,
    "next": "https://api.getanewsletter.com/v3/reports/?page=3",
    "previous": "https://api.getanewsletter.com/v3/reports/?page=2",
    "results": [
        {
            "id": 6,
            "url": "https://api.getanewsletter.com/v3/reports/6/",
            "mail_id": 185,
            "mail_subject": "Mail subject 185",
            "sent": "2014-06-18T09:01:45Z",
            "sendtime": "-",
            "sent_to_lists": [
                "My list"
            ],
            "sent_to": 300,
            "total_html_opened": 120
        },
        ...
    ]
}

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

Possible url parameters are:

GET /reports/<id>/

curl https://api.getanewsletter.com/v3/reports/6/
    -H 'Authorization: Token <your token>'

Response
{
    "id": 4
    "url": "https://api.getanewsletter.com/v3/reports/4/",
    "sent_to": 300,
    "sent_to_lists": [
        "My list"
    ],
    "sent": "2014-08-29T13:59:49Z",
    "sendtime": "-",
    "delivered": 295,
    "total_html_opened": 285
    "unique_html_opened": 285,
    "html_clicks": 175,
    "unsubscribed": 2,
    "bounced": 5,
    "type": 0,
    "finished": "2013-08-24T13:20:40.299Z",
    "preview_url": "http://admin.getanewsletter.com/t/pm/83748573/",
    "bounces_url": "https://api.getanewsletter.com/v3/reports/4/bounces/",
    "unsubscribed_url": "https://api.getanewsletter.com/v3/reports/4/unsubscribed/",
    "links_url": "https://api.getanewsletter.com/v3/reports/4/links/",
    "opens_url": "https://api.getanewsletter.com/v3/reports/4/openuniques/",
    "mail_id": 330517,
    "mail_url": "https://api.getanewsletter.com/v3/mails/sent/330517/",
    "mail_subject": "My Newsletter",
    "sender_name": "John Doe",
    "sender_email": "john.doe@example.com",
    "unique_html_clicks": 98,
    "receivers_who_clicked": 0,
    "receivers_who_clicked_24h": 0,
    "bounced_permanent": 0,
    "bounced_temporary": 0,
    "get_view_online_link": "http://admin.getanewsletter.com/t/pm/83748573/"
}

Responds with a report.

Bounces

Example bounce

{
    "url": "https://api.getanewsletter.com/v3/reports/123/bounces/543/",
    "status": "4.2.2",
    "contact": "john.doe@example.com",
    "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
    "contact_active": true,
    "description": "Mailbox full",
    "created": "2013-08-27T13:33:11.462Z"
    "error_type": "Soft bounce."
}

The bounces object gives you the ability to GET information about bounces for specific reports.

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

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

Readonly fields

GET /reports/<report_id>/bounces/

curl https://api.getanewsletter.com/v3/reports/123/bounces/
    -H 'Authorization: Token <your token>'

Response
{
    "count": 46,
    "next": "https://api.getanewsletter.com/v3/reports/123/bounces/?page=3",
    "previous": "https://api.getanewsletter.com/v3/reports/123/bounces/?page=2",
    "results": [
        {
            "url": "https://api.getanewsletter.com/v3/reports/123/bounces/543/",
            "status": "4.2.2",
            "contact": "john.doe@example.com",
            "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
            "contact_active": true,
            "description": "Mailbox full",
            "created": "2013-08-27T13:33:11.462Z",
            "error_type": "Soft bounce."
        },
        ...
    ]
}

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

Possible url parameters are:

GET /reports/<report_id>/bounces/<id>/

curl https://api.getanewsletter.com/v3/reports/123/bounces/543/
    -H 'Authorization: Token <your token>'

Response
{
    "url": "https://api.getanewsletter.com/v3/reports/123/bounces/543/",
    "status": "4.2.2",
    "contact": "john.doe@example.com",
    "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
    "contact_active": true,
    "description": "Mailbox full",
    "created": "2013-08-27T13:33:11.462Z",
    "error_type": "Soft bounce."
}

Responds with a report.

Exporting bounces

GET /reports/<report_id>/bounces/export/

curl https://api.getanewsletter.com/v3/reports/<report_id>/bounces/export/
    -H 'Authorization: Token <your token>'

Possible url parameters are:

If the csv parameter is not provided the API automatically returns xls-file for all exports under 64 000 rows, and with csv-file for bigger. The export includes the bounced email and the type of the bounce.

Clicks

Example click

    {
        "url": "https://api.getanewsletter.com/v3/reports/123/links/23/clicks/5/",
        "contact": "john.doe@example.com",
        "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
        "first_click": "2013-08-24T14:58:06.870Z",
        "last_click": "2013-08-27T14:58:06.870Z",
        "total_clicks": 9
    }

The clicks object gives you information about how many times each contact has clicked on a specific link.

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

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

Readonly fields

curl https://api.getanewsletter.com/v3/reports/<report_id>/links/<link_id>/clicks/
    -H 'Authorization: Token <your token>'

Response
{
    "count": 46,
    "next": "https://api.getanewsletter.com/v3/reports/123/links/23/clicks/?page=3",
    "previous": "https://api.getanewsletter.com/v3/reports/123/links/23/clicks/?page=2",
    "results": [
        {
            "url": "https://api.getanewsletter.com/v3/reports/123/links/23/clicks/5/",
            "contact": "john.doe@example.com",
            "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
            "first_click": "2013-08-24T14:58:06.870Z",
            "last_click": "2013-08-27T14:58:06.870Z",
            "total_clicks": 9
        },
        ...
    ]
}

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

Possible url parameters are:

curl https://api.getanewsletter.com/v3/reports/123/links/23/clicks/5/
    -H 'Authorization: Token <your token>'

Response
{
    "url": "https://api.getanewsletter.com/v3/reports/123/links/23/clicks/5/",
    "contact": "john.doe@example.com",
    "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
    "first_click": "2013-08-24T14:58:06.870Z",
    "last_click": "2013-08-27T14:58:06.870Z",
    "total_clicks": 9
}

Responds with a report.

Example link

{
    "id": 23,
    "url": "https://api.getanewsletter.com/v3/reports/123/links/23/",
    "link": "https://www.example.com/example/url/",
    "unique_clicks": 54,
    "clicks_url": "https://api.getanewsletter.com/v3/reports/123/links/23/clicks/",
    "total_clicks": 1,
    "percent_of_total": 100.0
}

The links object gives you information about how many unique clicks each link have.

curl https://api.getanewsletter.com/v3/reports/<report_id>/links/
    -H 'Authorization: Token <your token>'

Response
{
    "count": 46,
    "next": "https://api.getanewsletter.com/v3/reports/123/links/?page=3",
    "previous": "https://api.getanewsletter.com/v3/reports/123/links/?page=2",
    "results": [
        {
            "id": 23,
            "url": "https://api.getanewsletter.com/v3/reports/123/links/23/",
            "link": "https://www.example.com/example/url/",
            "unique_clicks": 54,
            "clicks_url": "https://api.getanewsletter.com/v3/reports/123/links/23/clicks/",
            "total_clicks": 1,
            "percent_of_total": 100.0
        },
        ...
    ]
}

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

Possible url parameters are:

curl https://api.getanewsletter.com/v3/reports/123/links/23/
    -H 'Authorization: Token <your token>'

Response
{
    "id": 23,
    "url": "https://api.getanewsletter.com/v3/reports/123/links/23/",
    "link": "https://www.example.com/example/url/",
    "unique_clicks": 54,
    "clicks_url": "https://api.getanewsletter.com/v3/reports/123/links/23/clicks/",
    "total_clicks": 1,
    "percent_of_total": 100.0
}

Responds with a report.

curl https://api.getanewsletter.com/v3/reports/<report_id>/links/export/
    -H 'Authorization: Token <your token>'

Possible url parameters are:

If the csv parameter is not provided the API automatically returns xls-file for all exports under 64 000 rows, and with csv-file for bigger. The export includes the links URL, the number of unique click and the percent of total clicks.

Opens

Example unique open 
{
    "url": "https://api.getanewsletter.com/v3/reports/123/opens/543/",
    "contact": "john.doe@example.com",
    "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
    "first_view": "2013-08-24T14:20:54.799Z",
    "last_view": "2013-08-27T14:20:54.799Z",
    "count": 234,
}

The opens object gives you information about how many times a specific user has opened your mail.

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

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

Readonly fields

GET /reports/<report_id>/opens/

curl https://api.getanewsletter.com/v3/reports/123/opens/
    -H 'Authorization: Token <your token>'

Response
{
    "count": 46,
    "next": "https://api.getanewsletter.com/v3/reports/opens/?page=3",
    "previous": "https://api.getanewsletter.com/v3/reports/opens/?page=2",
    "results": [
        {
            "url": "https://api.getanewsletter.com/v3/reports/123/opens/543/",
            "contact": "john.doe@example.com",
            "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
            "first_view": "2013-08-24T14:20:54.799Z",
            "last_view": "2013-08-27T14:20:54.799Z",
            "count": 234,
        },
        ...
    ]
}

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

Possible url parameters are:

GET /reports/<report_id>/opens/<id>/

curl https://api.getanewsletter.com/v3/reports/123/opens/543/
    -H 'Authorization: Token <your token>'

Response
{
    "url": "https://api.getanewsletter.com/v3/reports/123/opens/543/",
    "contact": "john.doe@example.com",
    "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
    "first_view": "2013-08-24T14:20:54.799Z",
    "last_view": "2013-08-27T14:20:54.799Z",
    "count": 234,
}

Responds with a report.

Exporting opens

GET /reports/<report_id>/opens/export/

curl https://api.getanewsletter.com/v3/reports/<report_id>/opens/export/
    -H 'Authorization: Token <your token>'

Possible url parameters are:

If the csv parameter is not provided the API automatically returns xls-file for all exports under 64 000 rows, and with csv-file for bigger. The export includes the subscriber email, the number of time the subscriber has opened the email and the date and time for the first and last opening.

Opens Aggregated

Example aggregated opens

{
    "unique": [
        {
            "count": 80,
            "start": "2014-07-29T11:32:52Z",
            "end": "2014-08-01T18:59:00.405Z"
        },
        ...
    ],
    "total": [
        {
            "count": 150,
            "start": "2014-07-29T11:32:52Z",
            "end": "2014-08-01T18:59:00.405Z"
        },
        ...
    ],
    "clicks": [
        {
            "count": 179,
            "start": "2014-07-29T11:32:52Z",
            "end": "2014-08-01T18:59:00.405Z"
        },
        ...
    ]
}

The opens object gives you information about how many times a specific user has opened your mail.

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

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

GET /reports/<report_id>/opens/aggregated/

curl https://api.getanewsletter.com/v3/reports/123/opens/aggregated/
    -H 'Authorization: Token <your token>'

Response
{
    "unique": [
        {
            "count": 80,
            "start": "2014-07-29T11:32:52Z",
            "end": "2014-08-01T18:59:00.405Z"
        },
        ...
    ],
    "total": [
        {
            "count": 150,
            "start": "2014-07-29T11:32:52Z",
            "end": "2014-08-01T18:59:00.405Z"
        },
        ...
    ],
    "clicks": [
        {
            "count": 179,
            "start": "2014-07-29T11:32:52Z",
            "end": "2014-08-01T18:59:00.405Z"
        },
        ...
    ]
}

Responds with an object with 3 properties:

Each one of them is a list of 20 objects - the whole interval split into 20 equal time interval, with 3 properties:

Possible url parameters are:

Have not opened

Example not opened

    {
        "contact": "john.doe@example.com",
        "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
    }

The have_not_opened object gives you information about how which users has not opened your mail.

GET reports/123/have_not_opened/

curl https://api.getanewsletter.com/v3/reports/<report_id>/have_not_opened/
    -H 'Authorization: Token <your token>'

Response
{
    "count": 46,
    "next": "https://api.getanewsletter.com/v3/reports/have_not_opened/?page=3",
    "previous": "https://api.getanewsletter.com/v3/reports/have_not_opened/?page=2",
    "results": [
        {
            "contact": "john.doe@example.com",
            "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
        },
        ...
    ]
}

Responds with a list of contacts who hasn't opened like usual we provide next, prev, count and the results

Possible url parameters are:

GET /reports/<report_id>/have_not_opened/<id>/

curl https://api.getanewsletter.com/v3/reports/123/have_not_opened/543/
    -H 'Authorization: Token <your token>'

Response
{
    "contact": "john.doe@example.com",
    "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
}

Responds with a report.

Most active INCORRECT!!!

Example not opened

{
    "contact": "john.doe@example.com",
    "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
}

The have_not_opened object gives you information about how which users has not opened your mail.

GET reports/123/have_not_opened/

curl https://api.getanewsletter.com/v3/reports/<report_id>/have_not_opened/
    -H 'Authorization: Token <your token>'

Response
{
    "count": 46,
    "next": "https://api.getanewsletter.com/v3/reports/have_not_opened/?page=3",
    "previous": "https://api.getanewsletter.com/v3/reports/have_not_opened/?page=2",
    "results": [
        {
            "contact": "john.doe@example.com",
            "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
        },
        ...
    ]
}

Responds with a list of contacts who hasn't opened like usual we provide next, prev, count and the results

Possible url parameters are:

GET /reports/<report_id>/have_not_opened/<id>/

curl https://api.getanewsletter.com/v3/reports/<report_id>/have_not_opened/
    -H 'Authorization: Token <your token>'

Response
{
    "contact": "john.doe@example.com",
    "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
}

Responds with a report.

Unsubscriptions

Example unsubscription

{
    "url": "https://api.getanewsletter.com/v3/reports/123/unsubscribed/43/",
    "contact": "john.doe@example.com",
    "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
    "created": "2013-08-27T14:28:08.744Z"
}

The unsubscription object gives you information about which contacts has unsubscribed from a certain list.

GET /reports/<report_id>/unsubscribed/

curl https://api.getanewsletter.com/v3/reports/123/unsubscribed/
    -H 'Authorization: Token <your token>'

Response
{
    "count": 46,
    "next": "https://api.getanewsletter.com/v3/reports/unsubscribed/?page=3",
    "previous": "https://api.getanewsletter.com/v3/reports/unsubscribed/?page=2",
    "results": [
        {
            "url": "https://api.getanewsletter.com/v3/reports/123/unsubscribed/43/",
            "contact": "john.doe@example.com",
            "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
            "created": "2013-08-27T14:28:08.744Z"
        },
        ...
    ]
}

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

Possible url parameters are:

GET /reports/<report_id>/unsubscribed/<id>/

curl https://api.getanewsletter.com/v3/reports/123/unsubscribed/43/
    -H 'Authorization: Token <your token>'

Response
{
    "url": "https://api.getanewsletter.com/v3/reports/123/unsubscribed/43/",
    "contact": "john.doe@example.com",
    "contact_url": "https://api.getanewsletter.com/v3/contacts/john.doe@example.com/",
    "created": "2013-08-27T14:28:08.744Z"
}

Responds with an unsubscription.

Exporting unsubscribed

GET /reports/<report_id>/unsubscribed/export/

curl https://api.getanewsletter.com/v3/reports/<report_id>/unsubscribed/export/
    -H 'Authorization: Token <your token>'

Possible url parameters are:

If the csv parameter is not provided the API automatically returns xls-file for all exports under 64 000 rows, and with csv-file for bigger. The export includes the email of the unsubscribed contact and the time when they unsubscribed.

Invoices

The list object is a collection of invoices.

GET /invoices/

curl https://api.getanewsletter.com/v3/invoices/
    -H 'Authorization: Token <your token>'

Response
{
    "count": 10,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 29,
            "url": "http://api.getanewsletter.com/v3/invoices/29/",
            "invoice_number": 1,
            "due_date": "2014-06-20T10:57:29Z",
            "total_amount": "1185.00",
            "download_url": "http://api.getanewsletter.com/v3/invoices/29/download/",
            "payment": "Not Paid",
            "note": null,
            "balance": "1185.00",
            "currency": "SEK"
        },
        ...
    ]
}

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

Possible url parameters are:

GET /invoices/<id>/

curl https://api.getanewsletter.com/v3/invoices/29/
    -H 'Authorization: Token <your token>'

Response
{
    "id": 29,
    "url": "http://api.getanewsletter.com/v3/invoices/29/",
    "invoice_number": 1,
    "due_date": "2014-06-20T10:57:29Z",
    "total_amount": "1185.00",
    "download_url": "http://api.getanewsletter.com/v3/invoices/29/download/",
    "payment": "Not Paid",
    "note": null,
    "balance": "1185.00",
    "currency": "SEK"
}

Responds with an invoice.

Notifications

Example notification

{
    "url": "https://api.getanewsletter.com/v3/notifications/1/",
    "subject": "Vi har fyllt på ditt konto",
    "message": "<p>Lorem ipsum dolar sit amet...</p>",
    "dispatch_date": "2013-12-12T09:59:45Z",
    "seen": false,
    "importance_level": 3,
    "has_stickies": true
}

List of notifications for the logged user.

GET /notifications/

curl https://api.getanewsletter.com/v3/notifications/
    -H 'Authorization: Token <your token>'

Response
{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "url": "https://api.getanewsletter.com/v3/notifications/1/",
            "subject": "Vi har fyllt på ditt konto",
            "message": "<p>Vi har fyllt på ditt konto...</p>",
            "dispatch_date": "2013-12-12T09:59:45Z",
            "seen": false,
            "importance_level": 3,
            "has_stickies": true
        }
    ]
}

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

Possible url parameters are:

POST /notifications/<id>

curl https://api.getanewsletter.com/v3/notifications/<id>
    -H 'Authorization: Token <your token>'
    -H "Content-Type: application/json" 
    -d 
    '{
        "seen": true
    }'

Response
{
    "url": "https://api.getanewsletter.com/v3/notifications/1/",
    "subject": "Vi har fyllt på ditt konto",
    "message": "<p>Vi har fyllt på ditt konto...</p>",
    "dispatch_date": "2013-12-12T09:59:45Z",
    "seen": true,
    "importance_level": 3,
    "has_stickies": true
},
200 Updated

Mark a notification message as seen or unseen

Errors

The Get a newsletter API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The kitten requested is hidden for administrators only.
404 Not Found -- The specified resource could not be found.
405 Method Not Allowed -- You tried to access a resource with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The resource requested has been removed from our servers.
418 I'm a teapot.
429 Too Many Requests -- You're requesting too many resources! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.