# 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.
POST
/deals/update_or_create/
Attributes | Type | Required | Description |
---|---|---|---|
custom_id | string | no | The unique identifier for the deal which is provided by the client. |
activities_status | string | no | A status of an activity assigned to the user. |
assigned_to | integer | no | A unique identifier for the agent which is given by User.com automatically. |
company_id | integer | no | A unique identifier for the company which is given by User.com automatically. |
currency | string | no | A currency of a deal. |
expected_close_date | string | no | A date when the deal is expected to be closed. |
loss_reason | integer | no | A reason for a lost deal. |
lost_at | string | no | A date when the deal has been marked as lost. |
name | string | yes | A deal name. |
participants | integer | no | A list of user_ids assigned to a deal. |
pipeline | integer | no | An id of a pipeline where the deal is assigned to. |
products | integer(list) | no | A list of products' ids. |
stage | integer | no | An id of a stage of the pipeline the deal is currently at. |
status | integer | no | A status of your deal (0 - abandoned, 1 - in progress, 2 - won, 3 - lost, 4 - archived) |
user_id | integer | no | A unique identifier for the user which is given by User.com automatically. |
value | string | no | A value of a deal. |
won_at | string | no | A date when the deal has been marked as won. |
# Request
- CURL
- JavaScript
- PHP
- Python
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": 8066,
"name": "My new deal",
"value": "0.00",
"currency": "USD",
"custom_id": null,
"stage": 25898,
"pipeline": 4338,
"assigned_to": 5725,
"restricted_to": null,
"agent": null,
"company": null,
"person": null,
"status": "1",
"scope": "2",
"created_by": 5567,
"created_at": "2017-07-28T15:35:09.998107Z",
"updated_at": "2017-07-28T15:35:42.051937Z",
"activities_status": "no planned",
"activities_status_updated_at": "2017-07-28T15:35:42.051736Z",
"expected_close_date": null
}