How to generate an API Key and Access Token

David_B.
Employee

Typically 3rd-party application developers will have their own API Key which lets their app talk to Constant Contact, however some developers may require you to provide them with your own API Key and Access Token. If you are using an integration that wants an API Key and Access Token, but are just not sure where to find those, then this step-by-step guide is for you.

 

To generate an API Key, you will first need to create or log in to a developer account at https://constantcontact.mashery.com/ This will be separate from your normal Constant Contact account.

 

Once you have created an account and verified the email address (or logged in to your existing developer account), you are ready to register a new app and get an API Key here: https://constantcontact.mashery.com/apps/register

 

  1. Fill out the Application Name field. This should be the name of the application or integration you are connecting your Constant Contact account to.
    Application Name
  2. Ignore all of the other fields and scroll to the bottom of the page.
  3. Check the box indicating you agree to the terms of service (we’re sure you read it all) and click Register Application.

You will then be presented with your API Key information.

API Key Information

 

Now that you have your API Key, you are ready to generate an Access Token. The easiest way to do so is to use our API Tester located here: https://constantcontact.mashery.com/io-docs

 

You should see your API Key pre-filled in the App/Key field.
(If you don't, click the Sign In link at the top right of the page and log in to the Mashery developer account you created earlier. Once you are logged in, the page will refresh and you will see your app and API Key listed there.)

 

  1. Click the gray Get Access Token button
    Get Access Token

  2. On the window that appears, click the blue I already have an account link
    I already have an account

  3. Log in to your Constant Contact account (not your developer account) and click Allow

You will then be provided with your Access Token, which you can now use along with your API Key in your integration!

Access Token

 

So that you can easily use them where you need to, we recommend you save this information somewhere, such as a Word or text document, however you can always log in to your developer account to see your API Key, and follow the steps above to view your Access Token again.



Was this guide helpful? What other types of information would you like to see guides on? We're happy to help get you the information that you need! Let us know in the comments!

16 Comments
BSS
Rookie

Hi, I need to sync email list from constant contact through cronjobs. If I understand right, oauth 2 requires to have a person standing by to click a button to initiate getting token. How to automate this process through cronjobs, since sync will be done at midnight when no person is standing by? 

 

Thank you for your time and attention.

Jimmy_D
Employee

Hello BSS,

 

You should be able to authenticate ahead of time and it will save that token for quite a while. Unless you have written your integration to expire those tokens at a specific amount of time they last 315359999 seconds which is 10 years.

 

This time can be changed of course to expire earlier if you wish. You can reference that documentation here. https://developer.constantcontact.com/docs/authentication/access-token-info.html

jasamson
Rookie
I am integrating Constant Contact with Bloom (by Elegant Themes) in WordPress. The Form Integration section calls for the API Key and then the Token. These have been filled in correctly, as I generated them at Mashery as described above. However, Bloom hangs on the Authorize button -- their spinner just keeps on spinning rather than connecting and allowing me to go to the next (optin design) step. Any advice? Running WP 4.8 with Jupiter Theme and Bloom plugin. Maybe I need the Elegant Themes updater plugin too? Just last week, I had a similar issue at this step with another client Newsletter optin setup, but somehow the Authorize resolved eventually. There's definitely some issue here between these two technologies. I'll check the Elegant Themes boards too and see if I can get support there. Cheers, Daniel
Jimmy_D
Employee
Hello jasamson, While there might have been a system delay once to cause the spinning if it has happened twice in the same place then I would definitely reach out to Bloom and check with them. They could have a hiccup in their service or coding that is causing the delay at that particular section.
Bridgette
Not applicable

Hello,

 

I am a web designer and am setting up a site for a client. She has requested a newsletter signup widget on her Wordpress site and this requires an API and access token. I went ahead and registered for an API, but I do not have a Constant Contact account and wasn't sure if the client's account should be the one that is linked? Would I use her account to login and generate the token? Or do I create my own account and get the token myself? Just not sure how all of this works as this is my first time working with something like this.

Jimmy_D
Employee
Hi Bridgette, Since the sign-up form is for your client you will want to generate the Access Token for her account. To do that you will want to log in with her account. This is Step 3 in the Access Token section of the this article above. Also to note Constant Contact has developed our own WordPress plugin for sign-up forms if that would be a helpful alternative. https://wordpress.org/plugins/constant-contact-forms/
JamesH3676
Campaign Contributor

More curiosity than anything. Is there a way for my customer to revoke a token that was issued to my API? Say they wish to disable the API.

Jimmy_D
Employee
Hi JamesH3676, The Access Token is attached to the Constant Contact account and it has an expiration date built in which you can modify in your code when your integration requests an Access Token to be generated. However; if your customer wants to have an Access Token manually removed they will need to call in to our support department and one of our agents will be able to revoke the token for them. We are currently developing our v3 API and will be looking to potentially include a customer facing method for this, but at this time we have no ETA for the v3 release and it will not launch with this feature either.
LisiJ
Rookie

Thank you! This was so helpful

Zoe_H
Employee

Hello @LisiJ,

 

Thank you for reaching out to the Community! We are very glad that this information was helpful to you. Please reach back out to us with any more questions or concerns! 

 

BillW863
Rookie

OMG.  is so much easier. Login, click generate API and poof, like magic. Done.

KimmellP9
Rookie

Excellent article on using this. Shame that the WordPress plugin, the official Constant Contact one, doesn't work!

Jimmy_D
Employee

Hi @KimmellP9,

 

The official Constant Contact WordPress plugin does not need to go through this process. If you are having problems using the plugin I highly recommend to make a post on the support forums for that plugin specifically. You can find them located here: https://wordpress.org/support/plugin/constant-contact-forms/

 

RobertH4988
Campaign Collaborator

This api tester with the Get Access Token capability is for the V2 API.  Is there one for V3 API?

This API Tester is what I refer to from the post above. https://constantcontact.mashery.com/io-docs. It is only for V2 API.
Jimmy_D
Employee

Hi @RobertH4988,

 

Our v3 API does have an authentication option; however it does not display the Access Token. You can go to the below page and when you click on any of the grey Oauth buttons to authenticate and use our API Tester page.

 

v3 API Reference

RobertH4988
Campaign Collaborator

Yes, I have used the API Reference tests, but it doesn't display the Access Token so that doesn't help me.  I need to be able to get an access token for my integration development w/ the V3 API. 

Resources

Community Blog

Check out marketing advice, tips, and tricks. All from our Constant Contact experts

Visit the blog

  • Avatar

    Featured Article

    Use Sections to Build Email Campaigns Faster and Improve Engagement Rates

    Using Sections while designing your marketing email not only increases your own efficiency but helps you to deliver a more friendly, organized message. Check out some of the key benefits of using sections in email.

    See Article
  • Avatar

    Featured Thread

    Casual Conversations: What's your go-to playlist?

    If you listen to music while you work, share your playlist below so we can be inspired and maybe find some new music!

    View thread
  • Avatar

    Featured Thread

    Ready, Set, Send Challenge: Week 2 - Designing the Perfect Email

    Learn how to create emails to effectively engage with your audience and drive the results you want.

    Join challenge