403 Forbidden API on creating contact


403 Forbidden API on creating contact

Hello Support Team,


We are receiving a 403 Forbidden status when creating contact through APIs. We are using Ruby on Rails Framework and uses "constantcontact" gem.


Here is the sample code we used to store bulk contacts.


@cc = ConstantContact::Api.new(application_key, user_account_token)

@list_id = @cc.get_lists[0].id

users_info.each do |user|

     response = @cc.get_contact_by_email(user.email)

     next if response && response.respond_to?(:results) && !response.results.empty? 
     contact = {'first_name'=> "#{user.first_name}", 'last_name' => "#{user.last_name}" }

     email = { 'email_address' => "#{user.email}"}

     contact['email_addresses'] = []

     contact['email_addresses'] << email contact['lists'] = []

     contact['lists'] << { :id => @list_id }

     new_contact = ConstantContact::Components::Contact.create(contact)

     @cc.add_contact(new_contact) # We are getting 403 forbidden for this line



It's observed that sometimes APIs workes correctly and save the record in the user's constant contact account but most of the time it returns 403 Forbidden.




Thank you for reaching out to Constant Contact API Developer Support.


Would you be willing to email some details to us at webservices(at)constantcontact.com? There are a few reasons this can happen, such as if you are trying to add a previously unsubscribed contact to a list. We'd like to have the following:

- Constant Contact username

- Email address that you are trying to add


Please let me know if you have any other questions!



David B.
Tier II API Support Engineer

Developer Portal

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

Visit Page