Method upload.deals_history
Description Loading deals
Available to Agent, Client

The method allows you to download transaction history, transitions between stages, and cost.
To correctly build the End-to-End Analytics report, a transaction must have a minimum such parameters as “deal creation date, cost, contact (with contact details - date of creation, email, phone) or specified communication_id and communication_type". - Using contact information main_contact_ext_id and contact_ext_ids we are looking for all contact requests (call, request, chat) - By communication_id and communication_type we associate the transaction with this request. - If main_contact_ext_id, contact_ext_ids and communication_id, communication_type were sent simultaneously, the link to the appeal will be communication_id and communication_type - We filter out requests that fall under the filter - the time between requesting and creating an entity is more than 30 days. - It is possible to update contact information (main_contact_ext_id and contact_ext_ids) or appeal (communication_id, communication_type) on a transaction only with a shift in the stage modification date (modified_date_time, modified_stage_date_time). The transaction and circulation link will be redefined.

Limitations

Title Description
created_date_time Date and time cannot be in the future
modified_stage_date_time More creation_date.
modified_stage_date_time of the loaded stage must be greater than or equal to the modified_stage_date_time of the last loaded stage
closed_date_time Cannot be less than the transaction creation date.
Taken into account in calculations only for transactions at the stage with the status "success" or "failed"

If the data for one of the transactions is filled in incorrectly, the request ends with an error and after correcting it, the entire request must be submitted again.

Request parameters

Title Type Required Description
access_token string yes Authentication session key
deals array yes List of deals. Limit 1000 trades
ext_id string yes Transaction ID in the external system
name string yes Transaction name
created_date_time iso8601 yes Date and time of transaction creation (YYYY-MM-DD hh:mm:ss)
modified_date_time iso8601 no Date and time of transaction change (YYYY-MM-DD hh:mm:ss)
If the parameter is not passed, the date and time of the method call will be indicated
modified_stage_date_time iso8601 yes Date and time when the deal entered the current stage (YYYY-MM-DD hh:mm:ss)
closed_date_time iso8601 no Trade closing date and time (YYYY-MM-DD hh:mm:ss)
contact_ext_ids array no Contact associated with the deal. Mandatory if main_contact_ext_id is specified.
main_contact_ext_id string no The main contact for the transaction is from the list contact_ext_ids. Mandatory if contact_ext_ids is passed.
employee_ext_id string no Responsible employee for the transaction
lead_ext_id string no Related Lead
company_ext_id string no Related companies
revenue number no Transaction proceeds
stage_ext_id string yes Sales Funnel Stage ID
comments string no Commentary on the transaction
source string no Deal Source
communication_id number no ID of the case to which the transaction is associated. Mandatory if communication_type is passed
communication_type string no The type of treatment with which the transaction is associated. Available values ​​are chat,offline_message,call,goal,email. Mandatory if communication_id is sent.
user_fields array no Custom fields added to the transaction. Before passing, you need to create a custom field using the "create.deal_user_field"
ext_id string yes Transaction Custom Field External ID
value string yes transaction custom field value
tags array no Custom tags
ext_id string yes External Tag ID
name string yes Tag name
child_customer_id number no Identifier of the client within which the Transaction is created. Method for getting a list of clients: "get.customers"

JSON request structure```json

{ "jsonrpc": "2.0", "id": "number", "method": "upload.deals_history", "params": { "access_token": "string", "user_id": "number", "deals": [ { "ext_id": "string", "name": "string", "created_date_time": "iso8601", "modified_date_time":"iso8601", "modified_stage_date_time": "iso8601", "closed_date_time": "iso8601", "contact_ext_ids": [ "string" ], "main_contact_ext_id": "string", "employee_ext_id": "string", "lead_ext_id": "string", "revenue": "number", "sales_funnel_ext_id": "string", "stage_ext_id": "string", "comments": "string", "source": "string", "communication_id": "number", "communication_type": "string", "source": "string", "child_customer_id": "number", "tags":[ { "name": "string", "ext_id": "string" }, { "name": "string", "ext_id": "string" } ] "user_fields":[ { "ext_id": "string", "value": "string" }, { "ext_id": "string", "value": "string" } ] } ] } }

### JSON response structure```JSON
{
    "jsonrpc": "2.0",
    "id": "number",
    "result": {
        "data": {},
        "metadata": "object"
    }
}

List of returned errors

Look at the section "List of errors for methods with the verb upload"