---
title: "Sync users from HR | Docs | eLearning by R&D Copilot"
description: "Keep learner IDs stable when people change teams or names."
canonical: "https://elearning.rdcopilot.com/docs/guides/sync-users-from-hr/"
language: en
updated: 2026-11-22
---

# Sync users from HR

Keep learner IDs stable when people change teams or names.

## Write users before membership

Look up the HR identifier with the `id` filter. Send revision zero for a new user and the current revision for an update. Wait for the operation to complete before including the user in a group.

curl

```bash
curl "$RDC_BASE_URL/elearning/v1/users" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

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

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/elearning/v1/users');
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")}/elearning/v1/users");
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": "radu-ionescu",
      "name": "Radu Ionescu",
      "department": "logistics",
      "revision": 1
    }
  ],
  "nextCursor": null
}
```

curl

```bash
curl -X POST "$RDC_BASE_URL/elearning/v1/users" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "4e08713a-ec34-4a5a-92d3-81fd42564002",
  "expectedRevision": 0,
  "id": "radu-ionescu",
  "name": "Radu Ionescu",
  "department": "logistics"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/elearning/v1/users`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "4e08713a-ec34-4a5a-92d3-81fd42564002",
    "expectedRevision": 0,
    "id": "radu-ionescu",
    "name": "Radu Ionescu",
    "department": "logistics"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/elearning/v1/users',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '4e08713a-ec34-4a5a-92d3-81fd42564002',
        'expectedRevision': 0,
        'id': 'radu-ionescu',
        'name': 'Radu Ionescu',
        'department': 'logistics',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "4e08713a-ec34-4a5a-92d3-81fd42564002",
  "expectedRevision": 0,
  "id": "radu-ionescu",
  "name": "Radu Ionescu",
  "department": "logistics"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/elearning/v1/users');
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")}/elearning/v1/users");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "4e08713a-ec34-4a5a-92d3-81fd42564002",
  "expectedRevision": 0,
  "id": "radu-ionescu",
  "name": "Radu Ionescu",
  "department": "logistics"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "4e08713a-ec34-4a5a-92d3-81fd42564002",
  "status": "accepted",
  "aggregateRevision": null
}
```

curl

```bash
curl -X POST "$RDC_BASE_URL/elearning/v1/groups" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "4e08713a-ec34-4a5a-92d3-81fd42564003",
  "expectedRevision": 0,
  "id": "logistics",
  "name": "Logistics",
  "userIds": [
    "radu-ionescu"
  ]
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/elearning/v1/groups`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "4e08713a-ec34-4a5a-92d3-81fd42564003",
    "expectedRevision": 0,
    "id": "logistics",
    "name": "Logistics",
    "userIds": [
      "radu-ionescu"
    ]
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/elearning/v1/groups',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '4e08713a-ec34-4a5a-92d3-81fd42564003',
        'expectedRevision': 0,
        'id': 'logistics',
        'name': 'Logistics',
        'userIds': [
            'radu-ionescu',
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "4e08713a-ec34-4a5a-92d3-81fd42564003",
  "expectedRevision": 0,
  "id": "logistics",
  "name": "Logistics",
  "userIds": [
    "radu-ionescu"
  ]
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/elearning/v1/groups');
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")}/elearning/v1/groups");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "4e08713a-ec34-4a5a-92d3-81fd42564003",
  "expectedRevision": 0,
  "id": "logistics",
  "name": "Logistics",
  "userIds": [
    "radu-ionescu"
  ]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "4e08713a-ec34-4a5a-92d3-81fd42564003",
  "status": "accepted",
  "aggregateRevision": null
}
```

Send the full membership list. If a revision conflicts, read the group again and recalculate membership before issuing a new operation.
