---
title: "Connect a device | Docs | IoT by R&D Copilot"
description: "Register the device identity before sending readings."
canonical: "https://iot.rdcopilot.com/docs/get-started/connect-a-device/"
language: en
updated: 2026-11-22
---

# Connect a device

Register the device identity before sending readings.

Select its asset, connection kind and your own `externalId`. The identifier remains stable when firmware or the network changes. The service refuses a duplicate external identifier.

curl

```bash
curl -X POST "$RDC_BASE_URL/iot/v1/devices" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "a1000000-0000-4000-8000-000000000001",
  "expectedRevision": 0,
  "name": "Air temperature probe",
  "assetId": "cold-room-2",
  "connection": "LoRaWAN",
  "externalId": "cold-room-2-air-probe"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/iot/v1/devices`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "a1000000-0000-4000-8000-000000000001",
    "expectedRevision": 0,
    "name": "Air temperature probe",
    "assetId": "cold-room-2",
    "connection": "LoRaWAN",
    "externalId": "cold-room-2-air-probe"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/iot/v1/devices',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'a1000000-0000-4000-8000-000000000001',
        'expectedRevision': 0,
        'name': 'Air temperature probe',
        'assetId': 'cold-room-2',
        'connection': 'LoRaWAN',
        'externalId': 'cold-room-2-air-probe',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "a1000000-0000-4000-8000-000000000001",
  "expectedRevision": 0,
  "name": "Air temperature probe",
  "assetId": "cold-room-2",
  "connection": "LoRaWAN",
  "externalId": "cold-room-2-air-probe"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/iot/v1/devices');
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")}/iot/v1/devices");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "a1000000-0000-4000-8000-000000000001",
  "expectedRevision": 0,
  "name": "Air temperature probe",
  "assetId": "cold-room-2",
  "connection": "LoRaWAN",
  "externalId": "cold-room-2-air-probe"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "a1000000-0000-4000-8000-000000000001",
  "status": "accepted",
  "aggregateRevision": 1
}
```

After the operation completes, query devices with `externalId` to obtain the assigned `id`. Connection credentials and the ingestion address are issued for this device through the account setup; do not reuse the API client secret on the sensor.

curl

```bash
curl "$RDC_BASE_URL/iot/v1/devices?limit=20" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

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

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/iot/v1/devices?limit=20');
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")}/iot/v1/devices?limit=20");
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": "device-12",
      "name": "Air temperature probe",
      "assetId": "cold-room-2",
      "connection": "LoRaWAN",
      "online": true,
      "lastHeard": "2026-11-20T09:10:50Z",
      "firmware": "2.4.1",
      "signal": -74,
      "battery": 68,
      "revision": 1,
      "externalId": "cold-room-2-air-probe"
    }
  ],
  "nextCursor": null
}
```

Confirm that `lastHeard` advances after a reading. An offline device can still have historical values. Follow the connectivity page for your link and [Streaming](https://iot.rdcopilot.com/docs/data/streaming/) for recovery.
