Problem with space in username

Regular Participant

Problem with space in username


My clients username had a space in it, they removed the space so I could register for an API key, this was the other week and the custom signup form was working fine after this.

On Tuesday this week I tested the signup form and noticed it was broken.

Turns out the client had changed their username back as per instructions I gave them telling them it is a temporary measure and can be changed back afterwards, following guidance from the CC website.

Anyways, they changed it back to have a space without me realising and the signup form no longer worked, I added the correct username to the access credentials but it still never worked. I guess the API does not accept usernames with spaces in them because when we removed the space again all worked fine?

James Benson, PHP Developer.

Constant Contact Services:


If the login name contains spaces, it will need to be encoded in the request URI using the RFC 1738 standard. You can do so in PHP using the rawurlencode() function. Please note that the rest of the URI does not and cannot be encoded as it will not function. Also, you do not need to encode the login name for the API credentials.

Dan H

Support Engineer, Constant Contact

Regular Participant

Ok thanks, my code was using urlencode() but that does not comply to RFC 1738 standard!


James Benson, PHP Developer.

Constant Contact Services:

Occasional Participant

Per Shannon Wallace in the API department at Constant Contact, here is what you need to do:


The API actually can’t be used for usernames that contain a space.  We stopped allowing new usernames to contain a space, but some older accounts do have a space.


If you users with spaces login and go to “My Account” in the upper right, they can change their username.

Thanks for updating this thread Brady.  This post was created a bit before I came on board here :)


Indeed, you can't use the API with a username that has a space in it.


Best Regards,

Shannon W.

API Support Specialist

For anyone curious, in early 2010 we stopped allowing creationg of usernames with spaces in them.  We ran into technical issues supporting those going forward and there was a very small percentage of our base even using that.  We continue to support them from a login perspective but for creation, updating and any API access, we do not support them anymore. 


Sorry for the confusion Brady!

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

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

Visit Page