---
title: "First flow | Docs | Integrations by R&D Copilot"
description: "Follow an online order through ERP, parallel calls, approval and completion."
canonical: "https://integrations.rdcopilot.com/docs/get-started/first-flow/"
language: en
updated: 2026-11-22
---

# First flow

Follow an online order through ERP, parallel calls, approval and completion.

Use [Quickstart](https://integrations.rdcopilot.com/docs/get-started/quickstart/) to create the flow and start its first run in your test company. This guide follows the path of that run and the decisions each step makes.

## Start with the order

JSON

```json
{
  "order": {
    "number": "CV-1046",
    "currency": "RON",
    "netTotal": "2818.41"
  }
}
```

Keep the order number stable across every call. The trigger starts the path and the ERP call creates the destination order. Do not continue to downstream work until that call completes.

## Read the dependencies

| Step | Type | Depends on |
| --- | --- | --- |
| `trigger` | `trigger` | `—` |
| `erp` | `call` | `trigger` |
| `parallel` | `parallel` | `erp` |
| `crm` | `call` | `parallel` |
| `wms` | `call` | `parallel` |
| `branch` | `branch` | `crm, wms` |
| `approval` | `approval` | `branch` |
| `wait` | `wait` | `approval, branch` |
| `end` | `end` | `wait` |

CRM and WMS depend on the parallel node, so each proceeds independently. The branch depends on both calls and compares the order’s net total with `branchLimit`; one completed call is not enough to release it. Approval follows the branch, and the wait can also be reached directly from it.

## Decide the approval

When the total is strictly greater than the limit, the approval step waits for an authorized person. At or below the limit, it is skipped. Read the run’s current revision before approving; rejecting the approval ends the run as failed.

curl

```bash
curl -X POST "$RDC_BASE_URL/integrations/v1/runs/run-b73a02/steps/approval/approval" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "33a22ec0-f0af-4498-a388-123456789abc",
  "expectedRevision": 1,
  "decision": "approve"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/integrations/v1/runs/run-b73a02/steps/approval/approval`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "33a22ec0-f0af-4498-a388-123456789abc",
    "expectedRevision": 1,
    "decision": "approve"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/integrations/v1/runs/run-b73a02/steps/approval/approval',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '33a22ec0-f0af-4498-a388-123456789abc',
        'expectedRevision': 1,
        'decision': 'approve',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "33a22ec0-f0af-4498-a388-123456789abc",
  "expectedRevision": 1,
  "decision": "approve"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/integrations/v1/runs/run-b73a02/steps/approval/approval');
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#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/integrations/v1/runs/run-b73a02/steps/approval/approval");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "33a22ec0-f0af-4498-a388-123456789abc",
  "expectedRevision": 1,
  "decision": "approve"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "33a22ec0-f0af-4498-a388-123456789abc",
  "status": "accepted",
  "aggregateRevision": 1,
  "aggregateId": "run-b73a02"
}
```

## Confirm completion

The wait releases the path after its configured pause. The end step completes the run only after its dependencies finish. Read the final run and confirm the downstream records using the original order number.

curl

```bash
curl "$RDC_BASE_URL/integrations/v1/runs/run-b73a02" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/integrations/v1/runs/run-b73a02`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
  },
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'GET',
    f'{os.environ["RDC_BASE_URL"]}/integrations/v1/runs/run-b73a02',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/integrations/v1/runs/run-b73a02');
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#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/integrations/v1/runs/run-b73a02");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 200

```json
{
  "id": "run-b73a02",
  "flowId": "flow-order",
  "version": 1,
  "revision": 1,
  "correlationId": "api-b73a02d9",
  "started": "2026-11-23T07:12:00.000Z",
  "ended": null,
  "status": "running",
  "triggeredBy": "api",
  "failedStep": null,
  "total": "2818.41",
  "orderNumber": "CV-1046",
  "definition": {
    "id": "flow-order",
    "name": "Order processing",
    "version": 1,
    "revision": 1,
    "branchLimit": "2500.00",
    "steps": [
      {
        "id": "trigger",
        "type": "trigger",
        "name": "trigger",
        "dependencies": [],
        "connectionId": null,
        "action": null,
        "timeoutMs": 30000,
        "retries": 0,
        "pauseMs": 0,
        "mapping": {
          "orderNumber": "input.order.number"
        }
      },
      {
        "id": "erp",
        "type": "call",
        "name": "erp",
        "dependencies": [
          "trigger"
        ],
        "connectionId": "connection-erp",
        "action": "create-order",
        "timeoutMs": 30000,
        "retries": 2,
        "pauseMs": 1000,
        "mapping": {
          "orderNumber": "input.order.number"
        }
      },
      {
        "id": "parallel",
        "type": "parallel",
        "name": "parallel",
        "dependencies": [
          "erp"
        ],
        "connectionId": null,
        "action": null,
        "timeoutMs": 30000,
        "retries": 0,
        "pauseMs": 0,
        "mapping": {
          "orderNumber": "input.order.number"
        }
      },
      {
        "id": "crm",
        "type": "call",
        "name": "crm",
        "dependencies": [
          "parallel"
        ],
        "connectionId": "connection-crm",
        "action": "sync-order",
        "timeoutMs": 30000,
        "retries": 2,
        "pauseMs": 1000,
        "mapping": {
          "orderNumber": "input.order.number"
        }
      },
      {
        "id": "wms",
        "type": "call",
        "name": "wms",
        "dependencies": [
          "parallel"
        ],
        "connectionId": "connection-wms",
        "action": "create-delivery",
        "timeoutMs": 30000,
        "retries": 2,
        "pauseMs": 1000,
        "mapping": {
          "orderNumber": "input.order.number"
        }
      },
      {
        "id": "branch",
        "type": "branch",
        "name": "branch",
        "dependencies": [
          "crm",
          "wms"
        ],
        "connectionId": null,
        "action": null,
        "timeoutMs": 30000,
        "retries": 0,
        "pauseMs": 0,
        "mapping": {
          "orderNumber": "input.order.number"
        }
      },
      {
        "id": "approval",
        "type": "approval",
        "name": "approval",
        "dependencies": [
          "branch"
        ],
        "connectionId": null,
        "action": null,
        "timeoutMs": 14400000,
        "retries": 0,
        "pauseMs": 0,
        "mapping": {
          "orderNumber": "input.order.number"
        }
      },
      {
        "id": "wait",
        "type": "wait",
        "name": "wait",
        "dependencies": [
          "approval",
          "branch"
        ],
        "connectionId": null,
        "action": null,
        "timeoutMs": 3600000,
        "retries": 0,
        "pauseMs": 600000,
        "mapping": {
          "orderNumber": "input.order.number"
        }
      },
      {
        "id": "end",
        "type": "end",
        "name": "end",
        "dependencies": [
          "wait"
        ],
        "connectionId": null,
        "action": null,
        "timeoutMs": 30000,
        "retries": 0,
        "pauseMs": 0,
        "mapping": {
          "orderNumber": "input.order.number"
        }
      }
    ]
  },
  "steps": [
    {
      "id": "trigger",
      "status": "pending",
      "attempts": 0,
      "started": null,
      "ended": null,
      "retryAt": null,
      "input": {
        "order": {
          "number": "CV-1046",
          "currency": "RON",
          "netTotal": "2818.41"
        }
      },
      "output": {},
      "attemptLog": []
    },
    {
      "id": "erp",
      "status": "pending",
      "attempts": 0,
      "started": null,
      "ended": null,
      "retryAt": null,
      "input": {
        "order": {
          "number": "CV-1046",
          "currency": "RON",
          "netTotal": "2818.41"
        }
      },
      "output": {},
      "attemptLog": []
    },
    {
      "id": "parallel",
      "status": "pending",
      "attempts": 0,
      "started": null,
      "ended": null,
      "retryAt": null,
      "input": {
        "order": {
          "number": "CV-1046",
          "currency": "RON",
          "netTotal": "2818.41"
        }
      },
      "output": {},
      "attemptLog": []
    },
    {
      "id": "crm",
      "status": "pending",
      "attempts": 0,
      "started": null,
      "ended": null,
      "retryAt": null,
      "input": {
        "order": {
          "number": "CV-1046",
          "currency": "RON",
          "netTotal": "2818.41"
        }
      },
      "output": {},
      "attemptLog": []
    },
    {
      "id": "wms",
      "status": "pending",
      "attempts": 0,
      "started": null,
      "ended": null,
      "retryAt": null,
      "input": {
        "order": {
          "number": "CV-1046",
          "currency": "RON",
          "netTotal": "2818.41"
        }
      },
      "output": {},
      "attemptLog": []
    },
    {
      "id": "branch",
      "status": "pending",
      "attempts": 0,
      "started": null,
      "ended": null,
      "retryAt": null,
      "input": {
        "order": {
          "number": "CV-1046",
          "currency": "RON",
          "netTotal": "2818.41"
        }
      },
      "output": {},
      "attemptLog": []
    },
    {
      "id": "approval",
      "status": "pending",
      "attempts": 0,
      "started": null,
      "ended": null,
      "retryAt": null,
      "input": {
        "order": {
          "number": "CV-1046",
          "currency": "RON",
          "netTotal": "2818.41"
        }
      },
      "output": {},
      "attemptLog": []
    },
    {
      "id": "wait",
      "status": "pending",
      "attempts": 0,
      "started": null,
      "ended": null,
      "retryAt": null,
      "input": {
        "order": {
          "number": "CV-1046",
          "currency": "RON",
          "netTotal": "2818.41"
        }
      },
      "output": {},
      "attemptLog": []
    },
    {
      "id": "end",
      "status": "pending",
      "attempts": 0,
      "started": null,
      "ended": null,
      "retryAt": null,
      "input": {
        "order": {
          "number": "CV-1046",
          "currency": "RON",
          "netTotal": "2818.41"
        }
      },
      "output": {},
      "attemptLog": []
    }
  ]
}
```

## Recover an ERP timeout

If the ERP call times out, the run makes the next attempt itself after `pauseMs`, up to `retries`; the trigger stays completed and is not repeated. When every attempt has timed out the run stops at that call. Check whether the destination created the order before retrying; the response may have been lost. Wait until `retryAt`, then retry with the latest run revision.

curl

```bash
curl -X POST "$RDC_BASE_URL/integrations/v1/runs/run-b73a02/retry" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "33a22ec0-f0af-4498-a388-123456789abc",
  "expectedRevision": 1
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/integrations/v1/runs/run-b73a02/retry`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "33a22ec0-f0af-4498-a388-123456789abc",
    "expectedRevision": 1
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/integrations/v1/runs/run-b73a02/retry',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '33a22ec0-f0af-4498-a388-123456789abc',
        'expectedRevision': 1,
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "33a22ec0-f0af-4498-a388-123456789abc",
  "expectedRevision": 1
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/integrations/v1/runs/run-b73a02/retry');
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#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/integrations/v1/runs/run-b73a02/retry");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "33a22ec0-f0af-4498-a388-123456789abc",
  "expectedRevision": 1
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "33a22ec0-f0af-4498-a388-123456789abc",
  "status": "accepted",
  "aggregateRevision": 1,
  "aggregateId": "run-b73a02"
}
```

Continue with [Test a flow](https://integrations.rdcopilot.com/docs/build/test-a-flow/) to check both approval branches, stale requests and cancellation.
