---
description: Connect any JSON endpoint as the schedule source of an API event — authentication and where the credentials go, locating the sessions in the response, mapping their fields, date formats, and the single-request limit.
---

# Universal API

The standard integrations (Cvent, Preseria, SUBS, Swapcard, RainFocus, …) know their source
systems' formats out of the box. For any *other* REST API that can return your schedule
as JSON, create the event as a **Universal API** event and describe the format yourself in
the **Data Integration Configuration** dialog (Event Settings).

The configuration answers three questions: how to authenticate, where the items are in the
response, and which source fields map to the fields Onlit needs.

Each schedule fetch reads one JSON response from the configured API URL. The
required session, room and time fields must be available within that response.
Universal API does not combine schedule data from multiple API requests or fetch
additional pages of results. If the source requires that work, use a custom
integration or provide a combined feed that meets these requirements. Authentication
may make a separate token request; this limit concerns the schedule data itself.

## Creating the event

Choose **Universal API** as the event type in **Add Event** and pick the **Event Room
Identity Mode**: **Code** if the source has a stable room identifier, **Title** if room
names are all it provides. The mode cannot be changed later; what it means for sign URLs
is explained in [Room identity and renames](room_identity.md). Then open **Event
Settings → Configure Data Integration** and fill in the dialog. An event holds one
configuration; **Remove Configuration** deletes it so you can start over.

## Authentication

| Type | Use when |
|---|---|
| **None** | The endpoint is publicly accessible |
| **Basic Auth** | Username/password sent with each request |
| **OAuth 2.0** | The API issues access tokens from a **Token Endpoint** (client credentials) |
| **API Key** | A key sent as a request header — you can set the header name (defaults to `x-api-key`) |

The API URL itself, the polling interval, and the API Enabled toggle are in the event's
general settings, like any other [API event](api_events.md).

The secrets go into the general settings too, not into the dialog:

| Type | API Username | API Password | Additional API Headers |
|---|---|---|---|
| **None** | leave empty (if both are set they are sent as basic authentication anyway) | | sent |
| **Basic Auth** | the user name | the password | sent |
| **OAuth 2.0** | the client ID | the client secret | sent |
| **API Key** | any placeholder, for example `api-key` — the value is never sent, but the settings refuse to save a password without a username | the key, sent in the header named in the dialog | **not sent** |

With OAuth 2.0, Onlit requests a token from the **Token Endpoint** with the client
credentials, keeps it for the event and renews it before it expires.

**API Key** sends exactly one header: the name from the dialog with the API Password as
its value. It ignores Additional API Headers, so a source that needs several headers — a
key plus a tenant or version header, say — is set up as **None** with every header,
including the key, entered under Additional API Headers; those are sent with every
request.

## Locating the data

- **Root Data Path** — where the list of items sits inside the JSON response (for
  example `data.sessions` when the response wraps the list). Leave it empty when the
  response *is* the list. A path that does not match the response, or that points at a
  single value instead of an object or list, fails the sync with **Root Data Path did not
  match response JSON** or **Root Data Path must resolve to an object or array**.
- **List Expansion Field** (optional) — when each element contains a nested list of the
  actual items (for example a session with multiple time slots), name that field and each
  nested entry is imported as its own item, with the parent's fields underneath it.

Paths use **dot notation**: `data.sessions`, `location.name`. A path written with slashes
(`data/sessions`) is rejected when you save.

## Field mapping

Map your API's field names onto the fields the system requires:

| Field | Notes |
|---|---|
| **Unique ID / Pattern** | A field name (`id`), or a pattern combining fields in curly brackets (`{id}-{title}`) when no single source field is unique. Resolved once per sync before [field rules](field_rules.md) run and stored on the item as the protected field `_unique_id`; the source field(s) it is built from stay filterable |
| **Item Title** | required |
| **Room Name** | required |
| **Start Time / End Time** | required; parsed with the chosen **DateTime Format** (below) |
| **Room Code** | required in *Code* room-identity mode; not shown in *Title* mode |

Whether Room Code appears depends on the **Event Room Identity Mode** you chose when
creating the Universal API event (see [Room identity and renames](room_identity.md) for
the consequences). The mapped values are copied as text onto the canonical fields; the
source fields they came from stay in the item as well.

Everything else in the source item is imported as-is into the item's JSON Data, available
to templates — use [item filters](item_filters.md) and [field rules](field_rules.md) to
skip items or trim fields you don't want.

## Date and time formats

| DateTime Format | Accepts |
|---|---|
| **ISO-8601** | `2024-01-20T10:30:00Z`, `2024-01-20T10:30:00+02:00` and the other ISO date-time forms; the offset is honored and the time converted to the event's time zone |
| **SQL Standard** | `2023-10-05 14:30:00`, read in the event's time zone |
| **Custom** | A Java date-time pattern such as `yyyy/MM/dd hh:mm a`; if the pattern contains an offset or zone, it is honored, otherwise the event's time zone applies |

!!! note "Daylight-saving changes"
    A format without an offset is read as wall-clock time in the event's time zone. On
    the night the clocks go forward, a time inside the skipped hour is shifted forward to
    the next valid time; on the night they go back, an ambiguous time takes the first
    occurrence. Use a format with an offset if the source can provide one.

## Related

- [Syncing and API health](api_events.md)
- [API event settings](event_settings.md)
- [Item filters](item_filters.md) and [Field rules](field_rules.md)
- [Editing scheduled item JSON](../events/editing_item_json.md)
- [Troubleshooting integrations](troubleshooting.md)
