Skip to content
Docs
API 1.0.0 · 22 Nov 2026

Search the docs

    Română

    Move a deal through stages

    Read a deal, move it, schedule its next step, win or lose it, and handle a change made by someone else.

    On this page

    Every call in this guide changes one deal and sends the revision that was read as expectedRevision. The stages and what each operation needs are in Deals, pipelines and stages.

    Read the deal

    Read the deal for its stage and its revision.

    curl

    curl "$RDC_BASE_URL/crm/v1/deals/4b1c7a52-9e03-4d6f-8a17-c05e2d9b6f31" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/deals/4b1c7a52-9e03-4d6f-8a17-c05e2d9b6f31`, {
      method: 'GET',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
      },
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'GET',
        f'{os.environ["RDC_BASE_URL"]}/crm/v1/deals/4b1c7a52-9e03-4d6f-8a17-c05e2d9b6f31',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/deals/4b1c7a52-9e03-4d6f-8a17-c05e2d9b6f31');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'GET',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        ],
    ]);
    $result = json_decode(curl_exec($curl), true);
    curl_close($curl);

    C#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/crm/v1/deals/4b1c7a52-9e03-4d6f-8a17-c05e2d9b6f31");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 200

    {
      "id": "4b1c7a52-9e03-4d6f-8a17-c05e2d9b6f31",
      "number": "DL-1031",
      "companyId": "61d54dde-e1f3-43da-b2fc-a4a21540e5f3",
      "company": "Hanul Ozana SRL",
      "name": "First order for the kitchen",
      "owner": "andrei-pop",
      "value": "2818.41",
      "currency": "RON",
      "stage": "won",
      "reason": "range",
      "expectedClose": "2026-11-17",
      "order": "CV-1042",
      "externalId": "cust-0231-first-order",
      "customFields": {},
      "revision": 6
    }

    Move it

    Move a deal to another open stage, forwards when the work advances and back when it falls behind. The answer holds the new revision.

    curl

    curl -X POST "$RDC_BASE_URL/crm/v1/deals/7f2c8e49-5a01-4d73-b9e6-0c3d1a8f5b37/move" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "f9208bca-cb01-4c7e-a6d4-01c5fc0c08c0",
      "expectedRevision": 2,
      "to": "offer"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/deals/7f2c8e49-5a01-4d73-b9e6-0c3d1a8f5b37/move`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "f9208bca-cb01-4c7e-a6d4-01c5fc0c08c0",
        "expectedRevision": 2,
        "to": "offer"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/crm/v1/deals/7f2c8e49-5a01-4d73-b9e6-0c3d1a8f5b37/move',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': 'f9208bca-cb01-4c7e-a6d4-01c5fc0c08c0',
            'expectedRevision': 2,
            'to': 'offer',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "f9208bca-cb01-4c7e-a6d4-01c5fc0c08c0",
      "expectedRevision": 2,
      "to": "offer"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/deals/7f2c8e49-5a01-4d73-b9e6-0c3d1a8f5b37/move');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
            'Content-Type: application/json',
        ],
        CURLOPT_POSTFIELDS => $body,
    ]);
    $result = json_decode(curl_exec($curl), true);
    curl_close($curl);

    C#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/crm/v1/deals/7f2c8e49-5a01-4d73-b9e6-0c3d1a8f5b37/move");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "f9208bca-cb01-4c7e-a6d4-01c5fc0c08c0",
      "expectedRevision": 2,
      "to": "offer"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "f9208bca-cb01-4c7e-a6d4-01c5fc0c08c0",
      "status": "accepted",
      "aggregateRevision": 3
    }

    Schedule the next step

    Every open deal needs a next step with a day. A deal with none is easy to forget. Scheduling a step adds one to the revision of the deal, so send the revision of the answer you just got.

    curl

    curl -X POST "$RDC_BASE_URL/crm/v1/deals/7f2c8e49-5a01-4d73-b9e6-0c3d1a8f5b37/tasks" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "c87683c9-eebe-42a8-a4bb-4b38e8e2949a",
      "expectedRevision": 2,
      "kind": "call",
      "text": "Confirm the delivery date for the new shop.",
      "due": "2026-11-27"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/deals/7f2c8e49-5a01-4d73-b9e6-0c3d1a8f5b37/tasks`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "c87683c9-eebe-42a8-a4bb-4b38e8e2949a",
        "expectedRevision": 2,
        "kind": "call",
        "text": "Confirm the delivery date for the new shop.",
        "due": "2026-11-27"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/crm/v1/deals/7f2c8e49-5a01-4d73-b9e6-0c3d1a8f5b37/tasks',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': 'c87683c9-eebe-42a8-a4bb-4b38e8e2949a',
            'expectedRevision': 2,
            'kind': 'call',
            'text': 'Confirm the delivery date for the new shop.',
            'due': '2026-11-27',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "c87683c9-eebe-42a8-a4bb-4b38e8e2949a",
      "expectedRevision": 2,
      "kind": "call",
      "text": "Confirm the delivery date for the new shop.",
      "due": "2026-11-27"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/deals/7f2c8e49-5a01-4d73-b9e6-0c3d1a8f5b37/tasks');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
            'Content-Type: application/json',
        ],
        CURLOPT_POSTFIELDS => $body,
    ]);
    $result = json_decode(curl_exec($curl), true);
    curl_close($curl);

    C#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/crm/v1/deals/7f2c8e49-5a01-4d73-b9e6-0c3d1a8f5b37/tasks");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "c87683c9-eebe-42a8-a4bb-4b38e8e2949a",
      "expectedRevision": 2,
      "kind": "call",
      "text": "Confirm the delivery date for the new shop.",
      "due": "2026-11-27"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "c87683c9-eebe-42a8-a4bb-4b38e8e2949a",
      "status": "accepted",
      "aggregateRevision": 3
    }

    Win it or lose it

    A deal in offer or negotiation is won with a reason from the list of winDeal. Any open deal is lost with a reason from the list of loseDeal.

    curl

    curl -X POST "$RDC_BASE_URL/crm/v1/deals/0d7e2b85-f1a3-4c69-b2d4-93a8e5c61d38/win" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "9a4e7b10-2c6d-4f38-b5a1-0d3e8c7f6b25",
      "expectedRevision": 5,
      "reason": "delivery"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/deals/0d7e2b85-f1a3-4c69-b2d4-93a8e5c61d38/win`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "9a4e7b10-2c6d-4f38-b5a1-0d3e8c7f6b25",
        "expectedRevision": 5,
        "reason": "delivery"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/crm/v1/deals/0d7e2b85-f1a3-4c69-b2d4-93a8e5c61d38/win',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '9a4e7b10-2c6d-4f38-b5a1-0d3e8c7f6b25',
            'expectedRevision': 5,
            'reason': 'delivery',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "9a4e7b10-2c6d-4f38-b5a1-0d3e8c7f6b25",
      "expectedRevision": 5,
      "reason": "delivery"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/deals/0d7e2b85-f1a3-4c69-b2d4-93a8e5c61d38/win');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
            'Content-Type: application/json',
        ],
        CURLOPT_POSTFIELDS => $body,
    ]);
    $result = json_decode(curl_exec($curl), true);
    curl_close($curl);

    C#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/crm/v1/deals/0d7e2b85-f1a3-4c69-b2d4-93a8e5c61d38/win");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "9a4e7b10-2c6d-4f38-b5a1-0d3e8c7f6b25",
      "expectedRevision": 5,
      "reason": "delivery"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "9a4e7b10-2c6d-4f38-b5a1-0d3e8c7f6b25",
      "status": "accepted",
      "aggregateRevision": 6
    }

    curl

    curl -X POST "$RDC_BASE_URL/crm/v1/deals/58e3b2a9-c704-4f1d-9b68-3a0d7e1c4f39/lose" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "400d2326-b0df-4266-a9bc-a8fa6be8ea86",
      "expectedRevision": 4,
      "reason": "price"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/deals/58e3b2a9-c704-4f1d-9b68-3a0d7e1c4f39/lose`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "400d2326-b0df-4266-a9bc-a8fa6be8ea86",
        "expectedRevision": 4,
        "reason": "price"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/crm/v1/deals/58e3b2a9-c704-4f1d-9b68-3a0d7e1c4f39/lose',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '400d2326-b0df-4266-a9bc-a8fa6be8ea86',
            'expectedRevision': 4,
            'reason': 'price',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "400d2326-b0df-4266-a9bc-a8fa6be8ea86",
      "expectedRevision": 4,
      "reason": "price"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/deals/58e3b2a9-c704-4f1d-9b68-3a0d7e1c4f39/lose');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
            'Content-Type: application/json',
        ],
        CURLOPT_POSTFIELDS => $body,
    ]);
    $result = json_decode(curl_exec($curl), true);
    curl_close($curl);

    C#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/crm/v1/deals/58e3b2a9-c704-4f1d-9b68-3a0d7e1c4f39/lose");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "400d2326-b0df-4266-a9bc-a8fa6be8ea86",
      "expectedRevision": 4,
      "reason": "price"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "400d2326-b0df-4266-a9bc-a8fa6be8ea86",
      "status": "accepted",
      "aggregateRevision": 5
    }

    A deal that ended can be opened again. It returns to the stage it was closed from unless you name another, and the reopening is recorded.

    curl

    curl -X POST "$RDC_BASE_URL/crm/v1/deals/6c4a1e97-d2b8-4f30-8e59-a1d7b3c20f36/reopen" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "99fd1efb-a400-4796-a5bc-b3fd231d49f9",
      "expectedRevision": 3,
      "to": "qualified"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/deals/6c4a1e97-d2b8-4f30-8e59-a1d7b3c20f36/reopen`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "99fd1efb-a400-4796-a5bc-b3fd231d49f9",
        "expectedRevision": 3,
        "to": "qualified"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/crm/v1/deals/6c4a1e97-d2b8-4f30-8e59-a1d7b3c20f36/reopen',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '99fd1efb-a400-4796-a5bc-b3fd231d49f9',
            'expectedRevision': 3,
            'to': 'qualified',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "99fd1efb-a400-4796-a5bc-b3fd231d49f9",
      "expectedRevision": 3,
      "to": "qualified"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/deals/6c4a1e97-d2b8-4f30-8e59-a1d7b3c20f36/reopen');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
            'Content-Type: application/json',
        ],
        CURLOPT_POSTFIELDS => $body,
    ]);
    $result = json_decode(curl_exec($curl), true);
    curl_close($curl);

    C#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/crm/v1/deals/6c4a1e97-d2b8-4f30-8e59-a1d7b3c20f36/reopen");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "99fd1efb-a400-4796-a5bc-b3fd231d49f9",
      "expectedRevision": 3,
      "to": "qualified"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "99fd1efb-a400-4796-a5bc-b3fd231d49f9",
      "status": "accepted",
      "aggregateRevision": 4
    }

    When someone else changed the deal

    If the deal changed after you read it, for example a colleague moved it in the CRM, the answer is a 409 and nothing is applied.

    The answer to a stale revision

    {
      "code": "revision_conflict",
      "message": "The record has changed since the revision you sent."
    }

    1. Read the deal again

      Take its current stage and revision.

    2. Decide

      Check that your change still makes sense on what you now read: a deal that was won meanwhile cannot be moved.

    3. Send it again

      Use a new operationId and the current revision. A request refused with 409 recorded nothing, but a new decision is a new change.

    Other refusals name the rule: deal_closed, offer_required, not_a_move, reason_not_valid. See Errors.