Using the OnePageCRM API with Ruby

I have created a short ruby script to help getting started with the OnePageCRM API. The script is available on the OnePageCRM Github profile. It contains a small subsection of calls and functions available using the API.

Getting started

  • Clone the repository and change to the directory
  • Start irb and require the lib/onpageapi file
require './lib/onepageapi'
api_login = ''
api_pass = 'youronpagepassword'
samples =, api_pass)

# Try a few api calls

Creating a contact

new_contact_details = ({
      'first_name' => 'Johnny',
      'last_name' => 'Deer',
      'company_name' => 'ACMEinc',
      'starred' => true,
      'tags' => %w[api_test1 api_test2],
      'emails' => [{
          'type' => 'work',
          'value' => '' }]


Making other API calls

You can also use this client to manually make API calls that aren’t fully covered in this client. For example, to get a list of custom fields


will return:

{"status"=>0, "message"=>"OK", "timestamp"=>1394799434, "data"=>
        {"id"=>"52d6edc1eb89973879000003", "name"=>"Customer Ref", "type"=>"number"}
        {"id"=>"52cf182beb8997213a000001", "name"=>"Next Training Date", "type"=>"date"}
      {"id"=>"52cd3922eb89976e7d000034", "name"=>"Birthday", "type"=>"date"}
  "total_count"=>3, "page"=>1, "max_page"=>1, "per_page"=>10}

I hope that this short code sample will get you started using the OnePageCRM API v3.

Please let us know if there are other languages you would like to see examples for.

Author image

Peter Armstrong

Peter is a software engineer at OnePageCRM.