The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Error 400: The request contains errors in the common Atom sections

New Member

Error 400: The request contains errors in the common Atom sections


I am trying to link my website to constant contact, but the problem is that I have an error.

(Error 400: The request contains errors in the common Atom sections, which lie outside or , such as , , or.)

I found on internet that it was about my XML file. So is it correct or is it an other problem ?

$date = date("Y-m-d\TH:i:s");

$theXml = <<<THE__XML

<entry xmlns="">

<title type="text"></title>




<summary type="text">Contact</summary>

<content type="application/vnd.ctct+xml">

<Contact xmlns="">





<ContactList id="" />






    $ch = curl_init();

    $UN = "XXXXXXX";

    $PW = "XXXXXXX";

    $Key = "XXXXXXX";

    $userNamePassword = $Key . '%' . $UN . ':' . $PW;


    curl_setopt($ch, CURLOPT_USERPWD, $userNamePassword);

    //curl_setopt($ch, CURLOPT_USERPWD, $UN.":".$WP);

    curl_setopt($ch, CURLOPT_POST, 1);

    curl_setopt($ch, CURLOPT_POSTFIELDS , $theXML);

    curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type:application/atom+xml"));

    curl_setopt($ch, CURLOPT_HEADER, false);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);


    // set the url to fetch

    curl_setopt($ch, CURLOPT_URL, '');

    $content = curl_exec($ch);

    // remember to always close the session and free all resources


    echo $content;

Thanks a lot. Jérémy


Re: Error 400: The request contains errors in the common Atom se

Hi Jérémy,

This will work with just a few slight modifications.

1. Add the curl option:

'curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);'

2. Wrap you make your <ContactList> node an element of <ContactLists>.  For example:


      <ContactList id="" />


Also note that PHP is case-sensitive - it looks like you are posting "$theXML" and your Xml is being saved as "$theXml".

You can add multiple <ContactList> nodes to subscribe the contact to more than one list. I hope that this helps. Please let me if this solves the 400 error you've been receiving.

David J

Developer Portal

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

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More