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.

updateContact using V2

Occasional Contributor

updateContact using V2

I am trying to update the contact using the code:

$contact = new Contact();
$contact->id = $Customer['ContactId'];
$contact->first_name = $allCustomers[$i]['first_name'];
$contact->last_name = $allCustomers[$i]['last_name'];
$cc->contactService->updateContact($params['token'], $contact);

But got error:  Ctct\Exceptions\CtctException: Forbidden 

How I prepare the $contact object, for passing to updateContact function.


I can't use

$contactData = $cc->contactService->getContacts($params['token'], array("email" => ''));
$contact = $contactData->results[0];

since it gives error (i don't know the reason).


So I decided to create the $contact object for update. I know the contact id and email of contact to update. 




Re: updateContact using V2



Your second code sample is the correct way to code the call. I'm wondering if there may be an underlying factor that is causing the error. Please try using our API Tester to get your contact by email address:


If you're getting an error response, please email us at with the API Key, Access Token, and the email address you are working with when you get this error so that I can dig in further.




David B.
Tier II API Support Engineer

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