Skip to main content
POST/deals/update_or_create/

Update or create deal

You can update an existing deal or create a new one in case a deal with a specific identifier doesn't exist. You can also set up any custom attribute of your choice. If a specified custom attribute doesn't exist yet it will be created.

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 automatically.

company_idintegerno

A unique identifier for the company which is given by User 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 automatically.

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

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

company_custom_idstringno

The 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 "https://<your_app_subdomain>.user.com/api/public/deals/update_or_create/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2" \
-H "Content-Type: application/json" \
-d '{
"custom_id": "annual-plan",
"name": "Annual plan for Acme Inc",
"value": 2000
}'

Response examples​

{
"id": 387,
"created": false
}

Response fields · 200 OK​

Fields returned in the 200 OK response body.

idinteger
A unique identifier for the deal which is given by User automatically.
createdboolean
true if the tag didn't exist and was created, false if an existing tag was used.

Response fields · 201 Created​

Fields returned in the 201 Created response body.

idinteger
A unique identifier for the deal which is given by User automatically.
createdboolean
true if the tag didn't exist and was created, false if an existing tag was used.
note

Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.