Events API

Create, update, look up, list, and remove StreamLayer events from your backend over HTTP, using your own provider id or the StreamLayer event id.

An event is the StreamLayer entity linked to your stream — usually one game or broadcast. Everything you configure in StreamLayer Studio (games, promotions, features) hangs off an event, and your app opens an SDK session with that event's id.

Use the Events API to create events from your own scheduling system instead of creating them by hand in Studio. You give each event your own id (providerId), so you can address it later without storing the StreamLayer id.

📘

Full schema reference

Every field, response schema, and error is documented in the Events API OpenAPI reference.

Base URL and authentication

https://api.streamlayer.io/datasets

Authenticate every request with your Private API Key, sent as a bearer token:

Authorization: Bearer {PRIVATE_API_KEY}

Find the key in Studio under Settings → Developer → Private API Key. This is not the SDK Key you put in your app — keep the Private API Key on your server and never ship it in a client.

All endpoints are POST with a JSON body, except GET /get, which takes query parameters. Every request is scoped to the organization that owns the key, and kind is always "event".

MethodPathPurpose
POST/createCreate an event
POST/updateChange fields on an event
GET/getFetch one event
POST/listList your organization's events
POST/removeDetach an event from your org

Event ids

Every endpoint that targets one event takes an id. You can pass either:

  • Your provider id — the string you sent in event.raw.providerId on create, or
  • The StreamLayer id — the numeric id returned in data.event.id on create.

Create an event

POST /create

Required fields

FieldTypeDescription
kindstringAlways "event".
event.raw.providerIdstringYour own id for the event. Must be unique in your organization.

Minimal request

curl --location 'https://api.streamlayer.io/datasets/create' \
  --header 'Authorization: Bearer {PRIVATE_API_KEY}' \
  --header 'Content-Type: application/json' \
  --data '{
    "kind": "event",
    "event": {
      "raw": {
        "providerId": "match-2026-11-01-atl-mia"
      }
    }
  }'

With only a providerId, the event is scheduled for the time of the request, its status is 1 (pregame), and its name is set to Event YYYY-MM-DD.

Request with optional fields

curl --location 'https://api.streamlayer.io/datasets/create' \
  --header 'Authorization: Bearer {PRIVATE_API_KEY}' \
  --header 'Content-Type: application/json' \
  --data '{
    "kind": "event",
    "event": {
      "raw": {
        "providerId": "match-2026-11-01-atl-mia"
      },
      "scheduled": "2026-11-01T14:00:00.000Z",
      "status": 1,
      "venue": {
        "city": "Atlanta",
        "country": "USA",
        "stadium": "State Farm Arena"
      },
      "customFields": {
        "name": "ATL vs MIA",
        "logo": "https://example.com/logos/atl-mia.png"
      }
    }
  }'

Optional fields

FieldTypeDescription
scheduledstring (ISO 8601)Scheduled start time. Defaults to the time of the request.
statusintegerEvent status — see Event status values. Defaults to 1 (pregame).
startTimestring (ISO 8601)Actual start time.
endTimestring (ISO 8601)Actual end time.
venueobjectcity, country, stadium — strings, 1–128 characters each.
customFieldsobjectFree-form configuration stored with the event. name and logo set the event name and logo shown in Studio. You can add any other keys.
leaguenumberStreamLayer league id.
seasonnumberStreamLayer season id. Resolved from league when omitted.
homeTeamnumberStreamLayer team id of the home team.
awayTeamnumberStreamLayer team id of the away team.
endlessinteger0 unset, 1 enabled, 2 disabled.

Response

The new event is returned in data.event. Store data.event.id if you want to address the event by its StreamLayer id. Abbreviated example:

{
  "data": {
    "event": {
      "id": 4467,
      "attributes": {
        "id": 4467,
        "scheduled": "2026-11-01T14:00:00.000Z",
        "status": 1,
        "customFields": "{\"name\":\"ATL vs MIA\",\"logo\":\"https://example.com/logos/atl-mia.png\"}",
        "venue": { "city": "Atlanta", "country": "USA", "stadium": "State Farm Arena" }
      },
      "meta": {
        "created": "2026-10-05T12:00:00.000Z",
        "updated": "2026-10-05T12:00:00.000Z"
      }
    }
  }
}

Note that customFields comes back as a stringified JSON object.

If an event with the same providerId already exists in your organization, the API returns 409.

Update an event

POST /update

Only the fields you send are changed. Accepts the same event fields as create, except season.

FieldTypeRequiredDescription
kindstringYesAlways "event".
idstring or numberYesYour provider id or the StreamLayer id.
eventobjectYesFields to change. Send raw.providerId to re-point the event to a new provider id.
curl --location 'https://api.streamlayer.io/datasets/update' \
  --header 'Authorization: Bearer {PRIVATE_API_KEY}' \
  --header 'Content-Type: application/json' \
  --data '{
    "kind": "event",
    "id": "match-2026-11-01-atl-mia",
    "event": {
      "status": 2,
      "startTime": "2026-11-01T14:05:00.000Z"
    }
  }'

Get an event

GET /get?kind=event&id={id}

URL-encode the id if your provider id contains spaces or special characters.

curl --location 'https://api.streamlayer.io/datasets/get?kind=event&id=match-2026-11-01-atl-mia' \
  --header 'Authorization: Bearer {PRIVATE_API_KEY}'

Returns the event in data.event, including data.event.meta.raw with your provider id. Returns 404 if no event with that id belongs to your organization.

List events

POST /list

curl --location 'https://api.streamlayer.io/datasets/list' \
  --header 'Authorization: Bearer {PRIVATE_API_KEY}' \
  --header 'Content-Type: application/json' \
  --data '{
    "filter": {
      "kind": "event"
    },
    "sort": {
      "field": "scheduled",
      "order": "DESC"
    },
    "pagination": {
      "page": 1,
      "pageSize": 20
    }
  }'
FieldRequiredDescription
filter.kindYesAlways "event".
filter.leagueNoLeague id or alias, or an array of them.
sortNofield (default scheduled) and order (ASC or DESC, default DESC).
paginationNopage (default 1) and pageSize (default 100). Omit pagination entirely to return all events.
queryNoExtra conditions — see below.

The response returns events in data (an array) and the total number of matches, ignoring pagination, in meta.count.

Query conditions

query narrows the list further. Each operator takes an array of { "key", "value" } conditions:

OperatorValueMatches when the field…
eqstring or numberequals the value
nestring or numberdoes not equal the value
matchstringmatches the text (case-insensitive)
is"true", "false", "null"is true, false, or null
includesarray of stringsequals any value in the array
betweenarray of two stringsfalls between the two values (inclusive)

Example — events scheduled in November 2026:

{
  "filter": { "kind": "event" },
  "query": {
    "between": [
      { "key": "scheduled", "value": ["2026-11-01T00:00:00.000Z", "2026-11-30T23:59:59.999Z"] }
    ]
  }
}

Remove an event

POST /remove

Detaches the event from your organization. The underlying event record is kept.

curl --location 'https://api.streamlayer.io/datasets/remove' \
  --header 'Authorization: Bearer {PRIVATE_API_KEY}' \
  --header 'Content-Type: application/json' \
  --data '{
    "kind": "event",
    "id": 4467
  }'

Event status values

ValueStatus
0Unset
1Pregame
2Active
3Break
4Overtime
5Shootouts
6Postgame
7Cancelled

status is always returned as an integer.

Errors

Errors return JSON with statusCode, error, and message.

StatusWhen
400Validation failed, kind is not "event", or event.raw.providerId is missing on create.
401Authorization header is missing (missing authorization header), is not a Bearer token (wrong token type), or the key is invalid (invalid token).
404No event with this id belongs to your organization.
409On create: an event with this providerId already exists.

Related