Creating a list from javascript


Creating a list from javascript

I am trying to create a list as described here:, where it says you can create a list by posting to /lists. It does not give a lot of detail but it does say you need to post, not get.


So I am posting to


with the name of the list posted as Name. However, I get back this error: 


HTTP Status 403 - Not Allowed to access {emsegal}

type Status report

message Not Allowed to access {emsegal}

description Access to the specified resource (Not Allowed to access {emsegal}) has been forbidden.


Maybe I am doing this whole thing the wrong way. But I would like to do this using javasript, and I would like to avoid putting together an XMLDOM and posting it. Can anyone help me just create a list with javascript?


PS I am not trying to add names right now, just create a list.


When I tried taking my name out of the curly brackets in the url, I posted to this address:

and got this error


Error 415: Content type: 'application/x-www-form-urlencoded' is not accepted by this collection. Accepted type(s) are: 'application/atom+xml;type=entry'.

Our API request you to send a full body XML document to create a list, found here:


There are numberous problems using an Authenticated REST API through JavaScript, most of which are assoicated with Cross Site Scripting issues.  It may be possible to get a successful list creation through JavaScript, but it will be impossible to pull information back from a 3rd party domain due to XSS security protections in browsers.  We recommend using a server side language to make sure that you are able to fully use the API without any security issues.


Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

View API documentation, code samples, get your API key.

Visit Page