---
title: "Quickstart | Docs | CRM by R&D Copilot"
description: "Create a company and a deal, check the result and read both back, with five requests."
canonical: "https://crm.rdcopilot.com/docs/get-started/quickstart/"
language: en
updated: 2026-11-22
---

# Quickstart

Create a company and a deal, check the result and read both back, with five requests.

You need the client credentials and the base address of your test company. The samples read them from the environment: `$RDC_BASE_URL` and `$RDC_TOKEN`. See [Authentication](https://crm.rdcopilot.com/docs/get-started/authentication/) for the token.

## Create a company

Choose a new `operationId`, and give the company the number your own system has for it as `externalId`. You will find the company by that number in a moment.

curl

```bash
curl -X POST "$RDC_BASE_URL/crm/v1/companies" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "44a8eb19-bcfd-401a-b2b6-c411f3db86cb",
  "name": "Hanul Ozana SRL",
  "cif": "RO39172541",
  "owner": "andrei-pop",
  "industry": "Inn and restaurant",
  "employees": 18,
  "town": "Târgu Neamț",
  "county": "Neamț",
  "source": "form",
  "externalId": "cust-0231"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/companies`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "44a8eb19-bcfd-401a-b2b6-c411f3db86cb",
    "name": "Hanul Ozana SRL",
    "cif": "RO39172541",
    "owner": "andrei-pop",
    "industry": "Inn and restaurant",
    "employees": 18,
    "town": "Târgu Neamț",
    "county": "Neamț",
    "source": "form",
    "externalId": "cust-0231"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/crm/v1/companies',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '44a8eb19-bcfd-401a-b2b6-c411f3db86cb',
        'name': 'Hanul Ozana SRL',
        'cif': 'RO39172541',
        'owner': 'andrei-pop',
        'industry': 'Inn and restaurant',
        'employees': 18,
        'town': 'Târgu Neamț',
        'county': 'Neamț',
        'source': 'form',
        'externalId': 'cust-0231',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "44a8eb19-bcfd-401a-b2b6-c411f3db86cb",
  "name": "Hanul Ozana SRL",
  "cif": "RO39172541",
  "owner": "andrei-pop",
  "industry": "Inn and restaurant",
  "employees": 18,
  "town": "Târgu Neamț",
  "county": "Neamț",
  "source": "form",
  "externalId": "cust-0231"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/companies');
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")}/crm/v1/companies");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "44a8eb19-bcfd-401a-b2b6-c411f3db86cb",
  "name": "Hanul Ozana SRL",
  "cif": "RO39172541",
  "owner": "andrei-pop",
  "industry": "Inn and restaurant",
  "employees": 18,
  "town": "Târgu Neamț",
  "county": "Neamț",
  "source": "form",
  "externalId": "cust-0231"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "44a8eb19-bcfd-401a-b2b6-c411f3db86cb",
  "status": "accepted",
  "aggregateRevision": 1
}
```

## Read the result

Look the operation up with the `operationId` you sent. When `status` is `completed`, the company exists.

curl

```bash
curl "$RDC_BASE_URL/crm/v1/operations/3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/operations/3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12`, {
  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"]}/crm/v1/operations/3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/operations/3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12');
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")}/crm/v1/operations/3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12");
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
{
  "operationId": "3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12",
  "status": "completed",
  "aggregateRevision": 1
}
```

| Status | Meaning |
| --- | --- |
| accepted | The request was recorded and is being applied. |
| completed | The change was applied. |
| rejected | The request was refused. Nothing was changed. |

## Find the company

The answer to a change does not carry the identifier of the new record. Ask for the company by your own number. The `id` in the answer is the `companyId` of the deals you create next. [Your own ids](https://crm.rdcopilot.com/docs/concepts/your-own-ids/) explains why.

curl

```bash
curl "$RDC_BASE_URL/crm/v1/companies?externalId=cust-0231" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/companies?externalId=cust-0231`, {
  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"]}/crm/v1/companies?externalId=cust-0231',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/companies?externalId=cust-0231');
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")}/crm/v1/companies?externalId=cust-0231");
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
{
  "items": [
    {
      "id": "61d54dde-e1f3-43da-b2fc-a4a21540e5f3",
      "name": "Hanul Ozana SRL",
      "cif": "RO39172541",
      "owner": "andrei-pop",
      "status": "customer",
      "industry": "Inn and restaurant",
      "employees": 18,
      "town": "Târgu Neamț",
      "county": "Neamț",
      "source": "form",
      "summary": {
        "text": "Inn and restaurant on the road to Târgu Neamț. The kitchen orders every week; a second delivery point for the events hall is being agreed.",
        "by": "andrei-pop",
        "at": "2026-11-16"
      },
      "externalId": "cust-0231",
      "customFields": {},
      "revision": 1
    }
  ],
  "nextCursor": null
}
```

## Create a deal

Send the deal with the `companyId` you just read. It starts as a lead, and the answer says that the change was accepted.

curl

```bash
curl -X POST "$RDC_BASE_URL/crm/v1/deals" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12",
  "companyId": "61d54dde-e1f3-43da-b2fc-a4a21540e5f3",
  "name": "First order for the kitchen",
  "owner": "andrei-pop",
  "value": "2818.41",
  "expectedClose": "2026-12-18",
  "externalId": "cust-0231-first-order"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/deals`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12",
    "companyId": "61d54dde-e1f3-43da-b2fc-a4a21540e5f3",
    "name": "First order for the kitchen",
    "owner": "andrei-pop",
    "value": "2818.41",
    "expectedClose": "2026-12-18",
    "externalId": "cust-0231-first-order"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/crm/v1/deals',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12',
        'companyId': '61d54dde-e1f3-43da-b2fc-a4a21540e5f3',
        'name': 'First order for the kitchen',
        'owner': 'andrei-pop',
        'value': '2818.41',
        'expectedClose': '2026-12-18',
        'externalId': 'cust-0231-first-order',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12",
  "companyId": "61d54dde-e1f3-43da-b2fc-a4a21540e5f3",
  "name": "First order for the kitchen",
  "owner": "andrei-pop",
  "value": "2818.41",
  "expectedClose": "2026-12-18",
  "externalId": "cust-0231-first-order"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/deals');
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")}/crm/v1/deals");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12",
  "companyId": "61d54dde-e1f3-43da-b2fc-a4a21540e5f3",
  "name": "First order for the kitchen",
  "owner": "andrei-pop",
  "value": "2818.41",
  "expectedClose": "2026-12-18",
  "externalId": "cust-0231-first-order"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12",
  "status": "accepted",
  "aggregateRevision": 1
}
```

## Read the deal

Find the deal by its own number. Note its `stage` and its `revision`: the next change to the deal sends the revision as `expectedRevision`.

curl

```bash
curl "$RDC_BASE_URL/crm/v1/deals?externalId=cust-0231-first-order" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/deals?externalId=cust-0231-first-order`, {
  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"]}/crm/v1/deals?externalId=cust-0231-first-order',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/deals?externalId=cust-0231-first-order');
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")}/crm/v1/deals?externalId=cust-0231-first-order");
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
{
  "items": [
    {
      "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
    }
  ],
  "nextCursor": null
}
```

Repeat a request with the same `operationId` after a timeout. The company and the deal are created once.

## Next

-   Move the deal on: [Move a deal through stages](https://crm.rdcopilot.com/docs/guides/move-a-deal-through-stages/).
-   Receive a message when it is won: [Subscriptions](https://crm.rdcopilot.com/docs/events/subscriptions/).
