We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

400 Error using PHP API examples

Occasional Participant

400 Error using PHP API examples


oddly CC support doesn't help out with the API and they've sent me here...

I'm using the sample PHP code from cc_class.php to generate XML to send to CC server. Curl tells me that the response is a 400 error. I am sending the following XML when I get the error:


<?xml version="1.0" encoding="UTF-8"?>

<entry xmlns="http://www.w3.org/2005/Atom">




        <name>CTCT Samples</name>



    <summary type="text">Customer document</summary>

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

        <Contact xmlns="http://ws.constantcontact.com/ns/1.0/">

            Customer document


























                <ContactList id="2" />






in CC_Utility I have my CC username, the password I use to log in to the CC main site, and an API key that I generated.


What am I doing wrong?



Thanks for any help

Tom Lancaster



Occasional Participant

nevermind - as often happens, the act of asking the question has turned a lightbulb on.

The contactlist "id" is not actually the list id. It's the list uri: 'http://api.constantcontact.com/ws/customers/newhanoian/lists/2'

Better nomenclature might have prevented that misunderstanding, but at least it's working now.

Tom Lancaster




I apologize for any inconvenience that this issue has caused. We do have this documented in Creating a Contact, but I can see how this would be confusing and I do apologize for that. I am glad that you were able to resolve this issue however.

I do want to comment on CTCT Support sending you here. Our phone/chat support channels are meant for support with our actual user interface, and not meant to be developer/API support. With that being said, we do have support representatives that handle API related issues from either this forum, or by emailing our webservices support team. If you contact us by these channels, we will be more than happy to assist you with integration questions. If you do have any other questions please do not hesitate to let us know. Thank you.

David J

Developer Portal

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

Visit Page