NAV
shell ruby

nocrm.io API

To check what has been changed between version 1 and version 2, please visit the list of modifications Migration v1 to v2.

Welcome to the nocrm API! You can use this API to access data of your account. It will enable you to create, update and retrieve leads and users. It will also allow you to get notifications when particular events happen, thanks to our Webhooks.

We have examples with shell commands and Ruby. You can view code examples in the dark area to the right, and you can switch of programming language of the examples with the tabs in the top right. All the examples are made twice, one with an API key and one with the USER token to help you understand some parameters in the requests.

This is a traditional and simple REST API. It means that requests are passed to our servers through https (secure http) following a standard scheme. Each request is independant from the previous one (stateless) and it’s language independant. To use this API you will need:

There are two ways to connect on the API and it depends on what you intend to do:

IMPORTANT: Your private keys are like your admin password. These keys should only be used for authentification. This key is only for signing purpose.

Note: The generated API key is a key generated by you from your account to access the API. You can generate one different key for each application. You can delete it at any time and generate a new one if necessary. When a key is deleted, the application using this key won’t be able to connect to your account anymore and won’t access to any of your data.

Note 2: The user token is a token returned by a login method and is available for 30 days or until you logout.

Each time you want to access, add, modify or delete something through the API you have to:

REST defines which http method is to be used depending on wich kind of request your performing.

If you’re not familiar with REST and HTTP methods, don’t worry it’s very simple and our documentation is well explained (at least we do our best). You can also check out this nice introduction to REST philosophy at http://rest.elkstein.org/.

Data are sent to and retrieved from our servers in JSON format (http://json.org for more info).

If you’re only interested in creating leads you can also check our mail API wich do not need any coding skill.

Don’t hesitate to contact us at support@youdontneedacrm.com if you need any help and/or you would like to have more data access from the API.

Authentication

In order to secure your transaction, we ask you to use one of your generated api key or your user token with any https transaction.

In this version 2 of the API, you have the choice of making your requests:

Ping API

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/ping"
require 'rest-client'
key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/ping", header
JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/ping"
require 'rest-client'
token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/ping", header
JSON.parse(response)

The above commands return JSON structure like this:

{"status":200,"message":"Your API key is correct."}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "402", "message": "Suspended account: pay your subscription to use the API." } 

Ping the API with one of your API key or the USER token received to make sure that the key to authenticate the requests is correct.

Return a status 200 if the API key or the USER token you are using to authenticate your requests is valid.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/ping

Log as

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/auth/log_as?user_id=514"
require 'rest-client'
key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/auth/log_as?user_id=514", header
JSON.parse(response)

With the USER token

Not applicable with a USER token
Not applicable with a USER token

The above commands return JSON structure like this:

{ 
  "token": "ITd-Jb3EC_nCXI2fez4hhg",
  "slug": "THE_SLUG_OF_THE_ACCOUNT",
  "locale": "en",
  "time_zone": "America/Denver",
  "user_id": 514,
  "user_email": "stef@youdontneedacrm.com"
  "currency": 
  {
    "code": "USD",
    "symbol": "$"
  }
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "401", "message": "Unauthorized: you cannot use this action with a USER token. You have to use the API key method to authenticate." }

Already logged using the API key, log as a specific user of the account.

It returns a USER token that should be used instead of the API key for all the actions that have to be done as the user.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/auth/log_as

Parameters

Parameter Description
user_id required User id or email to retrieve the USER token for this user.

Login

With the API key

Not applicable with an API key.
Not application with an API key.

With the USER token

curl -u "user_email@domain.com:user_password" -H "Accept: application/ydncrm.v2" "https://YOUR_SLUG_HERE.nocrm.io/api/auth/login"
require 'rest-client'
header = { content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://user_email%40domain.com:user_password@YOUR_SLUG_HERE.nocrm.io/api/auth/login", header
token = JSON.parse(response)

The above commands return JSON structure like this:

{ 
  "token": "ITd-Jb3EC_nCXI2fez4hhg",
  "slug": "THE_SLUG_OF_THE_ACCOUNT",
  "locale": "en",
  "time_zone": "America/Denver",
  "user_id": 514,
  "user_email": "stef@youdontneedacrm.com"
  "currency": 
  {
    "code": "USD",
    "symbol": "$"
  }
}

In case of error you could get these responses

{ "error": "401", "message": "Invalid login or password" }

To receive a USER token in order to do the request with a specified user, you have to login first.

To pass secretly your email and password, we use the basic authentication with a https request.

DO NOT SEND your email and password as a parameter of the request.

cURL and Ruby automatically encode your email/password when using like the examples.

Make sure to escape properly your email and password in case they contain specific characters. For example if your password is qwerty$1 make sure to escape it like that qwerty%241.

If a manual encoding is necessary, use the following method:

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/auth/login

HEADERS

Name Value
Authorization Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

Logout

With the API key

Not applicable with an API key.
Not applicable with an API key.

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/auth/logout"
require 'rest-client'
token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/auth/logout", header

The above commands return nothing with the following statuses

status 200: logout successful
status 304: nothing has been done

Logout from the API which invalidates the USER token. For further requests, a new login will be necessary.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/auth/logout

Steps

List the steps

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/steps"
require 'rest-client'
key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/steps", header
steps = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/steps"
require 'rest-client'
key = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/steps", header
steps = JSON.parse(response)

The above commands return JSON structure like this:

[
  {
    "id": 1189,
    "name": "Incoming", 
    "position": 1, 
    "created_at": "2015-04-22T22:03:20.000Z", 
    "updated_at": "2015-04-22T22:03:20.000Z",
    "pipeline_id": 25
  },
  {
    "id": 1190,
    "name": "In-touch", 
    "position": 2, 
    "created_at": "2015-04-22T22:03:20.000Z", 
    "updated_at": "2015-04-22T22:03:20.000Z",
    "pipeline_id": 25
  },
  {
    "id": 1191,
    "name": "Closing", 
    "position": 3, 
    "created_at": "2015-04-22T22:03:20.000Z", 
    "updated_at": "2015-04-22T22:03:20.000Z",
    "pipeline_id": 25
  }
]

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "422", "message": "Unable to perform your request" }

Return the list of steps, previously created in your account.

The steps are returned ordered by their position.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/steps

Parameters

Parameter Default Description
direction optional asc Return data order by their position in ascending or descending. The value should be asc or desc.

Retrieve a step

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/steps/1189"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/steps/1189", header
step = JSON.parse(response)

With the USER token shell curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN": ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/steps/1189"

require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/steps/1189", header
step = JSON.parse(response)

The above commands return JSON structured like this:

{
  "id": 1189,
  "name": "Incoming", 
  "position": 1, 
  "created_at": "2015-04-22T22:03:20.000Z", 
  "updated_at": "2015-04-22T22:03:20.000Z",
  "pipeline_id": 25
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: id is required" }
{ "error": "422", "message": "Unable to perform your request" }

Retrieve a step previously created with its id.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/steps/{id}

Parameters

Parameter Description
id required Step’s id or step’s name. The identifier of the step that could be its id or its name.

Pipelines

List the pipelines

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/pipelines"
require 'rest-client'
key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/pipelines", header
pipelines = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/pipelines"
require 'rest-client'
key = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/pipelines", header
pipelines = JSON.parse(response)

The above commands return JSON structure like this:

[
  {
    "id": 25,
    "name": "Sales funnel", 
    "is_default": true, 
    "created_at": "2016-04-22T22:03:20.000Z", 
    "updated_at": "2016-04-22T22:03:20.000Z"
  },
  {
    "id": 26,
    "name": "Accounting funnel", 
    "is_default": false, 
    "created_at": "2016-04-26T22:03:20.000Z", 
    "updated_at": "2016-04-26T22:03:20.000Z"
  }
]

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "422", "message": "Unable to perform your request" }

Return the list of pipelines, previously created in your account.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/pipelines

Client folders

List the client folders

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/clients"
require 'rest-client'
key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/clients", header
clients = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/clients"
require 'rest-client'
key = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/clients", header
clients = JSON.parse(response)

The above commands return JSON structure like this:

[
  {
    "id": 12,
    "name": "Acme", 
    "description": "",
    "is_active": true,
    "created_at": "2015-04-22T22:03:20.000Z", 
    "user_id": 514
  },
  {
    "id": 2,
    "name": "Corporate", 
    "description": "",
    "is_active": false, 
    "created_at": "2015-04-22T22:03:20.000Z", 
    "user_id": 514 
  }
]

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "422", "message": "Unable to perform your request" }

Return the list of client folders, previously created in your account.

The client folders are returned ordered by their name by default.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/clients

Parameters

Parameter Default Description
direction optional asc Return data order by their order in ascending or descending. The value should be asc or desc.
order optional name Return data order by their name or id. The value should be name or id.

Create a client folder

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" -H "Content-Type: application/json" -d '{"name":"Blue Client","description":"Address: 2344 Paradise Av, Eden CA 90001","user_id":"stef@youdontneedacrm.com"}' "https://YOUR_SLUG_HERE.nocrm.io/api/clients"
require 'rest-client'
key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  "name":"Blue Client",
  "description":"Address: 2344 Paradise Av, Eden CA 90001",
  "user_id":"stef@youdontneedacrm.com"
}
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/clients", parameters, header
client = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -H "Content-Type: application/json" -d '{"name":"Blue Client","description":"Address: 2344 Paradise Av, Eden CA 90001"}' "https://YOUR_SLUG_HERE.nocrm.io/api/clients"
require 'rest-client'
key = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  "name":"Blue Client",
  "description":"Address: 2344 Paradise Av, Eden CA 90001"
}
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/clients", parameters, header
client = JSON.parse(response)

The above commands return JSON structure like this:

{
  "id": 13,
  "name": "Blue Client", 
  "description": "Address: 2344 Paradise Av, Eden CA 90001",
  "is_active": true,
  "created_at": "2017-02-17T22:03:20.000Z", 
  "user_id": 514,
  "extended_info": {
    "permalink": "https://YOUR_SLUG_HERE.nocrm.io/clients/13",
    "fields": {
      "address": "2344 Paradise Av, Eden CA 90001"
    },
    "fields_by_name":
    {
      "Address": "2344 Paradise Av, Eden CA 90001",
      "Billing address": null
    },
    "user": {
      "id": 514,
      "lastname": "Stone",
      "firstname": "Stéphanie",
      "email": "stef@youdontneedacrm.com"
    } 
  }
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "422", "message": "Unable to perform your request" }

Return the client folder created.

Http request

POST https://YOUR_SLUG_HERE.nocrm.io/api/clients

Parameters

Parameter Description
name required The name of the client folder.
description optional The client folder’s description.
user_id optional User’s email address or id to assign the client folder to the user. This parameter returns an error in case you are using the login user method to authenticate (USER token)

Retrieve a client folder

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/clients/12"
require 'rest-client'
key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/clients/12", header
client = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/clients/12"
require 'rest-client'
key = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/clients/12", header
client = JSON.parse(response)

The above commands return JSON structure like this:

{
  "id": 12,
  "name": "Acme", 
  "description": "",
  "is_active": true,
  "created_at": "2015-04-22T22:03:20.000Z", 
  "user_id": 514,
  "extended_info": {
    "permalink": "https://YOUR_SLUG_HERE.nocrm.io/clients/12",
    "fields": {
      "address": "2344 Paradise Av, Eden CA 90001"
    },
    "fields_by_name":
    {
      "Address": "2344 Paradise Av, Eden CA 90001",
      "Billing address": null
    },
    "user": {
      "id": 514,
      "lastname": "Stone",
      "firstname": "Stéphanie",
      "email": "stef@youdontneedacrm.com"
    } 
  }
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Unable to perform your request" }

Return the client folder, previously created in your account.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/clients/{id}

Parameters

Parameter Description
id required The identifier of the lead

Update a client folder

With the API key

curl -XPUT -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" -H "Content-Type: application/json" -d '{"name": "Blue Corp"}' "https://YOUR_SLUG_HERE.nocrm.io/api/clients/12"
require 'rest-client'
key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  name: "Blue Corp"
}
response = RestClient.put "https://YOUR_SLUG_HERE.nocrm.io/api/clients/12", parameters, header
client = JSON.parse(response)

With the USER token

curl -XPUT -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -H "Content-Type: application/json" -d '{"name": "Blue Corp"}' "https://YOUR_SLUG_HERE.nocrm.io/api/clients/12"
require 'rest-client'
key = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  name: "Blue Corp"
}
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/clients/12", parameters, header
client = JSON.parse(response)

The above commands return JSON structure like this:

{
  "id": 12,
  "name": "Blue Corp", 
  "description": "",
  "is_active": true,
  "created_at": "2015-04-22T22:03:20.000Z", 
  "user_id": 514,
  "extended_info": {
    "permalink": "https://YOUR_SLUG_HERE.nocrm.io/clients/12",
    "fields": {
      "address": "2344 Paradise Av, Eden CA 90001"
    },
    "fields_by_name":
    {
      "Address": "2344 Paradise Av, Eden CA 90001",
      "Billing address": null
    },
    "user": {
      "id": 514,
      "lastname": "Stone",
      "firstname": "Stéphanie",
      "email": "stef@youdontneedacrm.com"
    } 
  }
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Unable to perform your request" }

Update the client folder previously created.

Http request

PUT https://YOUR_SLUG_HERE.nocrm.io/api/clients/{id}

Parameters

Parameter Description
id required The identifier of the client folder
name optional The new name of the client folder
description optional The new description of the client folder
is_active optional Boolean to activate or inactivate the client folder

Delete a client folder

With the API key

curl -XDELETE -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/clients/12"
require 'rest-client'
key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.delete "https://YOUR_SLUG_HERE.nocrm.io/api/clients/12", header
client = JSON.parse(response)

With the USER token

curl -XDELETE -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/clients/12"
require 'rest-client'
key = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/clients/12", header
client = JSON.parse(response)

The above commands return JSON structure like this:

{
  "id": 12
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Unable to perform your request" }

Delete the client folder previously created from its id.

Http request

DELETE https://YOUR_SLUG_HERE.nocrm.io/api/clients/{id}

Parameters

Parameter Description
id required The identifier of the client folder

Categories

List the categories

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/categories?include_tags=true"
require 'rest-client'
key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = { include_tags: true }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/categories", parameters, header
categories = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/categories?include_tags=true"
require 'rest-client'
key = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = { include_tags: true }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/categories", parameters, header
categories = JSON.parse(response)

The above commands return JSON structure like this:

[
  {
    "id": 12,
    "name": "Origin",
    "is_required": false,
    "updated_at": "2015-09-06T22:45:06.000Z",
    "created_at": "2015-09-06T22:45:06.000Z",
    "supertags": [
    {
      "id": 54,
      "name": "US",
      "category": "Origin",
      "created_at": "2015-09-06T22:46:06.000Z",
      "position": null
    },
    {
      "id": 58,
      "name": "Europe",
      "category": "Origin",
      "created_at": null,
      "position": null
    },
    {
      "id": 59,
      "name": "Asia",
      "category": "Origin",
      "created_at": null,
      "position": null
    }] 
  },
  {
    "id": 13,
    "name": "Product",
    "is_required": false,
    "updated_at": "2015-09-06T22:45:06.000Z",
    "created_at": "2015-09-06T22:45:06.000Z",
    "supertags": [
    {
      "id": 60,
      "name": "Phone",
      "category": "Product",
      "created_at": "2015-09-06T22:46:06.000Z",
      "position": null
    },
    {
      "id": 61,
      "name": "Tablet",
      "category": "Product",
      "created_at": null,
      "position": null
    },
    {
      "id": 62,
      "name": "Computer",
      "category": "Product",
      "created_at": null,
      "position": null
    }] 
  },
]

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "422", "message": "Unable to perform your request" }

Return the list of categories with their tags if option added, previously created in your account.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/categories

Parameters

Parameter Default Description
include_tags optional false Include the supertags under each categories returned.

Predefined tags

List the predefined tags

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/predefined_tags"
require 'rest-client'
key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/predefined_tags", header
categories = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/predefined_tags"
require 'rest-client'
key = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/predefined_tags", header
categories = JSON.parse(response)

The above commands return JSON structure like this:

[
  {
    "id": 54,
    "name": "US",
    "category": "Origin",
    "created_at": "2015-09-06T22:46:06.000Z",
    "position": null
  },
  {
    "id": 58,
    "name": "Europe",
    "category": "Origin",
    "created_at": null,
    "position": null
  },
  {
    "id": 59,
    "name": "Asia",
    "category": "Origin",
    "created_at": null,
    "position": null
  },
  {
    "id": 60,
    "name": "Phone",
    "category": "Product",
    "created_at": "2015-09-06T22:46:06.000Z",
    "position": null
  },
  {
    "id": 61,
    "name": "Tablet",
    "category": "Product",
    "created_at": null,
    "position": null
  },
  {
    "id": 62,
    "name": "Computer",
    "category": "Product",
    "created_at": null,
    "position": null
  },
]

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "422", "message": "Unable to perform your request" }

Return the list of predefined tags, previously created in your account.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/predefined_tags

Leads

List the leads

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/leads"
require 'rest-client'
key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/leads", header
leads = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/leads"
require 'rest-client'
token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/leads", header
leads = JSON.parse(response)

The above commands return JSON structure like this:

[
  {
    "id": 8113,
    "title": "Loretta Inc.",
    "pipeline": null,
    "step": "Incoming",
    "step_id": 45,
    "status": "standby",
    "amount": 2400.0,
    "probability": 30,
    "currency": "USD",
    "starred": true,
    "remind_date": "2014-03-12",
    "remind_time": "09:30",
    "created_at": "2014-02-28T17:37:33.000Z",
    "estimated_closing_date": null,
    "updated_at": "2014-02-28T17:38:05.000Z",
    "description": "Firstname: Natalia\nLastname: Bawer\nFull name: Natalia Bawer\nEmail: natalia.bawer@loretta-inc.com\nPhone: 801 274 6798\nMobile: 832 764 1930 \nAddress: 1234 N 7864 W President Bld - Salt Lake City, UT 84105\nWeb: http://more-info-loretta.com\nDepartment: Sales\n--- Entrez une description ci-dessous ---\n \n--- \nMet Natalia at a seminar. She could be interested.\nShe is on business trip. Have to call her when she is back.",
    "html_description": "Firstname: Natalia\u003Cbr /\u003ELastname: Bawer\u003Cbr /\u003EFull name: Natalia Bawer\u003Cbr /\u003EEmail: natalia.bawer@loretta-inc.com\u003Cbr /\u003EPhone: 801 274 6798\u003Cbr /\u003EMobile: 832 764 1930\u0026nbsp;\u003Cbr /\u003EAddress: 1234 N 7864 W President Bld - Salt Lake City, UT 84105\u003Cbr /\u003EWeb: http://more-info-loretta.com\u003Cbr /\u003EDepartment: Sales\u003Cbr /\u003E\r\n\u003Cp class=\"lead-desc-separator\"\u003E--- Entrez une description ci-dessous ---\u003C/p\u003E\r\n\u003Cdiv\u003E\u0026nbsp;\u003C/div\u003E\r\n\u003Cbr /\u003E--- \u003Cbr /\u003E\r\n\u003Cp\u003EMet Natalia at a seminar. She could be interested.\u003Cbr /\u003EShe is on business trip. Have to call her when she is back.\u003C/p\u003E",
    "tags": ["small","US"],
    "created_from": "api",
    "closed_at": null,
    "attachment_count": 0,
    "created_by_id": 514,
    "user_id": 514, 
    "client_folder_id": 1,
    "client_folder_name": "Acme"
  },
  {
    "id": 8112,
    "title": "Acme Corp",
    "pipeline": null,
    "step": "Incoming",
    "step_id": 45,
    "status": "todo",
    "amount": 1500.0,
    "probability": 70,
    "currency": "USD",
    "starred": null,
    "remind_date": null,
    "remind_time": null,
    "created_at": "2014-02-28T17:31:04.000Z",
    "estimated_closing_date": null,
    "updated_at": "2014-02-28T17:31:04.000Z",
    "text_description": "Firstname: John\nLastname: Doe\nEmail: john.doe@acme.corp.com\nPhone: 201 418 1625\n---\nJohn is very interested by our service. He wants a quote asap.\n",
    "html_description": "Firstname: John\u003Cbr /\u003ELastname: Doe\u003Cbr /\u003EEmail: john.doe@acme.corp.com\u003Cbr /\u003EPhone: 201 418 1625\u003Cbr /\u003E\r\n---\r\n\u003Cp\u003EJohn is very interested by our service. He wants a quote asap.\u003Cbr /\u003E\u003Cbr /\u003E\u003C/p\u003E",
    "tags": [],
    "created_from": "api",
    "closed_at": null,
    "attachment_count": 0,
    "created_by_id": 514,
    "user_id": 514, 
    "client_folder_id": 1,
    "client_folder_name": "Acme"
  }
]

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "400", "message": "Parameter [status | step | user_id] not recognized." }
{ "error": "400", "message": "The date updated_after is not formatted properly" }
{ "error": "422", "message": "Unable to perform your request" }

Return a list of leads, previously created in your account.

The leads are returned with a limit of 100 by default. However it is possible to change this limit. To navigate in the large amount of data, use the parameter offset to shift the data.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/leads

Parameters

Parameter Default Description
direction optional desc Direction for ordering the data returned in ascending or descending. The value should be asc or desc.
order optional id Attribute to order the data returned. Could be: id, creation_date, last_update, next_action, sale_step, amount, probability, probalized_amount, alphabetically.
limit optional 100 Maximum count of data returned by request.
status optional Array of status names separated by a comma. Return the leads with the specified statuses. The status could be one of these values: todo, standby, won, cancelled, lost.
step optional Array of step names separated by a comma. Return the leads for the specified steps. The step should be the exact name entered in the application.
starred optional If set to true, returned all starred leads.
user_id optional User id or email to retrieve the leads belonging to this user only.
email optional Email address entered in the lead’s description or in a comment. Return the leads containing this email address.
tags optional An array of tags. Return the leads containing all the tags of the array. The tags could also include the Predefined tags of your account.
offset optional Shift the returned data by the offset value. Option used with the limit parameter in order to paginate the return.
updated_after optional Date of the last update of the lead to retrieve all the leads updated after this date. The date should be in UTC.

Create a lead

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" -H "Content-Type: application/json" -d '{"title":"Awesome Company","description":"Firstname%3A+John%0ALastname%3A+Doe%0AEmail%3A+john.doe%40company.com","user_id":"stef@youdontneedacrm.com","tags":["prospect","google"]}' "https://YOUR_SLUG_HERE.nocrm.io/api/leads"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  title: "Awesome Company",
  description: "Firstname: John\nLastname: Doe\nEmail: john.doe@company.com",
  user_id: "stef@youdontneedacrm.com",
  tags: ["prospect","google"]
}
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/leads", parameters, header
lead = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -H "Content-Type: application/json" -d '{"title":"Awesome Company","description":"Firstname%3A+John%0ALastname%3A+Doe%0AEmail%3A+john.doe%40company.com","tags":["prospect","google"]}' "https://YOUR_SLUG_HERE.nocrm.io/api/leads"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  title: "Awesome Company",
  description: "Firstname: John\nLastname: Doe\nEamil: john.doe@company.com",
  tags: ["prospect","google"]
}
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/leads", parameters, header
lead = JSON.parse(response)

The above commands return JSON structure like this:

{ 
  "id": 8114,
  "title": "Awesome Company",
  "pipeline": null,
  "step": "Incoming",
  "step_id": 45,
  "status": "Todo",
  "amount": null,
  "probability": null,
  "currency": "USD",
  "starred": null,
  "remind_date": null,
  "remind_time": null,
  "created_at": "2014-02-28T20:57:29.000Z",
  "estimated_closing_date": null,
  "updated_at": "2014-02-28T20:57:29.000Z",
  "closed_at": null,
  "description": "Firstname: John\nLastname: Doe\nEmail: john.doe@company.com",
  "html_description": "Firstname: John\nLastname: Doe\nEmail: john.doe@company.com",
  "tags": ["google","prospect"],
  "created_from": "api",
  "created_by_id": 514,
  "user_id": 514,
  "client_folder_id": null,
  "client_folder_name": null,
  "attachment_count": 0,
  "extended_info":
  {
    "all_contact_emails": ["john.doe@company.com"],
    "first_contact_email": "john.doe@company.com",
    "permalink": "https://YOUR_SLUG_HERE.nocrm.io/leads/8114",
    "fields":
    {
      "email": "john.doe@company.com",
      "phone": null,
      "mobile": null,
      "address": null,
      "web": null,
      "first_name": "John",
      "last_name": "Doe",
      "full_name": null,
      "job": null,
      "fax": null,
      "vat": null
    },
    "fields_by_name":
    {
      "Email": "john.doe@company.com",
      "Firstname": "John",
      "Lastname": "Doe"
    },
    "comment_count": 0,
    "bcc_count": 0,
    "user":
    {
      "id": 514,
      "lastname": "Stone",
      "firstname": "Stéphanie",
      "email": "stef@youdontneedacrm.com"
    },
    "client_folder": null,
    "created_by": {
      "id": 514,
      "lastname": "Stone",
      "firstname": "Stéphanie",
      "email": "stef@youdontneedacrm.com"
    },
    "business_card_id": null,
    "visible_by_count": 1,
    "follow_ups": []
  }
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "400", "message": "Parameter user_id [not recognized | should not be used with USER token]." }
{ "error": "422", "message": "Missing parameter: title is required" }
{ "error": "422", "message": "Missing parameter: description is required" }
{ "error": "422", "message": "Unable to perform your request" }

To create a new lead, you have to pass the required parameters.

Depending on the key you used, with only the required parameters the lead will belong to:

In case you are using the API key and you want to assign directly the lead to a collaborator, you need to add the email address or the id of the user as parameter. If we cannot retrieve any user registered in the account an error is returned.

When using the “direct assignment” The user won’t receive a notification when the lead is created. If a notification has to be sent, create the lead unassigned and use the method assign to assign the lead to the user. With this method, the user is notified.

The user_id parameter returns an error when using the USER token.

Http request

POST https://YOUR_SLUG_HERE.nocrm.io/api/leads

Parameters

Parameter Description
title required Lead’s title. Usually it corresponds to the company name.
description required Lead’s description. Usually it contains the information of the contact in the company.
user_id optional User’s email address or id to assign the lead to the user. This parameter returns an error in case you are using the login user method to authenticate (USER token)
tags optional An array of tags describing the lead. If the tags don’t exist they are automatically created. The tags could also include the Predefined tags of your account.
created_at optional Date of lead’s creation with the following format: YYYY-MM-DD HH:MM:SS in the time zone of the account and the time in 24h format. The time can be also be in UTC with this specific format: YYYY-MM-DDTHH:MM:SS.sssZ. Do not use this parameter if you don’t want to past date your lead creation.

Retrieve a lead

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113", header
lead = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113", header
lead = JSON.parse(response)

The above commands return JSON structured like this:

{
  "id": 8113,
  "title": "Loretta Inc.",
  "pipeline": null,
  "step": "Incoming",
  "step_id": 45,
  "status": "Standby",
  "amount": 2400.0,
  "probability": 30,
  "currency": "USD",
  "starred": true,
  "remind_date": "2014-03-12",
  "remind_time": "09:00",
  "created_at": "2014-02-28T17:37:33.000Z",
  "estimated_closing_date": null,
  "updated_at": "2014-02-28T17:38:05.000Z",
  "closed_at": null,
  "description": "Firstname: Natalia\nLastname: Bawer\nFull name: Natalia Bawer\nEmail: natalia.bawer@loretta-inc.com\nPhone: 801 274 6798\nMobile: 832 764 1930 \nAddress: 1234 N 7864 W President Bld - Salt Lake City, UT 84105\nWeb: http://more-info-loretta.com\nDepartment: Sales\n--- Entrez une description ci-dessous ---\n \n--- \nMet Natalia at a seminar. She could be interested.\nShe is on business trip. Have to call her when she is back.",
  "html_description": "Firstname: Natalia\u003Cbr /\u003ELastname: Bawer\u003Cbr /\u003EFull name: Natalia Bawer\u003Cbr /\u003EEmail: natalia.bawer@loretta-inc.com\u003Cbr /\u003EPhone: 801 274 6798\u003Cbr /\u003EMobile: 832 764 1930\u0026nbsp;\u003Cbr /\u003EAddress: 1234 N 7864 W President Bld - Salt Lake City, UT 84105\u003Cbr /\u003EWeb: http://more-info-loretta.com\u003Cbr /\u003EDepartment: Sales\u003Cbr /\u003E\r\n\u003Cp class=\"lead-desc-separator\"\u003E--- Entrez une description ci-dessous ---\u003C/p\u003E\r\n\u003Cdiv\u003E\u0026nbsp;\u003C/div\u003E\r\n\u003Cbr /\u003E--- \u003Cbr /\u003E\r\n\u003Cp\u003EMet Natalia at a seminar. She could be interested.\u003Cbr /\u003EShe is on business trip. Have to call her when she is back.\u003C/p\u003E",
  "tags": ["small","US"],
  "created_from": "api",
  "created_by_id": 514,
  "user_id": 514,
  "client_folder_id": 1,
  "client_folder_name": "Acme",
  "attachment_count": 0,
  "extended_info":
  {
    "first_contact_email": "natalia.bawer@loretta-inc.com",
    "all_contact_emails": ["natalia.bawer@loretta-inc.com"],
    "permalink": "https://YOUR_SLUG_HERE.nocrm.io/leads/8113",
    "fields":
    {
      "email": "natalia.bawer@loretta-inc.com",
      "phone": "801 274 6798",
      "mobile": "832 764 1930 ",
      "address": "1234 N 7864 W President Bld - Salt Lake City, UT 84105",
      "web": "http://more-info-loretta.com",
      "first_name": "Natalia",
      "last_name": "Bawer",
      "full_name": "Natalia Bawer",
      "job": "Sales",
      "fax": null,
      "vat": null
    },
    "fields_by_name":
    {
      "Firstname": "Natalia",
      "Lastname": "Bawer",
      "Full name": "Natalia Bawer",
      "Email": "natalia.bawer@loretta-inc.com",
      "Phone": "801 274 6798",
      "Mobile": "832 764 1930 ",
      "Address": "1234 N 7864 W President Bld - Salt Lake City, UT 84105",
      "Web": "http://more-info-loretta.com",
      "Department": "Sales"
    },
    "comment_count": 0,
    "bcc_count": 0,
    "user": 
    {
      "id": 514,
      "lastname": "Stone",
      "firstname": "Stéphanie",
      "email": "stef@youdontneedacrm.com"
    },
    "client_folder":
    {
      "id": 1,
      "name": "Acme",
      "description": "Billing address: 123 heaven avenue, San Francisco CA\u0026nbsp;94103\u003Cbr /\u003EShipping address: 456 pretty boulevard, Paradise CA\u0026nbsp;94188",
      "is_active": true,
      "created_at": "2015-01-30T22:03:14.000Z"
    },
    "created_by": 
    {
      "id": 514,
      "lastname": "Stone",
      "firstname": "Stéphanie",
      "email": "stef@youdontneedacrm.com"
    },
    "business_card_id": 412,
    "visible_by_count": 1,
    "follow_ups": []
  }
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: id is required" }
{ "error": "422", "message": "Unable to perform your request" }

Retrieve a lead previously created from its id.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/leads/{id}

Parameters

Parameter Description
id required Lead’s id. The identifier of the lead.

Update a lead

With the API key

curl -XPUT -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113" --data "amount=1562.89&probability=85&step=In-touch"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  amount: 1562.89,
  probability: 85,
  step: "In-touch"
}
response = RestClient.put "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113", parameters, header
updated_lead = JSON.parse(response)

With the USER token

curl -XPUT -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113" --data "amount=1562.89&probability=85&step=In-touch"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  amount: 1562.89,
  probability: 85,
  step: "In-touch"
}
response = RestClient.put "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113", parameters, header
updated_lead = JSON.parse(response)

The above commands return JSON structured like this:

{
  "id": 8113,
  "title": "Loretta Inc.",
  "pipeline": null,
  "step": "In-touch",
  "step_id": 45,
  "status": "Standby",
  "amount": 1562.89,
  "probability": 85,
  "currency": "USD",
  "starred": true,
  "remind_date": "2014-03-12",
  "remind_time": "09:00",
  "created_at": "2014-02-28T17:37:33.000Z",
  "estimated_closing_date": null,
  "updated_at": "2014-02-28T17:38:05.000Z",
  "closed_at": null,
  "description": "Firstname: Natalia\nLastname: Bawer\nFull name: Natalia Bawer\nEmail: natalia.bawer@loretta-inc.com\nPhone: 801 274 6798\nMobile: 832 764 1930 \nAddress: 1234 N 7864 W President Bld - Salt Lake City, UT 84105\nWeb: http://more-info-loretta.com\nDepartment: Sales\n--- Entrez une description ci-dessous ---\n \n--- \nMet Natalia at a seminar. She could be interested.\nShe is on business trip. Have to call her when she is back.",
  "html_description": "Firstname: Natalia\u003Cbr /\u003ELastname: Bawer\u003Cbr /\u003EFull name: Natalia Bawer\u003Cbr /\u003EEmail: natalia.bawer@loretta-inc.com\u003Cbr /\u003EPhone: 801 274 6798\u003Cbr /\u003EMobile: 832 764 1930\u0026nbsp;\u003Cbr /\u003EAddress: 1234 N 7864 W President Bld - Salt Lake City, UT 84105\u003Cbr /\u003EWeb: http://more-info-loretta.com\u003Cbr /\u003EDepartment: Sales\u003Cbr /\u003E\r\n\u003Cp class=\"lead-desc-separator\"\u003E--- Entrez une description ci-dessous ---\u003C/p\u003E\r\n\u003Cdiv\u003E\u0026nbsp;\u003C/div\u003E\r\n\u003Cbr /\u003E--- \u003Cbr /\u003E\r\n\u003Cp\u003EMet Natalia at a seminar. She could be interested.\u003Cbr /\u003EShe is on business trip. Have to call her when she is back.\u003C/p\u003E",
  "tags": ["small","US"],
  "created_from": "api",
  "created_by_id": 514,
  "user_id": 514,
  "client_folder_id": 1,
  "client_folder_name": "Acme",
  "extended_info":
  {
    "first_contact_email": "natalia.bawer@loretta-inc.com",
    "all_contact_emails": ["natalia.bawer@loretta-inc.com"],
    "permalink": "https://YOUR_SLUG_HERE.nocrm.io/leads/8113",
    "fields":
    {
      "email": "natalia.bawer@loretta-inc.com",
      "phone": "801 274 6798",
      "mobile": "832 764 1930 ",
      "address": "1234 N 7864 W President Bld - Salt Lake City, UT 84105",
      "web": "http://more-info-loretta.com",
      "first_name": "Natalia",
      "last_name": "Bawer",
      "full_name": "Natalia Bawer",
      "job": "Sales",
      "fax": null,
      "vat": null
    },
    "fields_by_name":
    {
      "Firstname": "Natalia",
      "Lastname": "Bawer",
      "Full name": "Natalia Bawer",
      "Email": "natalia.bawer@loretta-inc.com",
      "Phone": "801 274 6798",
      "Mobile": "832 764 1930 ",
      "Address": "1234 N 7864 W President Bld - Salt Lake City, UT 84105",
      "Web": "http://more-info-loretta.com",
      "Department": "Sales"
    },
    "comment_count": 0,
    "bcc_count": 0,
    "user": 
    {
      "id": 514,
      "lastname": "Stone",
      "firstname": "Stéphanie",
      "email": "stef@youdontneedacrm.com"
    },
    "client_folder":
    {
      "id": 1,
      "name": "Acme",
      "description": "Billing address: 123 heaven avenue, San Francisco CA\u0026nbsp;94103\u003Cbr /\u003EShipping address: 456 pretty boulevard, Paradise CA\u0026nbsp;94188",
      "is_active": true,
      "created_at": "2015-01-30T22:03:14.000Z"
    },
    "created_by": 
    {
      "id": 514,
      "lastname": "Stone",
      "firstname": "Stéphanie",
      "email": "stef@youdontneedacrm.com"
    },
    "business_card_id": 412,
    "visible_by_count": 1,
    "follow_ups": []
  }
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "400", "message": "You cannot update the parameters status, step, starred, amount or probability without assigning the lead first." }
{ "error": "400", "message": "Parameter [status | step] not recognized." }
{ "error": "400", "message": "Missing parameter: remind_at is required when status is changed to standby" }
{ "error": "400", "message": "Date format invalid for remind_date (YYYY-MM-DD) or remind_time (HH:MM)" }
{ "error": "400", "message": "A probability cannot be set without an amount" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: id is required" }
{ "error": "422", "message": "Missing parameter: remind_at is required when status is changed to STANDBY" }
{ "error": "422", "message": "Date format invalid for remind_at (YYYY-MM-DD) or remind_time (HH:MM)" }
{ "error": "422", "message": "Unable to perform your request" }

Update a lead previously created.

Http request

PUT https://YOUR_SLUG_HERE.nocrm.io/api/leads/{id}

Parameters

Parameter Default Description
id required Lead’s id. The identifier of the lead.
title optional Lead’s title. The new title of the lead.
description optional Lead’s description. The new description of the lead.
status optional Lead’s status. The new status of the lead. Could be one of these values: todo, standby, won, lost, cancelled. If the value is not recognized, an error 400 is returned.
remind_date optional Date of the reminder with the following format: YYYY-MM-DD in the time zone of the account. If the status is changed to standby, this parameter is mandatory, otherwise an error 400 is returned.
remind_time optional When a reminder date is added, a time can also be set. The format of the time is HH:MM and in 24h. It is not mandatory, only the remind_at is mandatory in case of status changed to standby.
amount optional Lead’s amount. The new amount of the lead.
probability optional Lead’s probability. The new probability of the lead. The probability cannot be set if there is no amount.
starred optional Lead’s starred. true if the lead is starred, false otherwise.
step optional New step’s id or step’s name for the lead. If the step is not found, an error 404 is returned. For information if you have steps in different pipeline that have the same name, it is better to use the step’s id.
user_id optional Lead’s user id or email. The new user id or user email of the lead. This update corresponds to assign the lead to a new user.
tags optional An array of tags describing the lead. If the tags don’t exist they are automatically created. The tags could also include the Predefined tags of your account.
created_at optional Date of lead’s creation with the following format: YYYY-MM-DD HH:MM:SS in the time zone of the account and the time in 24h format. The time can be also be in UTC with this specific format: YYYY-MM-DDTHH:MM:SS.sssZ. Do not use this parameter if you don’t want to past date your lead creation.
estimated_closing_date optional Estimated closing date on a lead. The date has to be in the time zone of the account.

Assign a lead

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" -XPOST --data "user_id=436" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113/assign"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = { user_id: 436 }
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113/assign", parameters, header
lead = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -XPOST --data "user_id=436" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113/assign"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = { user_id: 436 }
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113/assign", parameters, header
lead = JSON.parse(response)

The above commands return JSON structured like this:

{
  "id": 8113,
  "title": "Loretta Inc.",
  "pipeline": null,
  "step": "In-touch",
  "step_id": 45,
  "status": "Standby",
  "amount": 1562.89,
  "probability": 85,
  "currency": "USD",
  "starred": true,
  "remind_date": "2014-03-12",
  "remind_time": "09:00",
  "created_at": "2014-02-28T17:37:33.000Z",
  "estimated_closing_date": null,
  "updated_at": "2014-02-28T17:38:05.000Z",
  "closed_at": null,
  "description": "Firstname: Natalia\nLastname: Bawer\nFull name: Natalia Bawer\nEmail: natalia.bawer@loretta-inc.com\nPhone: 801 274 6798\nMobile: 832 764 1930 \nAddress: 1234 N 7864 W President Bld - Salt Lake City, UT 84105\nWeb: http://more-info-loretta.com\nDepartment: Sales\n--- Entrez une description ci-dessous ---\n \n--- \nMet Natalia at a seminar. She could be interested.\nShe is on business trip. Have to call her when she is back.",
  "html_description": "Firstname: Natalia\u003Cbr /\u003ELastname: Bawer\u003Cbr /\u003EFull name: Natalia Bawer\u003Cbr /\u003EEmail: natalia.bawer@loretta-inc.com\u003Cbr /\u003EPhone: 801 274 6798\u003Cbr /\u003EMobile: 832 764 1930\u0026nbsp;\u003Cbr /\u003EAddress: 1234 N 7864 W President Bld - Salt Lake City, UT 84105\u003Cbr /\u003EWeb: http://more-info-loretta.com\u003Cbr /\u003EDepartment: Sales\u003Cbr /\u003E\r\n\u003Cp class=\"lead-desc-separator\"\u003E--- Entrez une description ci-dessous ---\u003C/p\u003E\r\n\u003Cdiv\u003E\u0026nbsp;\u003C/div\u003E\r\n\u003Cbr /\u003E--- \u003Cbr /\u003E\r\n\u003Cp\u003EMet Natalia at a seminar. She could be interested.\u003Cbr /\u003EShe is on business trip. Have to call her when she is back.\u003C/p\u003E",
  "tags": ["small","US"],
  "created_from": "api",
  "created_by_id": 514,
  "user_id": 436,
  "client_folder_id": 1,
  "client_folder_name": "Acme",
  "extended_info":
  {
    "first_contact_email": "natalia.bawer@loretta-inc.com",
    "all_contact_emails": ["natalia.bawer@loretta-inc.com"],
    "permalink": "https://YOUR_SLUG_HERE.nocrm.io/leads/8113",
    "fields":
    {
      "email": "natalia.bawer@loretta-inc.com",
      "phone": "801 274 6798",
      "mobile": "832 764 1930 ",
      "address": "1234 N 7864 W President Bld - Salt Lake City, UT 84105",
      "web": "http://more-info-loretta.com",
      "first_name": "Natalia",
      "last_name": "Bawer",
      "full_name": "Natalia Bawer",
      "job": "Sales",
      "fax": null,
      "vat": null
    },
    "fields_by_name":
    {
      "Firstname": "Natalia",
      "Lastname": "Bawer",
      "Full name": "Natalia Bawer",
      "Email": "natalia.bawer@loretta-inc.com",
      "Phone": "801 274 6798",
      "Mobile": "832 764 1930 ",
      "Address": "1234 N 7864 W President Bld - Salt Lake City, UT 84105",
      "Web": "http://more-info-loretta.com",
      "Department": "Sales"
    },
    "comment_count": 0,
    "bcc_count": 0,
    "user": 
    {
      "id": 436,
      "lastname": "Rose",
      "firstname": "Juliette",
      "email": "juliette@example.com"
    },
    "client_folder":
    {
      "id": 1,
      "name": "Acme",
      "description": "Billing address: 123 heaven avenue, San Francisco CA\u0026nbsp;94103\u003Cbr /\u003EShipping address: 456 pretty boulevard, Paradise CA\u0026nbsp;94188",
      "is_active": true,
      "created_at": "2015-01-30T22:03:14.000Z"
    }
    "created_by": 
    {
      "id": 514,
      "lastname": "Stone",
      "firstname": "Stéphanie",
      "email": "stef@youdontneedacrm.com"
    },
    "business_card_id": null,
    "visible_by_count": 1,
    "follow_ups": []
  }
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: user_id is required" }
{ "error": "422", "message": "Unable to perform your request" }

Assign a lead to a collaborator. The user will be notified by email of the assignment if the preference to receive notifications is checked.

Http request

POST https://YOUR_SLUG_HERE.nocrm.io/api/leads/{id}/assign

Parameters

Parameter Description
user_id required Lead’s user id or email. The new user id or user email of the lead. This update corresponds to assign the lead to a new user.

List the unassigned leads

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/unassigned"
require 'rest-client'
key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/leads/unassigned", header
unassigned_leads = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/unassigned"
require 'rest-client'
token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/leads/unassigned", header
unassigned_leads = JSON.parse(response)

The above commands return JSON structure like this:

[
  {
    "id": 8113,
    "title": "Loretta Inc.",
    "pipeline": null,
    "step": "Incoming",
    "step_id": 45,
    "status": "todo",
    "amount": null,
    "probability": null,
    "currency": null,
    "starred": false,
    "remind_date": null,
    "remind_time": null,
    "created_at": "2017-05-28T17:37:33.000Z",
    "estimated_closing_date": null,
    "updated_at": "2017-05-28T17:37:33.000Z",
    "description": "Firstname: Natalia\nLastname: Bawer\nFull name: Natalia Bawer\nEmail: natalia.bawer@loretta-inc.com\nPhone: 801 274 6798\nMobile: 832 764 1930 \nAddress: 1234 N 7864 W President Bld - Salt Lake City, UT 84105\nWeb: http://more-info-loretta.com\nDepartment: Sales\n--- Entrez une description ci-dessous ---\n \n--- \nMet Natalia at a seminar. She could be interested.\nShe is on business trip. Have to call her when she is back.",
    "html_description": "Firstname: Natalia\u003Cbr /\u003ELastname: Bawer\u003Cbr /\u003EFull name: Natalia Bawer\u003Cbr /\u003EEmail: natalia.bawer@loretta-inc.com\u003Cbr /\u003EPhone: 801 274 6798\u003Cbr /\u003EMobile: 832 764 1930\u0026nbsp;\u003Cbr /\u003EAddress: 1234 N 7864 W President Bld - Salt Lake City, UT 84105\u003Cbr /\u003EWeb: http://more-info-loretta.com\u003Cbr /\u003EDepartment: Sales\u003Cbr /\u003E\r\n\u003Cp class=\"lead-desc-separator\"\u003E--- Entrez une description ci-dessous ---\u003C/p\u003E\r\n\u003Cdiv\u003E\u0026nbsp;\u003C/div\u003E\r\n\u003Cbr /\u003E--- \u003Cbr /\u003E\r\n\u003Cp\u003EMet Natalia at a seminar. She could be interested.\u003Cbr /\u003EShe is on business trip. Have to call her when she is back.\u003C/p\u003E",
    "tags": ["small","US"],
    "created_from": "me@example.com",
    "closed_at": null,
    "attachment_count": 0,
    "created_by_id": null,
    "user_id": null, 
    "client_folder_id": null,
    "client_folder_name": null
  },
  {
    "id": 8112,
    "title": "Acme Corp",
    "pipeline": null,
      "step": "Incoming",
      "step_id": 45,
    "status": "todo",
    "amount": null,
    "probability": null,
    "currency": null,
    "starred": false,
    "remind_date": null,
    "remind_time": null,
    "created_at": "2014-02-28T17:31:04.000Z",
    "estimated_closing_date": null,
    "updated_at": "2014-02-28T17:31:04.000Z",
    "text_description": "Firstname: John\nLastname: Doe\nEmail: john.doe@acme.corp.com\nPhone: 201 418 1625\n---\nJohn is very interested by our service. He wants a quote asap.\n",
      "html_description": "Firstname: John\u003Cbr /\u003ELastname: Doe\u003Cbr /\u003EEmail: john.doe@acme.corp.com\u003Cbr /\u003EPhone: 201 418 1625\u003Cbr /\u003E\r\n---\r\n\u003Cp\u003EJohn is very interested by our service. He wants a quote asap.\u003Cbr /\u003E\u003Cbr /\u003E\u003C/p\u003E",
    "tags": [],
    "created_from": "me@example.com",
    "closed_at": null,
    "attachment_count": 0,
    "created_by_id": null,
    "user_id": null, 
    "client_folder_id": null,
    "client_folder_name": null
  }
]

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "403", "message": "Unauthorized: this feature is only available for admins" }
{ "error": "422", "message": "Unable to perform your request" }

Return the list of unassigned leads.

The leads are returned with a limit of 100 by default. However it is possible to change this limit.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/leads/unassigned

Parameters

Parameter Default Description
limit optional 100 Maximum count of data returned by the request.

Add a lead to a Client folder

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" -H "Content-Type: application/json" -d '{"client_id": 12}' "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113/add_to_client"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = { client_id: 12 }
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113/add_to_client", parameters, header
lead = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -H "Content-Type: application/json" -d '{"client_id": 12}' "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113/add_to_client"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = { client_id: 12 }
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113/add_to_client", parameters, header
lead = JSON.parse(response)

The above commands return JSON structured like this:

{
  "id": 8113,
  "title": "Loretta Inc.",
  "pipeline": null,
  "step": "In-touch",
  "step_id": 45,
  "status": "Standby",
  "amount": 1562.89,
  "probability": 85,
  "currency": "USD",
  "starred": true,
  "remind_date": "2014-03-12",
  "remind_time": "09:00",
  "created_at": "2014-02-28T17:37:33.000Z",
  "estimated_closing_date": null,
  "updated_at": "2014-02-28T17:38:05.000Z",
  "closed_at": null,
  "description": "Firstname: Natalia\nLastname: Bawer\nFull name: Natalia Bawer\nEmail: natalia.bawer@loretta-inc.com\nPhone: 801 274 6798\nMobile: 832 764 1930 \nAddress: 1234 N 7864 W President Bld - Salt Lake City, UT 84105\nWeb: http://more-info-loretta.com\nDepartment: Sales\n--- Entrez une description ci-dessous ---\n \n--- \nMet Natalia at a seminar. She could be interested.\nShe is on business trip. Have to call her when she is back.",
  "html_description": "Firstname: Natalia\u003Cbr /\u003ELastname: Bawer\u003Cbr /\u003EFull name: Natalia Bawer\u003Cbr /\u003EEmail: natalia.bawer@loretta-inc.com\u003Cbr /\u003EPhone: 801 274 6798\u003Cbr /\u003EMobile: 832 764 1930\u0026nbsp;\u003Cbr /\u003EAddress: 1234 N 7864 W President Bld - Salt Lake City, UT 84105\u003Cbr /\u003EWeb: http://more-info-loretta.com\u003Cbr /\u003EDepartment: Sales\u003Cbr /\u003E\r\n\u003Cp class=\"lead-desc-separator\"\u003E--- Entrez une description ci-dessous ---\u003C/p\u003E\r\n\u003Cdiv\u003E\u0026nbsp;\u003C/div\u003E\r\n\u003Cbr /\u003E--- \u003Cbr /\u003E\r\n\u003Cp\u003EMet Natalia at a seminar. She could be interested.\u003Cbr /\u003EShe is on business trip. Have to call her when she is back.\u003C/p\u003E",
  "tags": ["small","US"],
  "created_from": "api",
  "created_by_id": 514,
  "user_id": 436,
  "client_folder_id": 12,
  "client_folder_name": "Blue Corp",
  "extended_info":
  {
    "first_contact_email": "natalia.bawer@loretta-inc.com",
    "all_contact_emails": ["natalia.bawer@loretta-inc.com"],
    "permalink": "https://YOUR_SLUG_HERE.nocrm.io/leads/8113",
    "fields":
    {
      "email": "natalia.bawer@loretta-inc.com",
      "phone": "801 274 6798",
      "mobile": "832 764 1930 ",
      "address": "1234 N 7864 W President Bld - Salt Lake City, UT 84105",
      "web": "http://more-info-loretta.com",
      "first_name": "Natalia",
      "last_name": "Bawer",
      "full_name": "Natalia Bawer",
      "job": "Sales",
      "fax": null,
      "vat": null
    },
    "fields_by_name":
    {
      "Firstname": "Natalia",
      "Lastname": "Bawer",
      "Full name": "Natalia Bawer",
      "Email": "natalia.bawer@loretta-inc.com",
      "Phone": "801 274 6798",
      "Mobile": "832 764 1930 ",
      "Address": "1234 N 7864 W President Bld - Salt Lake City, UT 84105",
      "Web": "http://more-info-loretta.com",
      "Department": "Sales"
    },
    "comment_count": 0,
    "bcc_count": 0,
    "user": 
    {
      "id": 436,
      "lastname": "Rose",
      "firstname": "Juliette",
      "email": "juliette@example.com"
    },
    "client_folder":
    {
      "id": 12,
      "name": "Blue Corp",
      "description": "",
      "is_active": true,
      "created_at": "2015-01-30T22:03:14.000Z"
    },
    "business_card_id": null,
    "visible_by_count": 1,
    "follow_ups": []
  }
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: client_id is required" }
{ "error": "422", "message": "Unable to perform your request" }

Add a lead to an existing client folder.

Http request

POST https://YOUR_SLUG_HERE.nocrm.io/api/leads/{id}/add_to_client

Parameters

Parameter Description
id required Lead’s id. The identifier of the lead.
client_id required Client folder’s id. The identifier of a client folder

Retrieve the business card of a lead

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113/business_card"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.delete "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113/business_card", header
bc = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -XDELETE "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113/business_card"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.delete "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113/business_card", header
bc = JSON.parse(response)

The above commands return JSON structured like this:

{
  "url": "https://ydncrm-attach.s3.amazonaws.com/dev-uploads/attachment/412/NY.jpg?X-Amz-Expires=180&X-Amz-Date=20160127T182551Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3MOBWMRZJZTNUNQ/20160127/us-east-1/s3/aws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=f382ddd16cd0afb87688bd5d8e543302244f36dc26b15fd1eb6d9ee06e64954b"
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Unable to perform your request" }

Retrieve the picture of a business card on a lead previously created by a business card.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/leads/{id}/business_card

Parameters

Parameter Description
id required Lead’s id. The identifier of the lead.

Delete a lead

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" -XDELETE "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.delete "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113", header
lead = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -XDELETE "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.delete "https://YOUR_SLUG_HERE.nocrm.io/api/leads/8113", header
lead = JSON.parse(response)

The above commands return JSON structured like this:

{
  "id": 8113
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: id is required" }
{ "error": "422", "message": "Unable to perform your request" }

Delete a lead previously created from its id.

Http request

DELETE https://YOUR_SLUG_HERE.nocrm.io/api/leads/{id}

Parameters

Parameter Description
id required Lead’s id. The identifier of the lead.

Delete multiple leads at once

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" -XDELETE --data "ids=8484,8485,8486" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/delete_multiple"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = { ids: "8484,8485,8486" }
response = RestClient.delete "https://YOUR_SLUG_HERE.nocrm.io/api/leads/delete_multiple", parameters, header
not_deleted_lead_ids = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -XDELETE --data "ids=8484,8485,8486" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/delete_multiple"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = { ids: "8484,8485,8486" }
response = RestClient.delete "https://YOUR_SLUG_HERE.nocrm.io/api/leads/delete_multiple", parameters, header
not_deleted_lead_ids = JSON.parse(response)

The above commands return JSON structured like this:

[ 8486 ]

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "422", "message": "Missing parameter: ids is required" }
{ "error": "422", "message": "Unable to perform your request" }

Delete multiple leads at once from their ids. It returns a list of lead ids that couldn’t be deleted: not existing anymore, no rights to delete,… This list will empty of course if all lead ids have been deleted.

Http request

DELETE https://YOUR_SLUG_HERE.nocrm.io/api/leads/delete_multiple

Parameters

Parameter Description
ids required Comma separated lead’s ids.

Retrieve all comments from a lead

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/comments"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/comments", header
comments = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/comments"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/comments", header
comments = JSON.parse(response)

The above commands return JSON structured like this:

[
  {
    "id": 13834,
    "content": "This is a comment",
    "commented_item":
    {
      "item": "Lead",
      "id": 9402
    },
    "created_at": "2015-08-12T21:57:40.000Z",
    "user":
    {
      "id": 514,
      "lastname": "Stone",
      "firstname": "Stéphanie",
      "email": "stef@youdontneedacrm.com"
    }
  },
  {
    "id": 13836,
    "content": "This is another comment",
    "commented_item":
    {
      "item": "Lead",
      "id": 9402
    },
    "created_at": "2015-08-15T10:57:40.000Z",
    "user":
    {
      "id": 514,
      "lastname": "Stone",
      "firstname": "Stéphanie",
      "email": "stef@youdontneedacrm.com"
    }
  }
]

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Unable to perform your request" }

Retrieve all comments of a lead.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/leads/{lead_id}/comments

Parameters

Parameter Default Description
lead_id required Lead’s id. The identifier of the lead.
direction optional desc Direction for ordereing the data returned in ascending or descending. The value should be asc or desc.

Create a comment on a lead

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" --data "content=This+is+wonderful&user_id=514" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/comments"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  content: "This is wonderful",
  user_id: 514
}
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/comments", parameters, header
comments = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" --data "content=This+is+wonderful" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/comments"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  content: "This is wonderful"
}
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/comments", parameters, header
comments = JSON.parse(response)

The above commands return JSON structured like this:

{
  "id": 13834,
  "content": "This is a wonderful",
  "commented_item":
  {
    "item": "Lead",
    "id": 9402
  },
  "created_at": "2015-08-20T21:57:40.000Z",
  "user":
  {
    "id": 514,
    "lastname": "Stone",
    "firstname": "Stéphanie",
    "email": "stef@youdontneedacrm.com"
  }
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "400", "message": "Parameter user_id should not be used with USER token." }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Unable to perform your request" }

Create a comment on a lead.

Http request

POST https://YOUR_SLUG_HERE.nocrm.io/api/leads/{lead_id}/comments

Parameters

Parameter Description
lead_id required Lead’s id. The identifier of the lead.
content required Content of the comment.
user_id optional User’s email address or id to whom the comment should belong. This parameter is ignored in case of the login method to authenticate is used. (USER token)

Delete a comment on a lead

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" -XDELETE "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/comments/13834"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.delete "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/comments/13834", header
comment = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -XDELETE "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/comments/13834"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.delete "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/comments/13834", header
comment = JSON.parse(response)

The above commands return JSON structured like this:

{
  "id": 13834
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "401", "message": "Unauthorized: the user has not the privileges to do this action." }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Unable to perform your request" }

Delete a comment on a lead.

Http request

DELETE https://YOUR_SLUG_HERE.nocrm.io/api/leads/{lead_id}/comments/{id}

Parameters

Parameter Description
lead_id required Lead’s id. The identifier of the lead.
id required Comment’s id. The identifier of the comment to delete.

Retrieve all attachments

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/attachments"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/attachments", header
attachments = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/attachments"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/attachments", header
attachments = JSON.parse(response)

The above commands return JSON structured like this:

[
    {
        "id": 422,
        "name": "You_Dont_Need_a_CRM.pdf",
        "url": "https://ydncrm-attach.s3.amazonaws.com/uploads/attachment/422/You_Dont_Need_a_CRM.pdf?X-Amz-Expires=180\u0026X-Amz-Date=20160630T224423Z\u0026X-Amz-Algorithm=AWS4-HMAC-SHA256",
        "content_type": "application/pdf",
        "kind": "attachment"
    },
    {
        "id": 15,
        "name": "0000004",
        "url": "https://mycompany.freshbooks.com/showEstimate?estimateid=34432",
        "content_type": null,
        "kind": "freshbooks_estimate"
    }
]

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "401", "message": "Unauthorized: the user has not the privileges to do this action." }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Unable to perform your request" }

Retrieve all attachments for the specified lead. It includes all the files that have been attached but also if you have an integration with Freshbooks, QuickBooks or Factomos, the estimate and invoices attached to the lead. To differenciate the different kind of attachments, the attribute kind will specify where the attachment is coming from.

The possible values are attachment, business_card, freshbooks_estimate, freshbooks_invoice, quickbooks_estimate, quickbooks_invoice, factomos_estimate, factomos_invoice, dropbox.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/leads/{lead_id}/attachments

Parameters

Parameter Description
lead_id required Lead’s id. The identifier of the lead.

Add an attachment on a lead

With the API key

curl -XPOST -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" -H "Content-Type: multipart/form-data" -F "attachment=@/path/to/your/file.txt" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/attachments"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
request = RestClient::Request.new(
          method: :post,
          url: 'https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/attachments',
          headers: {content_type: 'multipart/mixed', accept: 'application/json application/ydncrm.v2', 'X-API-KEY' => key},
          payload: {
            multipart: true,
            attachment: File.new("/path/to/your/file.txt", 'rb')
          })      
response = request.execute
attachment = JSON.parse(response)

With the USER token

curl -XPOST -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -H "Content-Type: multipart/form-data" -F "attachment=@/path/to/your/file.txt" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/attachments"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
request = RestClient::Request.new(
          method: :post,
          url: 'https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/attachments',
          headers: {content_type: 'multipart/mixed', accept: 'application/json application/ydncrm.v2', 'X-USER-TOKEN' => token},
          payload: {
            multipart: true,
            attachment: File.new("/path/to/your/file.txt", 'rb')
          })      
response = request.execute
attachment = JSON.parse(response)

The above commands return JSON structured like this:

{
  "id": 423,
  "name": "file.txt",
  "url": "https://ydncrm-attach.s3.amazonaws.com/uploads/attachment/422/file.txt?X-Amz-Expires=180\u0026X-Amz-Date=20160630T224423Z\u0026X-Amz-Algorithm=AWS4-HMAC-SHA256",
  "content_type": "text/plain",
  "kind": "attachment"
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Unable to perform your request" }

Create an attachment for the specified lead from the uploaded file.

Http request

POST https://YOUR_SLUG_HERE.nocrm.io/api/leads/{lead_id}/attachments

Parameters

Parameter Description
lead_id required Lead’s id. The identifier of the lead.
attachment required The information of the uploaded file

Delete an attachment on a lead

With the API key

curl -XDELETE -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/attachments/520"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.delete "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/attachments/520", header
attachment = JSON.parse(response)

With the USER token

curl -XDELETE -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/attachments/520"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.delete "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9402/attachments/520", header
attachment = JSON.parse(response)

The above commands return JSON structured like this:

{
  "id": 520
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Unable to perform your request" }

Delete an attachment for the specified lead from the uploaded file.

Http request

DELETE https://YOUR_SLUG_HERE.nocrm.io/api/leads/{lead_id}/attachments/{id}

Parameters

Parameter Description
lead_id required Lead’s id. The identifier of the lead.
id required Attachment’s id. The identifier of the attachment on the lead.

List the action histories on a lead

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" -XGET "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9344/action_histories" 
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9344/action_histories", header
action_histories = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -XGET "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9344/action_histories" 
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/leads/9344/action_histories", header
action_histories = JSON.parse(response)

The above commands return JSON structure like this:

[
  {
    "id": 39728,
    "lead_id": 9344,
    "action_type": "lead_created",
    "action_item": 
    {
      "type": "lead_created", 
      "id": 9344
    },
    "created_at": "2015-04-22T22:53:08.000Z",
    "user": 
    {
      "id": 625,
      "lastname": "Stone",
      "firstname": "Stephanie",
      "email": "stef@youdontneedacrm.com"
    }
  },
  {
    "id": 39729,
    "lead_id": 9344,
    "action_type": "amount_set",
    "action_item": 
    {
      "type": "amount_set",
      "id": 1402,
      "amount": 2600.0,
      "probability": 60,
      "currency": "USD"
    },
    "created_at": "2015-04-22T22:54:51.000Z",
    "user": 
    {
      "id": 625,
      "lastname": "Stone",
      "firstname": "Stephanie",
      "email": "stef@youdontneedacrm.com"
    }
  },
  {
    "id": 39730,
    "lead_id": 9344,
    "action_type": "comment_added",
    "action_item": 
    {
      "type": "comment_added", 
      "id": 13747
    },
    "created_at": "2015-04-22T22:55:33.000Z",
    "user": 
    {
      "id": 625,
      "lastname": "Stone",
      "firstname": "Stephanie",
      "email": "stef@youdontneedacrm.com"
    }
  },
  {
    "id": 39731,
    "lead_id": 9344,
    "action_type": "email_sent",
    "action_item": 
    {
      "type": "email_sent", 
      "id": 46
    },
    "created_at": "2015-04-22T23:02:13.000Z",
    "user": 
    {
      "id": 625,
      "lastname": "Stone",
      "firstname": "Stephanie",
      "email": "stef@youdontneedacrm.com"
    }
  },
  {
    "id": 39732,
    "lead_id": 9344,
    "action_type": "step_changed",
    "action_item": 
    {
      "type": "step_changed", 
      "id": 1190, 
      "name": "In-touch", 
      "position": 2
    },
    "created_at": "2015-04-22T23:02:43.000Z",
    "user": 
    {
      "id": 625,
      "lastname": "Stone",
      "firstname": "Stephanie",
      "email": "stef@youdontneedacrm.com"
    }
  },
  {
    "id": 39733,
    "lead_id": 9344,
    "action_type": "user_assigned",
    "action_item": 
    {
      "type": "user_assigned",
      "id": 626,
      "firstname": "Jean",
      "lastname": "Doe",
      "email": "jean@doe.com"
    },
    "created_at": "2015-04-22T23:03:04.000Z",
    "user": 
    {
      "id": 625,
      "lastname": "Stone",
      "firstname": "Stephanie",
      "email": "stef@youdontneedacrm.com"
    }
  },
  {
    "id": 39734,
    "lead_id": 9344,
    "action_type": "amount_set",
    "action_item": 
    {
      "type": "amount_set",
      "id": 1403,
      "amount": 2600.0,
      "probability": 100,
      "currency": "USD"
    },
    "created_at": "2015-04-22T23:03:52.000Z",
    "user": 
    {
      "id": 626,
      "lastname": "Doe",
      "firstname": "Jean",
      "email": "jean@doe.com"
    }
  },
  {
    "id": 39735,
    "lead_id": 9344,
    "action_type": "status_changed",
    "action_item": 
    {
      "type": "status_changed", 
      "id": 3, 
      "name": "won"
    },
    "created_at": "2015-04-22T23:03:52.000Z",
    "user": 
    {
      "id": 626,
      "lastname": "Doe",
      "firstname": "Jean",
      "email": "jean@doe.com"
    }
  },
  {
    "id": 39736,
    "lead_id": 9344,
    "action_type": "client_assigned",
    "action_item": 
    {
      "type": "client_assigned", 
      "id": 15, 
      "name": "Series"
    },
    "created_at": "2015-04-22T23:04:09.000Z",
    "user": 
    {
      "id": 626,
      "lastname": "Doe",
      "firstname": "Jean",
      "email": "jean@doe.com"
    }
  }
]

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Unable to perform your request" }

Retrieve the action histories of a lead depending on the filter you entered.

The action histories are returned by bulk. The number of items returned can be defined by a parameter but cannot exceed 100 items.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/leads/{lead_id}/action_histories

Parameters

Parameter Default Description
from optional Start date to retrieve the action histories.
to optional End date to retrieve the action histories. If used with the from parameter, action histories are retrieved in the date range. If used alone, all the action histories are retrieved until this date.
action_type optional Filter on the action’s type that triggered the entry in the history. Could be one of these values: client_assigned, step_changed, status_changed, amount_set, user_assigned, lead_created, comment_added, email_sent.
action_value optional Filter on the value of two specifics action’s types: step_changed and status_changed. The available status_changed values are: todo, standby, won, lost, cancelled. If the step or status value is not recognized (typo, deletion), the filter is ignored.
user_ids optional Filter on the users who made the actions. Comma-separated list of user ids or user emails.
direction optional asc Return data order by their id in ascending or descending. The value should be asc or desc.
limit optional 100 Number of data returned. Value should be between 1 and 100.

Prospecting lists

Create a prospecting list

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8"  -H "Content-Type: application/json" -d '{"title":"ProspectV2","content":[["Company name","Firstname","Lastname","Email","Phone"],["Acme Corp","John","Doe","john.doe@acme.com","654 234 7623"],["EuropaCorp","Luc","Besson","luc.besson@europacorp.com","555 333 5678"]],"description":"This prospect comes from Peter","tags":["prospect","peter"],"user_id":"stef@youdontneedacrm.com"}' "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  title: "Prospect",
  content: "[[\"Company name\",\"Firstname\",\"Lastname\",\"Email\",\"Phone\"],[\"Acme Corp\",\"John\",\"Doe\",\"john.doe@acme.com\",\"654 234 7623\"],[\"EuropaCorp\",\"Luc\",\"Besson\",\"luc.besson@europacorp.com\",\"555 333 5678\"]]",
  description: "This prospect comes from Peter",
  tags: ["prospect","peter"],
  user_id: 'stef@youdontneedacrm.com'
}
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets", parameters, header
spreadsheet = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg"  -H "Content-Type: application/json" -d '{"title":"ProspectV2","content":[["Company name","Firstname","Lastname","Email","Phone"],["Acme Corp","John","Doe","john.doe@acme.com","654 234 7623"],["EuropaCorp","Luc","Besson","luc.besson@europacorp.com","555 333 5678"]],"description":"This prospect comes from Peter","tags":["prospect","peter"]}' "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  title: "Prospect",
  content: "[[\"Company name\",\"Firstname\",\"Lastname\",\"Email\",\"Phone\"],[\"Acme Corp\",\"John\",\"Doe\",\"john.doe@acme.com\",\"654 234 7623\"],[\"EuropaCorp\",\"Luc\",\"Besson\",\"luc.besson@europacorp.com\",\"555 333 5678\"]]",
  description: "This prospect comes from Peter",
  tags: ["prospect","peter"]
}
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets", parameters, header
spreadsheet = JSON.parse(response)

The above commands return JSON structure like this:

{ 
  "id": 112,
  "title": "Prospect",
  "description": "This prospect comes from Peter",
  "privacy": 1,
  "updated_at": "2014-11-07T17:31:04.000Z",
  "created_at": "2014-11-07T17:31:04.000Z",
  "tags": ["peter", "prospect"],
  "permalink": "https://YOUR_SLUG_HERE.nocrm.io/spreadsheets/112",
  "user": 
  {
    "id": 514,
    "lastname": "Stone",
    "firstname": "Stéphanie",
    "email": "stef@youdontneedacrm.com"
  },
  "spreadsheet_rows":
  [
    { "id": 107, "lead_id": 15, "is_active": true, "content": ["Company name","Firstname","Lastname","Email","Phone"] },
    { "id": 108, "lead_id": null, "is_active": true, "content": ["Acme Corp","John","Doe","john.doe@acme.com","654 234 7623"] },
    { "id": 109, "lead_id": null, "is_active": true, "content": ["EuropaCorp","Luc","Besson","luc.besson@europacorp.com","555 333 5678"] }
  ]
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "422", "message": "Missing parameter: title is required" }
{ "error": "422", "message": "Missing parameter: content is required" }
{ "error": "422", "message": "Unable to perform your request" }

To create a new prospecting list, you have to pass the required parameters.

With the required parameters the prospecting list will be created and will belong to:

When using the API key authentication, if no user is set or if it does not correspond to any user in the account, the prospecting list will belong to the first administrator of the account.

When using the USER token authentication, the user_id parameter is ignored.

By default the privacy of the prospecting list is computed automatically according to the settings of the account. However, it is possible to set the privacy of the prospecting list to be shared with everyone in the account. In this case just pass off for the privacy.

Http request

POST https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets

Parameters

Parameter Default Description
title required Prospecting file’s title. It could be the origin of the prospecting file.
content required Content of the prospecting file as a json string from the array of array of data. The first row should be the column header.
description optional Prospecting file’s description.
tags optional An array of tags describing the prospecting file. If the tags don’t exist they are automatically created. The tags could also include the Predefined tags of your account.
user_id optional Email address or id of the user owner of the prospecting_file. Required parameter if a privacy is set and API key authentication.
privacy optional default If privacy is set to ’off’ the prospecting list will be shared with everyone on the account. Otherwise the privacy is computed automatically wiuth the settings of the account and the user used to create the list.

Retrieve a prospecting list

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/112"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/112", header
spreadsheet = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/112"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/112", header
spreadsheet = JSON.parse(response)

The above commands return JSON structured like this:

{
  "id": 112,
  "title": "Prospect",
  "description": "This prospect comes from Peter",
  "privacy": 1,
  "updated_at": "2014-11-07T17:31:04.000Z",
  "created_at": "2014-11-07T17:31:04.000Z",
  "tags": ["peter", "prospect"],
  "permalink": "https://YOUR_SLUG_HERE.nocrm.io/spreadsheets/112",
  "user": 
  {
    "id": 514,
    "lastname": "Stone",
    "firstname": "Stéphanie",
    "email": "stef@youdontneedacrm.com"
  },
  "spreadsheet_rows":
  [
    { "id": 107, "lead_id": 15, "is_active": true, "content": ["Company name","Firstname","Lastname","Email","Phone"] },
    { "id": 108, "lead_id": null, "is_active": true, "content": ["Acme Corp","John","Doe","john.doe@acme.com","654 234 7623"] },
    { "id": 109, "lead_id": null, "is_active": true, "content": ["EuropaCorp","Luc","Besson","luc.besson@europacorp.com","555 333 5678"] }
  ]
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: id is required" }
{ "error": "422", "message": "Unable to perform your request" }

Retrieve a prospecting list previously created with its id.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/{id}

Parameters

Parameter Description
id required Prospecting list’s identifier.

Add prospects to a prospecting list

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" -H "Content-Type: application/json" -d '[["Green Corp","Julia","Green","julia.green@example.com","345 234 7777"],["Red Corp","John","Red","red.john@example.com","222 333 5555"]]' "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/112/rows"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  content: "[[\"Green Corp\",\"Julia\",\"Green\",\"julia.green@example.com\",\"345 234 7777\"],[\"Red Corp\",\"John\",\"Red\",\"red.john@example.com\",\"222 333 5555\"]]"
}
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/112/rows", parameters, header
spreadsheet_rows = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -H "Content-Type: application/json" -d '[["Green Corp","Julia","Green","julia.green@example.com","345 234 7777"],["Red Corp","John","Red","red.john@example.com","222 333 5555"]]' "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/112/rows"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  content: "[[\"Green Corp\",\"Julia\",\"Green\",\"julia.green@example.com\",\"345 234 7777\"],[\"Red Corp\",\"John\",\"Red\",\"red.john@example.com\",\"222 333 5555\"]]"
}
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/112/rows", parameters, header
spreadsheet_rows = JSON.parse(response)

The above commands return JSON structured like this:

[
  {
    "id": 115, 
    "lead_id": null, 
    "is_active": true, 
    "content": ["Green Corp","Julia","Green","julia.green@example.com","345 234 7777"]
  },
  {
    "id": 116, 
    "lead_id": null, 
    "is_active": true, 
    "content": ["Red Corp","John","Red","red.john@example.com","222 333 5555"]
  }
]

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "400", "message": "The number of data in content doesn't match the number of columns in the prospecting list" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: [id | spreadsheet_id | content] is required" }
{ "error": "422", "message": "Unable to perform your request" }

Add the prospects (new rows) at the end of the specified prospecting list.

Http request

POST https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/{spreadsheet_id}/rows

Parameters

Parameter Default Description
spreadsheet_id required Prospecting list’s identifier.
content required Content of the prospects as a json string corresponding of an array of an array of data.

Update a prospect in a prospecting list

With the API key

curl -XPUT -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" -H "Content-Type: application/json" -d '["Green Corp","Julia","Green","julia.green@example.com","345 234 1111"]' "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/112/rows/115"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  content: "[\"Green Corp\",\"Julia\",\"Green\",\"julia.green@example.com\",\"345 234 1111\"]"
}
response = RestClient.put "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/112/rows/115", parameters, header
spreadsheet_row = JSON.parse(response)

With the USER token

curl -XPUT -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -H "Content-Type: application/json" -d '["Green Corp","Julia","Green","julia.green@example.com","345 234 1111"]' "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/112/rows/115"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  content: "[\"Green Corp\",\"Julia\",\"Green\",\"julia.green@example.com\",\"345 234 1111\"]"
}
response = RestClient.put "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/112/rows/115", parameters, header
spreadsheet_row = JSON.parse(response)

The above commands return JSON structured like this:

{
  "id": 115, 
  "lead_id": null, 
  "is_active": true, 
  "content": ["Green Corp","Julia","Green","julia.green@example.com","345 234 1111"]
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "400", "message": "The number of data in content doesn't match the number of columns in the prospecting list" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: [id | spreadsheet_id | content] is required" }
{ "error": "422", "message": "Unable to perform your request" }

Update a prospect in a prospecting list.

Http request

PUT https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/{spreadsheet_id}/rows/{id}

Parameters

Parameter Default Description
spreadsheet_id required Prospecting list’s identifier.
id required Prospect’s identifier.
content required Content of the prospect as a json string corresponding of an array of data.

Delete a prospect in a prospecting list

With the API key

curl -XDELETE -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/112/rows/115"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.delete "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/112/rows/115", header
spreadsheet_row = JSON.parse(response)

With the USER token

curl -XDELETE -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/112/rows/115"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.put "https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/112/rows/115", header
spreadsheet_row = JSON.parse(response)

The above commands return JSON structured like this:

{ 
  "id": 115
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: [id | spreadsheet_id] is required" }
{ "error": "422", "message": "Unable to perform your request" }

Delete a prospect in a prospecting list.

Http request

DELETE https://YOUR_SLUG_HERE.nocrm.io/api/spreadsheets/{spreadsheet_id}/rows/{id}

Parameters

Parameter Default Description
spreadsheet_id required Prospecting list’s identifier.
id required Prospect’s identifier.

Users

List all the users

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/users"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/users", header
users = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/users"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/users", header
users = JSON.parse(response)

The above commands return JSON structure like this:

[
  {
    "id": 514,
    "lastname": "Doe",
    "firstname": "John",
    "email": "john.doe@mycompany.com",
    "updated_at": "2014-02-19T16:58:43.000Z",
    "created_at": "2014-02-11T22:41:26.000Z",
    "is_admin": true,
    "has_activated": true,
    "is_disabled": false,
    "locale": "en",
    "time_zone": "America/Denver",
    "permalink": "https://YOUR_SLUG_HERE.nocrm.io/users/514"
  },
  {
    "id": 515,
    "lastname": "Support",
    "firstname": "",
    "email": "support@mycompany.com",
    "updated_at": "2014-02-20T16:58:43.000Z",
    "created_at": "2014-02-20T22:41:26.000Z",
    "is_admin": false,
    "has_activated": true,
    "is_disabled": false,
    "locale": "en",
    "time_zone": "Europe/Paris",
    "permalink": "https://YOUR_SLUG_HERE.nocrm.io/users/515"
  }
]

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "422", "message": "Unable to perform your request" }

Retrieve all the users created in the account. The deleted users are retrieved too. Their state, is_disabled, is set to true in their case.

The users could be in different state.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/users

Create a user

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" --data "lastname=Einstein&firstname=Albert&email=albert.einstein@genius.com&is_admin=true" "https://YOUR_SLUG_HERE.nocrm.io/api/users"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  lastname: "Einstein",
  firstname: "Albert",
  email: "albert.einstein@genius.com",
  is_admin: "true"
}
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/users", parameters, header
user = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" --data "lastname=Einstein&firstname=Albert&email=albert.einstein@genius.com&is_admin=true" "https://YOUR_SLUG_HERE.nocrm.io/api/users"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  lastname: "Einstein",
  firstname: "Albert",
  email: "albert.einstein@genius.com",
  is_admin: "true"
}
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/users", parameters, header
user = JSON.parse(response)

The above commands return JSON structure like this:

{
  "id": 639,
  "lastname": "Einstein",
  "firstname": "Albert",
  "email": "albert.einstein@genius.com",
  "updated_at": "2015-07-22T16:58:43.000Z",
  "created_at": "2015-07-22T16:58:43.000Z",
  "is_admin": true,
  "has_activated": false,
  "is_disabled": false,
  "locale": "en",
  "time_zone": "America/Denver",
  "permalink": "https://YOUR_SLUG_HERE.nocrm.io/users/639"
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "401", "message": "Unauthorized: the user has not the privileges to do this action." }
{ "error": "422", "message": "Missing parameter: [lastname | firstname | email] is required"}
{ "error": "422", "message": "Unable to perform your request" }

Create a user with the specified information of lastname, firstname and email.

By default, the activation email is not sent to the user. If the user has to receive the email when he/she is created, the option dont_send_email has to be specified to false.

When using the USER token, if the user logged is not an administrator of the account, he/she won’t be allowed to create a user.

Http request

POST https://YOUR_SLUG_HERE.nocrm.io/api/users

Parameters

Parameter Default Description
email required The email of the user
lastname optional The lastname of the user
firstname optional The firstname of the user
is_admin optional false true if the user should be administrator of the account.
dont_send_email optional true false if the user has to receive his/her activation email when he/she is created.

Retrieve a user

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/users/514"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/users/514",  header
user = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/users/514"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/users/514",  header
user = JSON.parse(response)

The above commands return JSON structure like this:

{
  "id": 514,
  "lastname": "Doe",
  "firstname": "John",
  "email": "john.doe@mycompany.com",
  "updated_at": "2014-02-19T16:58:43.000Z",
  "created_at": "2014-02-11T22:41:26.000Z",
  "is_admin": true,
  "has_activated": true,
  "is_disabled": false,
  "locale": "en",
  "time_zone": "America/Denver",
  "permalink": "https://YOUR_SLUG_HERE.nocrm.io/users/514"
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: id is required"}
{ "error": "422", "message": "Unable to perform your request" }

Retrieve a specific user from its id.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/users/{id}

Parameters

Parameter Description
id required The id of the user or its email address. Make sure to encode the email address properly.

Send the activation email

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/users/639/send_activation_email"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/users/1234/send_activation_email",  header

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/users/639/send_activation_email"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/users/1234/send_activation_email",  header

The above commands return nothing with the following statuses

status 200: email sent to the user
status 304: the user is already activated, the email has not been sent

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "401", "message": "Unauthorized: the user has not the privileges to do this action." }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: id is required"}
{ "error": "422", "message": "Unable to perform your request" }

Send the activation email of the specific user in order for him/her to access the account.

When using the USER authentication, only admin users can send the activation email.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/users/{id}/send_activation_email

Parameters

Parameter Description
id required The id of the user

Disable a user

With the API key

curl -XPUT -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/users/639/disable"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.put "https://YOUR_SLUG_HERE.nocrm.io/api/users/639/disable",  header

With the USER token

curl -XPUT -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/users/639/disable"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.put "https://YOUR_SLUG_HERE.nocrm.io/api/users/639/disable",  header

The above commands return JSON structure like this:

{
  "id": 639,
  "lastname": "Einstein",
  "firstname": "Albert",
  "email": "albert.einstein@genius.com",
  "updated_at": "2015-07-22T16:58:43.000Z",
  "created_at": "2015-07-22T16:58:43.000Z",
  "is_admin": true,
  "has_activated": true,
  "is_disabled": true,
  "locale": "en",
  "permalink": "https://YOUR_SLUG_HERE.nocrm.io/users/1234"
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "401", "message": "Unauthorized: the user has not the privileges to do this action." }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: id is required"}
{ "error": "422", "message": "Unable to perform your request" }

Disable the specific user from the account. The user won’t be able to connect anymore to the account.

No data will be lost.

Note: Even after disabling the user, a new user with the same email address cannot be created. The support has to be contacted to re-enable the disabled user.

When using the USER authentication, only admin users can disable a user.

Http request

PUT https://YOUR_SLUG_HERE.nocrm.io/api/users/{id}/disable

Parameters

Parameter Description
id required The id of the user

Teams

List all the teams

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/teams"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/teams", header
teams = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/teams"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/teams", header
teams = JSON.parse(response)

The above commands return JSON structure like this:

[
  {
    "id": 514,
    "name": "Web Sales",
    "users": [
      {
        "id": 514,
        "lastname": "Stone",
        "firstname": "Stéphanie",
        "email": "stef@youdontneedacrm.com",
        "is_manager": true
      },
      {
        "id": 518,
        "lastname": "Doe",
        "firstname": "John",
        "email": "john@youdontneedacrm.com",
        "is_manager": false
      }
    ],
    "updated_at": "2014-02-19T16:58:43.000Z",
    "created_at": "2014-02-11T22:41:26.000Z"
  },
  {
    "id": 517,
    "name": "Web Sales",
    "users": [
      {
        "id": 524,
        "lastname": "Jane",
        "firstname": "Cheryl",
        "email": "cheryl@example.com",
        "is_manager": true
      },
      {
        "id": 525,
        "lastname": "Doe",
        "firstname": "Albert",
        "email": "albert@example.com",
        "is_manager": false
      }
    ],
    "updated_at": "2014-02-19T16:58:43.000Z",
    "created_at": "2014-02-11T22:41:26.000Z"
  }
]

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "401", "message": "Unauthorized: the user has not the privileges to do this action." }
{ "error": "403", "message": "Cannot access this feature." }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Unable to perform your request" }

List all the teams created in the account.

When using the USER TOKEN authentication, only admin users can list all the teams.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/teams

Create a team

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" -H "Content-Type: application/json" -d '{"name":"Web Sales"}' "https://YOUR_SLUG_HERE.nocrm.io/api/teams"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  name: "Web Sales"
}
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/teams", parameters, header
team = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -H "Content-Type: application/json" -d '{"name":"Web Sales"} "https://YOUR_SLUG_HERE.nocrm.io/api/teams"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  name: "Web Sales"
}
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/teams", parameters, header
team = JSON.parse(response)

The above commands return JSON structure like this:

{
  "id": 15,
  "name": "Web Sales",
  "users": [],
  "updated_at": "2015-07-22T16:58:43.000Z",
  "created_at": "2015-07-22T16:58:43.000Z"
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "401", "message": "Unauthorized: the user has not the privileges to do this action." }
{ "error": "403", "message": "Cannot access this feature." }
{ "error": "422", "message": "Missing parameter: name is required"}
{ "error": "422", "message": "Unable to perform your request" }

Create a team with the specified name.

When using the USER TOKEN authentication, only admin users can create a team.

Http request

POST https://YOUR_SLUG_HERE.nocrm.io/api/teams

Parameters

Parameter Description
name required The name of the team

Retrieve a team

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15",  header
team = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15",  header
team = JSON.parse(response)

The above commands return JSON structure like this:

{
  "id": 15,
  "name": "Web Sales",
  "users": [
    {
      "id": 524,
      "lastname": "Jane",
      "firstname": "Cheryl",
      "email": "cheryl@example.com",
      "is_manager": true
    },
    {
      "id": 525,
      "lastname": "Doe",
      "firstname": "Albert",
      "email": "albert@example.com",
      "is_manager": false
    }
  ],
  "updated_at": "2015-07-22T16:58:43.000Z",
  "created_at": "2015-07-22T16:58:43.000Z"
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "401", "message": "Unauthorized: the user has not the privileges to do this action." }
{ "error": "403", "message": "Cannot access this feature." }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: id is required"}
{ "error": "422", "message": "Unable to perform your request" }

Retrieve a specific team from its id.

When using the USER TOKEN authentication, only admin users can retrieve a team.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/teams/{id}

Parameters

Parameter Description
id required The id or name of the team to retrieve.

Update a team

With the API key

curl -XPUT -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" -H "Content-Type: application/json" -d '{"name":"My new team name"}' "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  name: "My new team name"
}
response = RestClient.put "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15", parameters, header
team = JSON.parse(response)

With the USER token

curl -XPUT -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -H "Content-Type: application/json" -d '{"name":"My new team name"}' "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  name: "my new team name"
}
response = RestClient.put "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15", parameters, header

The above commands return JSON structure like this:

{
  "id": 15,
  "name": "My new team name",
  "users": [
    {
      "id": 524,
      "lastname": "Jane",
      "firstname": "Cheryl",
      "email": "cheryl@example.com",
      "is_manager": true
    },
    {
      "id": 525,
      "lastname": "Doe",
      "firstname": "Albert",
      "email": "albert@example.com",
      "is_manager": false
    }
  ],
  "updated_at": "2015-07-22T16:58:43.000Z",
  "created_at": "2015-07-22T16:58:43.000Z"
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "401", "message": "Unauthorized: the user has not the privileges to do this action." }
{ "error": "403", "message": "Cannot access this feature." }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: [id | name] is required"}
{ "error": "422", "message": "Unable to perform your request" }

Update the team by updating its name.

When using the USER TOKEN authentication, only admin users can update a team.

Http request

PUT https://YOUR_SLUG_HERE.nocrm.io/api/teams/{id}

Parameters

Parameter Description
id required The id of the team
name required The new team’s name

Delete a team

With the API key

curl -XDELETE -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.delete "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15",  header

With the USER token

curl -XDELETE -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.delete "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15",  header

The above commands return JSON structure like this:

{
  "id": 15
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "401", "message": "Unauthorized: the user has not the privileges to do this action." }
{ "error": "403", "message": "Cannot access this feature." }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: id is required"}
{ "error": "422", "message": "Unable to perform your request" }

Delete the team specified by its id.

When using the USER TOKEN authentication, only admin users can delete a team.

Http request

DELETE https://YOUR_SLUG_HERE.nocrm.io/api/teams/{id}

Parameters

Parameter Description
id required The id of the team

Add a team member

With the API key

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" -H "Content-Type: application/json" -d '{"user_id":514,"is_manager":true}' "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15/add_member"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  user_id: 514,
  is_manager: true
}
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15/add_member", parameters, header
team = JSON.parse(response)

With the USER token

curl -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -H "Content-Type: application/json" -d '{"user_id":514,"is_manager":true}' "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15/add_member"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameter = {
  user_id: 514,
  is_manager: true
}
response = RestClient.post "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15/add_member", parameters, header
team = JSON.parse(response)

The above commands return JSON structure like this:

{
  "id": 15,
  "users": [
    {
      "id": 524,
      "lastname": "Jane",
      "firstname": "Cheryl",
      "email": "cheryl@example.com",
      "is_manager": true
    }
  ],
  "updated_at": "2016-04-07T16:58:43.000Z",
  "created_at": "2015-07-22T16:58:43.000Z"
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "401", "message": "Unauthorized: the user has not the privileges to do this action." }
{ "error": "403", "message": "Cannot access this feature." }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: [id | user_id] is required"}
{ "error": "422", "message": "Unable to perform your request" }

Add a team member or change the manager role for the specified user.

When using the USER TOKEN authentication, only admin users can add a member to a team.

Http request

POST https://YOUR_SLUG_HERE.nocrm.io/api/teams/{id}/add_member

Parameters

Parameter Default Description
id required The id of the team
user_id required User’s email address or id to add.
is_manager optional false True if the user should be manager of the team.

Remove a team member

With the API key

curl -XDELETE -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" -H "Content-Type: application/json" -d '{"user_id":514}' "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15/remove_member"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameters = {
  user_id: 514
}
response = RestClient.delete "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15/remove_member", parameters, header
team = JSON.parse(response)

With the USER token

curl -XDELETE -H "Accept: application/ydncrm.v2" -H "X-USER-TOKEN: ITd-Jb3EC_nCXI2fez4hhg" -H "Content-Type: application/json" -d '{"user_id":514}' "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15/remove_member"
require 'rest-client'

token = "ITd-Jb3EC_nCXI2fez4hhg"
header = { 'X-USER-TOKEN' => token, content_type: :json, accept: "application/json application/ydncrm.v2" }
parameter = {
  user_id: 514
}
response = RestClient.delete "https://YOUR_SLUG_HERE.nocrm.io/api/teams/15/remove_member", parameters, header
team = JSON.parse(response)

The above commands return JSON structure like this:

{
  "id": 15,
  "users": [],
  "updated_at": "2016-04-07T16:58:43.000Z",
  "created_at": "2015-07-22T16:58:43.000Z"
}

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "401", "message": "Unauthorized: the user has not the privileges to do this action." }
{ "error": "403", "message": "Cannot access this feature." }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: [id | user_id] is required"}
{ "error": "422", "message": "Unable to perform your request" }

Remove a team member.

When using the USER TOKEN authentication, only admin users can remove a member from a team.

Http request

DELETE https://YOUR_SLUG_HERE.nocrm.io/api/teams/{id}/remove_member

Parameters

Parameter Default Description
id required The id of the team
user_id required User’s email address or id to remove.

Webhook Events

The Webhooks are a way to link our application with a third party API. Instead of getting leads in order to find out which lead has changed, we can directly notify you by a POST request to an URL you registered earlier. When the event happens, we will send you the request with the object and you can process it for your need. It is easy and efficient by this way.

Note: With webhooks, you need an API and some development to process the events we sent. If you don’t have all of this, you still have a way to be notified when an event occurs. From your account, we also implemented Notifications. The principle is the same as webhook as you can subscribe to certain events but this time you enter an email address. When the event is triggered we directly send you the information by email and someone can processed it. No need any development or an API, we just send you an email as notification.

To define a webhook, you have to setup it up from the admin section of your account. You can subscribe to certain events.

When you create a webhook in the administration section of your account, you will have to give us an url where you want to reveice the notifications. In this case you will need to develop on your side something to process the data received.

Then to complete the creation of the webhook, we will need one of your generated api key to use to sign the request. When the webhook is created in the application, each time an action happens corresponding to the event subscribed, we will send you a notification, a webhook event.

No need to send plenty of requests in order to check the status, we will send you the notification directly to your API when something changed.

Note: when creating the webhook we ask for one of your generated api key. Remember that we will never send you this key in any notification. This key is needed in our side to sign the request and in your side to check the signature of the request and make sure we are the owner of the request. Never communicate your private key to anyone.

When one of the subscribed event happened on your account, we trigger a notification and send you a Webhook Event. The notification is sent either by email or by a POST request to the url given depending on the option chosen when creating the webhook. For example when a lead is won we can send a notification so you can start the billing process.

The webhook event we send you is composed of the following elements:

Note: From our API you can retrieve the events that have been sent. To manage the webhooks (creation, deletion, modification), you have to go to your account.

Type of events

Event Description
lead.creation Trigger when a lead is created. Return the created lead.
lead.status.changed Trigger when the status of the lead changed. It could be any status change. Return the lead modified.
lead.status.changed.to.todo Trigger when the status of the lead changed to to-do. Return the lead modified.
lead.status.changed.to.standby Trigger when the status of the lead changed to standby. Return the lead modified.
lead.status.changed.to.won Trigger when the status of the lead changed to won. Return the lead modified.
lead.status.changed.to.lost Trigger when the status of the lead changed to lost. Return the lead modified.
lead.status.changed.to.cancelled Trigger when the status of the lead changed to cancelled. Return the lead modified.

List all webhook events

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/webhook_events"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/webhook_events", header
events = JSON.parse(response)

The above commands return JSON structure like this:

[
  {
    "id": 984,
    "event": "lead.status.changed.to.won",
    "signature": "5ae43881a5132de2c65cf2cb0e33c23daf25916a",
    "data":
    {
      "id": 9331,
      "title": "Bountiful",
      "description": "Firstname: Elizabeth\u003Cbr /\u003ELastname: Swan\u003Cbr /\u003EFull name: Elizabeth Swan\u003Cbr /\u003EEmail: e.swan@bountiful.corp\u003Cbr /\u003EMobile: +1 801 563 9999",
      "text_description": "Firstname: Elizabeth\nLastname: Swan\nFull name: Elizabeth Swan\nEmail: e.swan@bountiful.corp\nMobile: +1 801 563 9999",
      "amount": 1500.0,
      "currency": "USD",
      "probability": 100,
      "reminder_at": null,
      "updated_at": "2015-03-05T21:36:04.000Z",
      "created_at": "2015-03-05T21:34:10.000Z",
      "starred": true,
      "status": "Won",
      "step": "Incoming",
      "tags": ["prospect","test"],
      "contact_email": "e.swan@bountiful.corp",
      "first_contact_email": "e.swan@bountiful.corp",
      "all_contact_emails": ["e.swan@bountiful.corp"],
      "permalink": "https://YOUR_SLUG_HERE.nocrm.io/leads/9331",
      "fields":
      {
        "email": "e.swan@bountiful.corp",
        "phone": null,
        "mobile": "+1 801 563 9999",
        "address": null,
        "web": null,
        "first_name": "Elizabeth",
        "last_name": "Swan",
        "full_name": "Elizabeth Swan",
        "job": null,
        "fax": null,
        "vat": null
      },
      "user":
      {
        "id": 514,
        "lastname": "Stone",
        "firstname": "Stéphanie",
        "email": "stef@youdontneedacrm.com"
      },
      "client_folder": null
    }
  },
  {
    "id": 3,
    "event": "lead.creation",
    "signature": "9a046b0f8c6b3820d7fef781e65f7a11c86e7041",
    "data": 
    {
      "id": 8115,
      "title": "RED",
      "description": "Firstname: John<br />Lastname: Doe<br />Email: john@red.com<br />Phone: +1 870 538 2086<br />\r\n---\r\n<p>Some description of the company.</p>",
      "text_description": "Firstname: John\nLastname: Doe\nEmail: john@red.com\nPhone: +1 870 538 2086\n---\nSome description of the company.",
      "amount": 3000.0,
      "currency": "USD",
      "probability": 40,
      "reminder_at": null,
      "updated_at": "2014-03-04T17:28:27.000Z",
      "created_at": "2014-03-04T17:28:27.000Z",
      "starred": null,
      "status": "Todo",
      "step": "Incoming",
      "tags": ["series", "rse"],
      "first_contact_email": "john@red.com",
      "all_contact_emails": ["john@red.com"],
      "permalink": "https://YOUR_SLUG_HERE.nocrm.io/leads/8115",
      "fields":
      {
        "email": "john@red.com",
        "phone": "+1 870 538 2086",
        "mobile": null,
        "address": null,
        "web": null,
        "first_name": "John",
        "last_name": "Doe",
        "full_name": null,
        "job": null,
        "fax": null,
        "vat": null
      },
      "user": 
      {
        "id": 514,
        "lastname": "Stone",
        "firstname": "Stéphanie",
        "email": "stef@youdontneedacrm.com"
      },
      "client_folder":
      {
        "id": 1,
        "name": "Series",
        "description": "Billing address: 123 heaven avenue, San Francisco CA\u0026nbsp;94103\u003Cbr /\u003EShipping address: 456 pretty boulevard, Paradise CA\u0026nbsp;94188",
        "is_active": true,
        "created_at": "2015-01-30T22:03:14.000Z"
      }
    }
  }  
]

In case of error you could get this response

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "422", "message": "Unable to perform your request" }

Return the list of all events already sent, going back up to 10 days.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/webhook_events

Retrieve a webhook event

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/webhook_events/3"
require 'rest-client'

key = "91Jy7XxreymBRMASfTF8"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/webhook_events/3",  header
event = JSON.parse(response)

The above commands return JSON structure like this:

{
  "id": 3,
  "event": "lead.creation",
  "signature": "9a046b0f8c6b3820d7fef781e65f7a11c86e7041",
  "data": 
  {
    "id": 8115,
    "title": "RED",
    "description": "Firstname: John<br />Lastname: Doe<br />Email: john@red.com<br />Phone: +1 870 538 2086<br />\r\n---\r\n<p>Some description of the company.</p>",
    "text_description": "Firstname: John\nLastname: Doe\nEmail: john@red.com\nPhone: +1 870 538 2086\n---\nSome description of the company.",
    "amount": 3000.0,
    "currency": "USD",
    "probability": 40,
    "reminder_at": null,
    "updated_at": "2014-03-04T17:28:27.000Z",
    "created_at": "2014-03-04T17:28:27.000Z",
    "starred": null,
    "status": "Todo",
    "step": "Incoming",
    "tags": ["series", "rse"],
    "first_contact_email": "john@red.com",
    "all_contact_emails": ["john@red.com"],
    "permalink": "https://YOUR_SLUG_HERE.nocrm.io/leads/8115",
    "fields":
    {
      "email": "john@red.com",
      "phone": "+1 870 538 2086",
      "mobile": null,
      "address": null,
      "web": null,
      "first_name": "John",
      "last_name": "Doe",
      "full_name": null,
      "job": null,
      "fax": null,
      "vat": null
    },
    "user": 
    {
      "id": 514,
      "lastname": "Stone",
      "firstname": "Stéphanie",
      "email": "stef@youdontneedacrm.com"
    },
    "client_folder":
    {
      "id":1,
      "name":"Series",
      "description":"Billing address: 123 heaven avenue, San Francisco CA\u0026nbsp;94103\u003Cbr /\u003EShipping address: 456 pretty boulevard, Paradise CA\u0026nbsp;94188",
      "is_active":true,
      "created_at":"2015-01-30T22:03:14.000Z"
    }
  }
}  

In case of error you could get these responses

{ "error": "401", "message": "Unauthorized: api key [missing | invalid]" }
{ "error": "404", "message": "Entry not found" }
{ "error": "422", "message": "Missing parameter: id is required"}
{ "error": "422", "message": "Unable to perform your request" }

Retrieve a specific event from its id.

Http request

GET https://YOUR_SLUG_HERE.nocrm.io/api/webhook_events/{id}

Parameters

Parameter Description
id required The id of the webhook event

Errors

The API uses the following error codes:

Error Code Meaning
401 Unauthorized – Your API key or USER token is wrong
404 Not Found – The specified object could not be found
405 Method Not Allowed – You tried to access with an invalid method
422 Unprocessable – Unable to perform your request

Migration v1 to v2

If you are migrating the API calls from version 1 to version 2, this is all what have been changed.

Specify the version 2

curl -H "Accept: application/ydncrm.v2" -H "X-API-KEY: 91Jy7XxreymBRMASfTF8" "https://YOUR_SLUG_HERE.nocrm.io/api/ping"
header = { 'X-API-KEY' => key, content_type: :json, accept: "application/json application/ydncrm.v2" }
response = RestClient.get "https://YOUR_SLUG_HERE.nocrm.io/api/ping", header

As long as version 2 is not the default API, you have to explicitly define the use of the version 2 in the header of all your requests by adding application/ydncrm.v2 in the Accept key.

Login / Logout

If the requests have to be made as a specific user, we have introduced 2 new requests: login and logout.

The login request will allow a specific user to access the application through the API with his/her right. The login will return a USER token that has to be used in any requests like the API-KEY but with the key USER-TOKEN.

When you are done with the requests, you can logout the user with a logout request. After this step, the USER-TOKEN is deleted and you have to request a new token to access data. If you didn’t logout explicitly, the token is automatically destroyed after 30 days.

Log as

When using the API key for most of the requests, it is possible to log as a specific user to do a request with the action log_as. Log as usual with the API key and then call this request to get a USER token for the specified user.

Steps

List the steps

Retrieve a step

Client folders

Categories

Predefined tags

Leads

List the leads

Create a lead

Update a lead

Output of creating, retrieving and updating a lead has changed

New functionnalities on leads

Prospecting files

Create a prospecting file

Action histories

List of action histories

Users

Output of user

Retrieve a user