> 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.

# Register Live Session Attendance

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

Register the attendance of users in a live session.

Send `user_ids` to mark those users, or `all_participants: true` to mark
every participant of the session. The registration is processed in
background: a 202 means the request was accepted for the users reported in
`total_users_accepted`, and `errors` explains each user left out (already
registered, not found in the organization, inactive).

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/register-live-session-attendance

## 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 a RegisterLiveSessionAttendanceInput.

- `user_ids` (list of integer, optional) — Learning user ids to mark as attendees. Required unless all\_participants is true. 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)
- `all_participants` (boolean, optional, default: false) — Mark every participant of the session as an attendee; user_ids must be empty in that case

## Response

### 202

Attendance 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) — Attendance registration 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 registering the attendance

- `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 attendance could be registered (see errors for the reason of each user)

- `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
  ],
  "all_participants": false
}
```

**Response**

```json
{
  "message": "Attendance of 2 users in live session 1258 queued",
  "code": "LIVE_SESSION_ATTENDANCE_QUEUED",
  "datetime": "2026-09-16T10:30:00.000Z",
  "data": {
    "live_session_id": 1258,
    "total_users_requested": 2,
    "total_users_accepted": 2,
    "total_users_skipped": 0,
    "engagement_id": "908",
    "state": "SUBMITTED",
    "invalid_user_ids": [],
    "errors": []
  }
}
```

**SDK Code**

```python
import requests

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

payload = {
    "user_ids": [605275, 605276],
    "all_participants": False
}
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/attendance/';
const options = {
  method: 'POST',
  headers: {
    'Secret-Access': 'Secret-Access',
    'Api-Key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"user_ids":[605275,605276],"all_participants":false}'
};

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/attendance/"

	payload := strings.NewReader("{\n  \"user_ids\": [\n    605275,\n    605276\n  ],\n  \"all_participants\": false\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/attendance/")

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  \"all_participants\": false\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/attendance/")
  .header("Secret-Access", "Secret-Access")
  .header("Api-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"user_ids\": [\n    605275,\n    605276\n  ],\n  \"all_participants\": false\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/attendance/', [
  'body' => '{
  "user_ids": [
    605275,
    605276
  ],
  "all_participants": false
}',
  '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/attendance/");
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  \"all_participants\": false\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],
  "all_participants": false
] 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/attendance/")! 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()
```