Documentation describing the API provided by the Deals service.

Please be aware, that the type of deal value has been recently changed to reflect the implementation of deal decimal values. If a deal value has no decimal part (1000.0), it will be returned as integer (1000) as before. If a deal has a decimal part (1000.50), it will be returned as string with two decimal places ("1000.50").

The Deals API provides a simple interface to manage deals. The API allows you to create, delete and update your deals. You can also retrieve a single deal as well as list of all deals. Every deal can have multiple associated contacts, each with a different role.

You can assign any number of tags and custom fields to a deal. Tags don't need to exist to be assigned - they can be created when creating or updating the deal.

The organization_id is set automatically when you associate a deal with a primary contact which belongs to a company.

JSON format

NameTypeRead onlyDescription
idnumbertrueUnique identifier of the deal.
creator_idnumbertrueUnique identifier of the user who created the deal.
owner_idnumberfalseUnique identifier of the user that the deal is assigned to.
namestringfalseName of the deal.
valuenumber or stringfalseValue of the deal in a currency specified in the currency field. If a deal value has no decimal part (1000.0), it will be returned as integer (1000). If a deal has a decimal part (1000.50), it will be returned as string with two decimal places ("1000.50").
currencystringfalseCurrency of the deal, specified in 3-character currency code (ISO4217) format.
hotbooleanfalseIndicator of whether or not the deal is hot.
stage_idnumberfalseUnique identifier of the deal's current stage in the pipeline.
last_stage_change_atstringfalseDate and time when the deal was moved into the current stage in UTC (ISO8601 format).
last_stage_change_by_idnumbertrueUnique identifier of the user who moved the deal into the current stage.
last_activity_atstringtrueDate and time of the last activity on the deal in UTC (ISO8601 format).
source_idnumberfalseUnique identifier of the Source.
loss_reason_idnumberfalseReason why the deal was lost.
unqualified_reason_idnumberfalseReason why the deal was unqualied.
dropbox_emailstringtrueDropbox email connected with the deal.
contact_idnumberfalseUnique identifier of a primary contact.
organization_idnumbertrueUnique identifier of an organization.
estimated_close_datestringfalseEstimated close date of the deal.
customized_win_likelihoodnumberfalseUser-provided win likelihood with value range 0-100.
tagsarrayfalseAn array of tags for a deal. See more at Tags.
custom_fieldsObjectfalseCustom fields are key-value data attached to a deal. Only fields with non-null values are returned. See Custom Fields.
created_atstringtrueDate and time that the deal was created in UTC (ISO8601 format).
updated_atstringtrueDate and time of the last update on the deal in UTC (ISO8601 format).
added_atstringtrueDate and time that the deal was started in UTC (ISO8601 format).

Retrieve all deals

GET /v2/deals

Returns all deals available to the user according to the parameters provided.

Parameters

NameTypeRequiredInDescription
pagenumberfalseQueryPage number to start from. Page numbering starts at 1, and omitting the page parameter will return the first page.
per_pagenumberfalseQueryNumber of records to return per page. Default limit is _25_ and the maximum number that can be returned is _100_.
sort_bystringfalseQueryA field to sort by. You can sort by filterable custom fields as well. Example: To sort by a custom field named "external_id", use ?sort_by=custom_fields:external_id. Supported custom field types: Number, Single Line Text, Dropdown, Multi Select. The default ordering is ascending. To change the sort order to descending, append :desc to the field. Example: sort_by=value:desc. Possible values: "id", "value", "name", "estimated_close_date", "updated_at", "created_at"
idsstringfalseQueryComma-separated list of deal IDs to be returned in a request.
includesstringfalseQueryComma-separated list of one or more resources related to a deal.
creator_idnumberfalseQueryUnique identifier of the user the deal was created by. Returns all deals created by the user.
owner_idnumberfalseQueryUnique identifier of the user the deal is owned by. Returns all deals owned by the user.
contact_idnumberfalseQueryUnique identifier of a primary contact.
organization_idnumberfalseQueryUnique identifier of an organization.
hotbooleanfalseQueryIndicator of whether or not the deal is hot.
source_idnumberfalseQueryId of the Source.
stage_idnumberfalseQueryId of the Stage.
namestringfalseQueryName of the deal.
valuenumber or stringfalseQueryValue of the deal. We encourage you to use a string with two decimal places.
estimated_close_datestringfalseQueryEstimated close date of the deal.
custom_fieldsstringfalseQueryFilterable custom field. Example: To find deals with a custom field named "external_id" with a value of "SKU01", use the following: ?custom_fields[external_id]=SKU01. Custom fields must be defined and have a Filterable property assigned to them. Supported custom field types: Number, Single Line Text, Dropdown, Multi Select.
inclusivebooleanfalseQueryIndicates how filters should be combine. true value, the default, uses AND logic. false value uses OR logic to combine filters.

Allowed for

  • Agents

Using cURL

curl -v -X GET https://api.getbase.com/v2/deals \-H "Accept: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN"

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "items": [    {      "data": {        "id": 1,        "creator_id": 1,        "owner_id": 1,        "name": "Website Redesign",        "value": "1000.50",        "currency": "USD",        "hot": true,        "stage_id": 1,        "last_stage_change_at": "2014-08-27T16:32:56Z",        "last_stage_change_by_id": 1,        "last_activity_at": "2014-08-27T17:32:56Z",        "source_id": 10,        "loss_reason_id": null,        "unqualified_reason_id": null,        "dropbox_email": "[email protected]",        "contact_id": 1,        "organization_id": 2,        "estimated_close_date": null,        "customized_win_likelihood": 15,        "tags": [          "important"        ],        "custom_fields": {          "website": "http://www.coffeeshop.com"        },        "created_at": "2014-08-27T16:32:56Z",        "updated_at": "2014-08-27T17:32:56Z"      },      "meta": {        "type": "deal"      }    }  ],  "meta": {    "type": "collection",    "count": 1,    "links": {      "self": "http://api.getbase.com/v2/deals"    }  }}

Create a deal

POST /v2/deals

Create a new deal.

Parameters

NameTypeRequiredInDescription
namestringtrueBody
contact_idnumbertrueBody
valuenumber or stringfalseBodyValue of the deal. We encourage you to use a string with two decimal places.
currencystringfalseBodyIf omitted, currency will be set to the default currency of the account.
owner_idnumberfalseBodyDefaults to the unique identifier of the user that the deal is created by.
hotbooleanfalseBody
stage_idnumberfalseBodyIf omitted, the deal will be placed in the first stage of the default pipeline.
last_stage_change_atstringfalseBodyDate and time when the deal was moved into the current stage in UTC (ISO8601 format).
added_atstringfalseBodyDate and time that the deal was started in UTC (ISO8601 format).
source_idnumberfalseBodyId of the deal Source.
loss_reason_idnumberfalseBodyId of the Loss Reason.
unqualified_reason_idnumberfalseBodyId of the Unqualify Reason.
estimated_close_datestringfalseBody
customized_win_likelihoodnumberfalseBodyUser-provided win likelihood with value range 0-100.
tagsarrayfalseBody
custom_fieldsobjectfalseBodySee Custom Fields.

Allowed for

  • Agents

Using cURL

curl -v -X POST https://api.getbase.com/v2/deals \-H "Accept: application/json" \-H "Content-Type: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN" \-d '{  "data": {    "name": "Website Redesign",    "value": "1000.50",    "hot": true,    "source_id": 10,    "contact_id": 1,    "tags": [      "important"    ],    "custom_fields": {      "website": "http://www.coffeeshop.com"    }  },  "meta": {    "type": "deal"  }}'

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "data": {    "id": 1,    "creator_id": 1,    "owner_id": 1,    "name": "Website Redesign",    "value": "1000.50",    "currency": "USD",    "hot": true,    "stage_id": 1,    "last_stage_change_at": "2014-08-27T16:32:56Z",    "last_stage_change_by_id": 1,    "last_activity_at": "2014-08-27T16:32:56Z",    "source_id": 10,    "loss_reason_id": null,    "unqualified_reason_id": null,    "dropbox_email": "[email protected]",    "contact_id": 1,    "organization_id": 2,    "estimated_close_date": null,    "tags": [      "important"    ],    "custom_fields": {      "website": "http://www.coffeeshop.com"    },    "created_at": "2014-08-27T16:32:56Z",    "updated_at": "2014-08-27T16:32:56Z"  },  "meta": {    "type": "deal"  }}

Retrieve a single deal

GET /v2/deals/:id

Returns a single deal available to the user, according to the unique deal ID provided. If the specified deal does not exist, the request will return an error.

Parameters

NameTypeRequiredInDescription
idtruenumberQueryUnique identifier of the deal.
includesfalsestringQueryComma-separated list of one or more resources related to the deal. Possible values: associated_contacts

Allowed for

  • Agents

Using cURL

curl -v -X GET https://api.getbase.com/v2/deals/1 \-H "Accept: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN"

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "data": {    "id": 1,    "creator_id": 1,    "owner_id": 1,    "name": "Website Redesign",    "value": "1000.50",    "currency": "USD",    "hot": true,    "stage_id": 1,    "last_stage_change_at": "2014-08-27T16:32:56Z",    "last_stage_change_by_id": 1,    "last_activity_at": "2014-08-27T16:32:56Z",    "source_id": 10,    "loss_reason_id": null,    "unqualified_reason_id": null,    "dropbox_email": "[email protected]",    "contact_id": 1,    "organization_id": 2,    "estimated_close_date": null,    "tags": [      "important"    ],    "custom_fields": {      "website": "http://www.coffeeshop.com"    },    "created_at": "2014-08-27T16:32:56Z",    "updated_at": "2014-08-27T16:32:56Z"  },  "meta": {    "type": "deal"  }}

Update a deal

PUT /v2/deals/:id

Updates deal information. If the specified deal does not exist, the request will return an error.

Note: In order to modify tags used on a record, you need to supply the entire set. tags are replaced every time they are used in a request.

Parameters

NameTypeRequiredInDescription
namefalsestringBody
valuefalsenumber or stringBodyWe encourage you to use string with two decimal places.
currencyfalsestringBody
owner_idfalsenumberBody
hotfalsebooleanBody
stage_idfalsenumberBody
last_stage_change_atfalsestringBodyDate and time when the deal was moved into the current stage in UTC (ISO8601 format).
added_atfalsestringBodyDate and time that the deal was started in UTC (ISO8601 format).
source_idfalsenumberBodyUnique identifier of the deal Source.
loss_reason_idfalsenumberBodyUnique identifier of the Loss Reason.
unqualified_reason_idfalsenumberBodyUnique identifier of the Unqualify Reason.
contact_idfalsenumberBodyUnique identifier of a primary contact.
estimated_close_datefalsestringBody
customized_win_likelihoodfalsenumberBodyUser-provided win likelihood with value range 0-100.
tagsfalsearrayBodyIn order to modify, you need to supply the entire set.
custom_fieldsfalseobjectBodySee Custom Fields.

Allowed for

  • Agents

Using cURL

curl -v -X PUT https://api.getbase.com/v2/deals/1 \-H "Accept: application/json" \-H "Content-Type: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN" \-d '{  "data": {    "stage_id": 2  }}'

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "data": {    "id": 1,    "creator_id": 1,    "owner_id": 1,    "name": "Website Redesign",    "value": "1000.50",    "currency": "USD",    "hot": true,    "stage_id": 2,    "last_stage_change_at": "2014-08-27T16:32:56Z",    "last_stage_change_by_id": 1,    "last_activity_at": "2014-08-27T17:32:56Z",    "source_id": 10,    "loss_reason_id": null,    "unqualified_reason_id": null,    "dropbox_email": "[email protected]",    "contact_id": 1,    "organization_id": 2,    "estimated_close_date": null,    "customized_win_likelihood": 15,    "tags": [      "important"    ],    "custom_fields": {      "website": "http://www.coffeeshop.com"    },    "created_at": "2014-08-27T16:32:56Z",    "updated_at": "2014-08-27T17:32:56Z"  },  "meta": {    "type": "deal"  }}

Delete a deal

DELETE /v2/deals/:id

Delete an existing deal and remove all of the associated contacts from the deal in a single call. If the specified deal does not exist, the request will return an error. This operation cannot be undone.

Parameters

NameTypeRequiredInDescription
idnumbertrueQueryUnique identifier of the deal.

Allowed for

  • Agents

Using cURL

curl -v -X DELETE https://api.getbase.com/v2/deals/1 \-H "Authorization: Bearer $ACCESS_TOKEN"

Example response

HTTP/1.1 204 No Content

Upsert a deal

POST /v2/deals/upsert

Create a new deal or update an existing, based on a value of a filter or a set of filters. At least a single filter - query parameter - is required. If no parameters are present, the request will return an error.

Behaviour:

  1. If multiple deals match a set of filters, the request will return an error - 409.
  2. If a single deal matches, then the existing deal is updated
  3. If none matches the query, a new deal is created

Notice Use Upsert API, instead of Create or Update, to avoid creating unwanted, duplicated records. Also very useful if you want Sell to carry external system ids - stored as custom fields.

Parameters

NameTypeRequiredInDescription
creator_idnumberfalseBodyUnique identifier of the user the deal was created by. Returns all deals created by the user.
owner_idnumberfalseBodyUnique identifier of the user the deal is owned by. Returns all deals owned by the user.
contact_idnumberfalseBodyUnique identifier of a primary contact.
organization_idnumberfalseBodyUnique identifier of an organization.
hotbooleanfalseBodyIndicator of whether or not the deal is hot.
source_idnumberfalseBodyId of the Source.
stage_idnumberfalseBodyId of the Stage.
last_stage_change_atstringfalseBodyDate and time when the deal was moved into the current stage in UTC (ISO8601 format))
added_atstringfalseBodyDate and time that the deal was started in UTC (ISO8601 format).
namestringfalseBodyName of the deal.
valuenumber or stringfalseBodyValue of the deal. We encourage you to use a string with two decimal places.
estimated_close_datestringfalseBodyEstimated close date of the deal.
customized_win_likelihoodnumberfalseBodyUser-provided win likelihood with value range 0--100.
custom_fieldsstringfalseBodyFilterable custom field. Example: To perform an upsert on a deal with a custom field named "external_id" with a value of "SKU01", use the following: ?custom_fields[external_id]=SKU01. Custom fields must be defined and have a Filterable property assigned to them. Supported custom field types: Number, Single Line Text, Dropdown, Multi Select.
inclusivebooleanfalseBodyIndicates how filters should be combine. true value, the default, uses AND logic. false value uses OR logic to combine filters.

Allowed for

  • Agents

Using cURL

curl -v -X POST https://api.getbase.com/v2/deals/upsert?custom_fields[external_id]=SKU01 \-H "Accept: application/json" \-H "Content-Type: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN" \-d '{  "data": {    "name": "Website Redesign for Coffeeshop",    "custom_fields": {      "external_id": "SKU01"    }  }}'

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "data": {    "id": 1,    "creator_id": 1,    "owner_id": 1,    "name": "Website Redesign for Coffeeshop",    "value": "1000.50",    "currency": "USD",    "hot": true,    "stage_id": 1,    "last_stage_change_at": "2014-08-27T16:32:56Z",    "last_stage_change_by_id": 1,    "last_activity_at": "2015-07-16T17:14:16Z",    "source_id": 10,    "loss_reason_id": null,    "unqualified_reason_id": null,    "dropbox_email": "[email protected]",    "contact_id": 1,    "organization_id": 2,    "estimated_close_date": null,    "customized_win_likelihood": 15,    "tags": [      "important"    ],    "custom_fields": {      "external_id": "SKU01",      "website": "http://www.coffeeshop.com"    },    "created_at": "2014-08-27T16:32:56Z",    "updated_at": "2015-07-16T17:14:16Z"  },  "meta": {    "type": "deal"  }}