ERROR: 314: Invalid Segments, from Heroku, but not local dev

Hi. Within the last couple weeks I started getting "ERROR: 314: Invalid Segments" when creating a campaign from my

Rails 3.2.7

app on Heroku, whereas it continues to work from local dev.

When I saw this error come up the first time around, I Googled around and saw that I was still using

createsend (1.1.1)

so I ran

bundle update


On September 5th, I pushed a change to Heroku (which included the createsend gem update), I saw this feedback from Heroku:

Installing createsend (2.1.0)

. And with subsequent pushes, I see this:

Using createsend (2.1.0)


Both my local and Heroku instances are using the same version of createsend (

* createsend (2.1.0)

). Also, I'm pretty certain that all the environment variables are correctly set because my app is able to interact with Campaign Monitor for other tasks.. like creating mailing lists for instance (plus the fact that creating campaigns worked up until around two weeks or so ago).

Any ideas about what could be the problem?


abatz, 4 years ago

By the way, here is how I call the API. Note that


is always an empty array.

    def cm_create_campaign
      CreateSend.api_key ENV['CAMPAIGN_MONITOR_API_KEY']
      client_id   =      ENV['CAMPAIGN_MONITOR_CLIENT_API_KEY']
      name        =
      subject     =      @campaign.subject
      from_name   =      ENV['CAMPAIGN_MONITOR_FROM_NAME']
      from_email  =      ENV['CAMPAIGN_MONITOR_FROM_EMAIL']
      reply_to    =      ENV['CAMPAIGN_MONITOR_REPLY_TO']
      html_url    =      ENV['CAMPAIGN_MONITOR_HTML_URL_IN_LOCAL_DEV'] || newsletter_url(@campaign.newsletter)
      text_url    =      ENV['CAMPAIGN_MONITOR_TEXT_URL_IN_LOCAL_DEV'] || html_url + '.txt'
      html_url   +=      '?cm=1' unless html_url.blank? # when creating a campaign we add the link: "Can't read this email? Please view it on our web site."
      list_ids    =      []
      @campaign.campaign_mailing_lists.each{|cml| list_ids << cml.mailing_list.cm_list_id}
      segment_ids =      []

        cm_campaign_id = CreateSend::Campaign.create client_id, subject, name, from_name, from_email, reply_to, html_url, text_url, list_ids, segment_ids
      rescue => e
        logger.error "[error] CampaignMonitor error: #{e}"
        flash[:error] = 'ERROR: ' + e.to_s.split(' - ')[1]
jamesd jamesd, 4 years ago

Hey, can you contact support at with your account url or the API key you're using so we can check the API logs to see exactly what json we're receiving and why you're receiving that errors? Thanks.

abatz, 4 years ago

Email sent at 14:08.

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free