Skip to main content
POST/deals/

Create deal

You can create a deal. You can also set up any custom attribute of your choice. If a specified custom attribute doesn't exist yet it will be created.

Deal as an Order

What's more, it is also possible to use deal as an order with data about the ordered products such as ID, quantity, value and currency. Those data will not be changed even after the update of the assigend products which allow to show all the products information like the constant data from the order as well as the current information for the products.
To do it you can iterate by order_products inside a deal returned by the {% deals %} snippet tag.
(see an example in the Deal snippet tag generator in your app).

AttributesTypeRequiredDescription
custom_idstringno

The unique identifier for the deal which is provided by the client.

activities_statusstringnoA status of an activity assigned to the user.
assigned_tointegerno

A unique identifier for the agent which is given by User.com automatically.

company_idintegerno

A unique identifier for the company which is given by User.com automatically.

currencyISO 4217 codenoA currency of a deal.
expected_close_datedatenoA date when the deal is expected to be closed.
loss_reasonintegernoA reason for a lost deal.
lost_atdatetimenoA date when the deal has been marked as lost.
namestringyesA deal name.
participantsinteger(list)noA list of user_ids assigned to a deal.
pipelineintegernoAn id of a pipeline where the deal is assigned to.
productsinteger(list)noA list of product IDs.
products_custom_idstring(list)noA list of product custom IDs.
stageintegernoAn id of a stage of the pipeline the deal is currently at.
statusintegerno

A status of your deal (0 - abandoned, 1 - in progress, 2 - won, 3 - lost, 4 - archived)

user_idintegerno

A unique identifier for the user which is given by User.com automatically.

valuenumbernoA value of a deal.
won_atdatetimenoA date when the deal has been marked as won.
user_custom_idstringno

A unique identifier for the user which is provided by the client.

company_custom_idstringno

A unique identifier for the company which is provided by the client.

order_productslistno

A list of basic information per each ordered product which is provided by the client.
Those information have to contain:

  • product_id (integer) OR product_custom_id (string)
  • quantity (integer)
  • value (integer)
  • currency (string)

Request​

curl -X POST -H "Authorization: Token <your_64_char_api_key>" -H "Content-Type: application/json"
-H "Accept: */*; version=2" -d '{
"name": "My new deal",
"description": "deal created by API request",
"stage": 25898,
"pipeline": 4338,
"assigned_to": 5725,
"status": 1,
"scope": 1
}' "https://<your_app_subdomain>.user.com/api/public/deals/"

Response​

{
"id": 12218,
"name": "example deal",
"value": "1200.00",
"currency": "USD",
"custom_id": null,
"stage": 36585,
"pipeline": 6179,
"assigned_to": 398,
"restricted_to": null,
"agent": null,
"company_id": 768,
"user_id": 20900530,
"status": 1,
"products": [185582, 201009],
"scope": 2,
"created_by": 382,
"created_at": "2017-09-06T09:53:50.748535Z",
"updated_at": "2017-09-06T09:53:50.748555Z",
"tags": [{ "id": 9, "name": "To call" }],
"activities_status": "planned",
"expected_close_date": null,
"loss_reason": null,
"loss_reason_description": "",
"lost_at": null,
"won_at": null,
"participants": [4],
"user_custom_id": "52bdc3be5145e87076c8",
"products_custom_id": ["product_972348", "product_9423548"],
"company_custom_id": "c44adda2ecc0",
"custom_attribute_xyz": null,
"order_products": [
{
"product_id": 185582,
"product_custom_id": "product_972348",
"currency": "USD",
"value": "500.00",
"quantity": 2
},
{
"product_id": 201009,
"product_custom_id": "product_9423548",
"currency": "USD",
"value": "200.00",
"quantity": 1
}
]
}