Showing results for 
Search instead for 
Did you mean: 
In recognition of Martin Luther King Day, our Support Centers will be open with limited hours on Monday (1/20) from 10AM ET to 6PM ET.
Visit our Help Center to see all of the ways you can find answers to your questions.

Contact Creation - 400 Errors (Resolved)

New Member

The remote server returned an error: (400) Bad Request.

I think there is still an issue.  My contacts are adding, but I receive the following reply:

The remote server returned an error: (400) Bad Request.



The ongoing issue where

The ongoing issue where people were receiving 400 Bad Request messages on valid REST requests has been resolved by a fix on our end.  The problem was not in any individuals code but in a validation test on our end.  No changes are required on end user scripts which were previously working.


If you are receiving any 400 or 401 requests, these are once again valid error messages.  The easiest way to debug these errors is to look at the full error message which is returned with all of our error requests.  If you are unsure of how to retrieve the full return message from whatever language you are using, a REST Client is a great alternative and is often more useful for troubleshooting error messages than any other tool.  Once you have found the problem in the REST Client, it is often easy to go back and adjust your code to reflect these changes.  We offer a guide on how to use a popular Java based REST Client here.


If you continue to experience these errors and are not able to deduce the cause by the error message returned to the REST Client, please open a new support forum post with your XML, Request URI and any the error Message you are receiving in the forum post and we can look into these errors for you.

Dave Berard
Senior Product Manager, Constant Contact
CTCT Employee

My apologies for not

My apologies for not clarifying to see if you were having problems with the API or with a specific programming language.

This thread was created to acknowledge a known temporary defect with our API and coincidentally it appears as though there was also a defect in the PHP sample code that prevented these addresses from being passed correctly to the API.

I myself have tested by adding email addresses containing all of the valid characters using the REST Client.

In testing the PHP sample I have noticed that it does not, and has never allowed the use of the plus sign when adding contacts. Due to encoding, the plus sign is being stripped out and replaced by a blank space. I have found a modification that can be implemented to allow the plus sign and also all other character supported by the RFC 2822 standard. I have tested this fix by adding the following contact to my account: cctest!#$%&'*+-/=?^_`{|}

The solution is to remove the urldecode() function from around the email address value in the createContactXML function like so:

$email_node = $contact_node->addChild("EmailAddress", urldecode(htmlspecialchars($params)));


$email_node = $contact_node->addChild("EmailAddress", htmlspecialchars($params));


Dan H

Support Engineer, Constant Contact