> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developer.crehana.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developer.crehana.com/_mcp/server.

# Assign Live Session Participants

POST https://www.crehana.com/api/v5/rest/org/{organization_slug}/learning/live-sessions/{live_session_id}/participants/
Content-Type: application/json

Invite users to a live session.

The assignment is processed in background: a 202 means the request was
accepted for the users reported in `total_users_accepted`. Users that do
not belong to the organization come back in `invalid_user_ids` and are not
assigned; when none of them does, the response is a 422.

User ids are learning user ids: take them from `user.id` in
`GET /org/{organization_slug}/learning/users/` or from `learning_user_id` in
`GET /org/{organization_slug}/users/user-organizations/` (where `user.id`
is the centralized id). A centralized user id targets a different person.

Reference: https://developer.crehana.com/api-reference/endpoints/live-sessions/assign-live-session-participants

## Authentication

- `Api-Key` header (required) — API key of the organization. Always sent together with the `Secret-Access` header.

## Servers

- `https://www.crehana.com` (Production, default)
- `https://qa.creha.co` (QA)

## Request

### Path parameters

- `organization_slug` (string, required)
- `live_session_id` (integer, required) — Id of the live session, as returned by GET

### Body (application/json)

This endpoint expects an AssignLiveSessionParticipantsInput.

- `user_ids` (list of integer, required) — Learning user ids to invite. These are learning user ids, not the centralized\_user\_id used by the users and enrollments endpoints: sending one in place of the other targets a different person. Get them from user.id in GET /org/\{organization\_slug}/learning/users/ (filter with user\_email; results\[].id is the membership id, not the user id), or from learning\_user\_id in GET /org/\{organization\_slug}/users/user-organizations/ (there user.id is the centralized id)
- `send_notification` (boolean, optional, default: false) — Send the invitation email to the assigned users, when the organization has that notification enabled

## Response

### 202

Assignment queued for background processing

- `message` (string, required) — Message of the response
- `code` (string, required) — Internal code of the response
- `datetime` (string, required) — Datetime of the API in ISO Format
- `data` (LiveSessionEngagementData, optional) — Participants assignment details

## Errors

### 400 Bad Request Error

Validation error reported by the learning service

- `message` (string, required) — Message of the error
- `code` (string, required) — Internal code of the error
- `datetime` (string, required) — Datetime of the API in ISO Format
- `detail` (string, required) — Detail of the error

### 401 Unauthorized Error

Unauthorized - Invalid or missing credentials

- `any`

### 403 Forbidden Error

The credentials do not give access to that organization

- `message` (string, required) — Message of the error
- `code` (string, required) — Internal code of the error
- `datetime` (string, required) — Datetime of the API in ISO Format
- `detail` (string, required) — Detail of the error

### 404 Not Found Error

The live session does not exist in the organization

- `message` (string, required) — Message of the error
- `code` (string, required) — Internal code of the error
- `datetime` (string, required) — Datetime of the API in ISO Format
- `detail` (string, required) — Detail of the error

### 409 Conflict Error

Integrity error while assigning the participants

- `message` (string, required) — Message of the error
- `code` (string, required) — Internal code of the error
- `datetime` (string, required) — Datetime of the API in ISO Format
- `detail` (string, required) — Detail of the error

### 422 Unprocessable Entity Error

No user could be assigned (none of them belongs to the organization)

- `any`

### 500 Internal Server Error

Internal server error

- `message` (string, required) — Message of the error
- `code` (string, required) — Internal code of the error
- `datetime` (string, required) — Datetime of the API in ISO Format
- `detail` (string, required) — Detail of the error

## Types

### LiveSessionEngagementData

Result of an assignment or attendance request. Both are processed in background: the response confirms what was accepted, not what is already applied.

- `live_session_id` (integer, required) — Session the request was sent to
- `total_users_requested` (integer, required) — Users included in the request
- `total_users_accepted` (integer, required) — Users accepted for background processing
- `total_users_skipped` (integer, required) — Requested users that were not accepted
- `engagement_id` (string, optional) — Id of the background process the learning service registered for this request. It comes even when no user was accepted (the process exists and reports why in errors), and is null only when the service registered no process at all
- `state` (string, optional) — SUBMITTED (queued), PROCESSING, FINISHED or VALIDATED, as reported by the learning service
- `invalid_user_ids` (list of integer, optional) — Requested user ids that do not belong to the organization (or are no longer active in it)
- `errors` (list of string, optional) — Reason each skipped user was rejected, as reported by the learning service (already registered, not found in the organization, inactive)

## Examples

**Request**

```json
{
  "user_ids": [
    605275,
    605276
  ],
  "send_notification": true
}
```

**Response**

```json
{
  "message": "Assignment of 2 users in live session 1258 queued",
  "code": "LIVE_SESSION_PARTICIPANTS_QUEUED",
  "datetime": "2026-09-16T10:30:00.000Z",
  "data": {
    "live_session_id": 1258,
    "total_users_requested": 3,
    "total_users_accepted": 2,
    "total_users_skipped": 1,
    "engagement_id": "907",
    "state": "SUBMITTED",
    "invalid_user_ids": [
      605999
    ],
    "errors": []
  }
}
```

**SDK Code**

```python
import requests

url = "https://www.crehana.com/api/v5/rest/org/organization_slug/learning/live-sessions/1/participants/"

payload = {
    "user_ids": [605275, 605276],
    "send_notification": True
}
headers = {
    "Secret-Access": "Secret-Access",
    "Api-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://www.crehana.com/api/v5/rest/org/organization_slug/learning/live-sessions/1/participants/';
const options = {
  method: 'POST',
  headers: {
    'Secret-Access': 'Secret-Access',
    'Api-Key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"user_ids":[605275,605276],"send_notification":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://www.crehana.com/api/v5/rest/org/organization_slug/learning/live-sessions/1/participants/"

	payload := strings.NewReader("{\n  \"user_ids\": [\n    605275,\n    605276\n  ],\n  \"send_notification\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Secret-Access", "Secret-Access")
	req.Header.Add("Api-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://www.crehana.com/api/v5/rest/org/organization_slug/learning/live-sessions/1/participants/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Secret-Access"] = 'Secret-Access'
request["Api-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"user_ids\": [\n    605275,\n    605276\n  ],\n  \"send_notification\": true\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://www.crehana.com/api/v5/rest/org/organization_slug/learning/live-sessions/1/participants/")
  .header("Secret-Access", "Secret-Access")
  .header("Api-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"user_ids\": [\n    605275,\n    605276\n  ],\n  \"send_notification\": true\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://www.crehana.com/api/v5/rest/org/organization_slug/learning/live-sessions/1/participants/', [
  'body' => '{
  "user_ids": [
    605275,
    605276
  ],
  "send_notification": true
}',
  'headers' => [
    'Api-Key' => '<apiKey>',
    'Content-Type' => 'application/json',
    'Secret-Access' => 'Secret-Access',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://www.crehana.com/api/v5/rest/org/organization_slug/learning/live-sessions/1/participants/");
var request = new RestRequest(Method.POST);
request.AddHeader("Secret-Access", "Secret-Access");
request.AddHeader("Api-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"user_ids\": [\n    605275,\n    605276\n  ],\n  \"send_notification\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Secret-Access": "Secret-Access",
  "Api-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "user_ids": [605275, 605276],
  "send_notification": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://www.crehana.com/api/v5/rest/org/organization_slug/learning/live-sessions/1/participants/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```