---
title: Complete Example — Event Lifecycle
url: https://docs.kaltura.com/docs/events-collaboration/events-platform-api/events-platform-complete-example-event-lifecycle
---

## Complete Example — Event Lifecycle

Generate a KS with `userId` via `session.start` (see [Session Guide](/docs/getting-started/authentication/ks-overview)) and set the shell variables:

```bash
# Prerequisites: set these shell variables before running the commands below
# KALTURA_EVENTS_API_URL="https://events-api.nvp1.ovp.kaltura.com/api/v1"
# KALTURA_KS="<your KS with userId>"
```

```bash
# --- Step 1: Create an event ---
curl -X POST "$KALTURA_EVENTS_API_URL/events/create" \
  -H "Authorization: Bearer $KALTURA_KS" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "API Demo Event",
    "templateId": "tm0000",
    "startDate": "2024-12-22T15:00:00.000Z",
    "endDate": "2024-12-22T17:00:00.000Z",
    "timezone": "America/New_York",
    "description": "Created via Events Platform API"
  }'
# Save the "id" from the response as EVENT_ID

# --- Step 2: Add a live webcast session ---
curl -X POST "$KALTURA_EVENTS_API_URL/sessions/create" \
  -H "Authorization: Bearer $KALTURA_KS" \
  -H "Content-Type: application/json" \
  -d "{
    \"eventId\": $EVENT_ID,
    \"session\": {
      \"name\": \"Main Stage\",
      \"type\": \"LiveWebcast\",
      \"startDate\": \"2024-12-22T15:00:00.000Z\",
      \"endDate\": \"2024-12-22T17:00:00.000Z\",
      \"visibility\": \"published\"
    }
  }"

# --- Step 3: List all events ---
curl -X POST "$KALTURA_EVENTS_API_URL/events/list" \
  -H "Authorization: Bearer $KALTURA_KS" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": {"searchTerm": " "},
    "orderBy": "-startDate",
    "pager": {"offset": 0, "limit": 15}
  }'

# --- Step 4: Update the event ---
curl -X POST "$KALTURA_EVENTS_API_URL/events/update" \
  -H "Authorization: Bearer $KALTURA_KS" \
  -H "Content-Type: application/json" \
  -d "{
    \"id\": $EVENT_ID,
    \"name\": \"Updated API Demo Event\",
    \"labels\": [\"demo\", \"api-test\"]
  }"

# --- Step 5: Delete the event ---
curl -X POST "$KALTURA_EVENTS_API_URL/events/delete" \
  -H "Authorization: Bearer $KALTURA_KS" \
  -H "Content-Type: application/json" \
  -d "{\"id\": $EVENT_ID}"
```
