> For the complete documentation index, see [llms.txt](https://kbase.whitelabel-loyalty.com/developer/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kbase.whitelabel-loyalty.com/developer/tutorials/reporting-your-first-event.md).

# Reporting your first event

## Overview

In this tutorial, you’ll report your first **private event** to the White Label Loyalty (WLL) API. You’ll practice authenticating with your event type secret and sending an event payload in **staging (Test) mode**.

By the end, you’ll be able to:

* Report a private event to the `/events` endpoint.
* Verify that the API accepted your event.

***

## Prerequisites

Before starting, make sure you have:

* Access to the Loyalty Console with your tenant and your **tenant API key**.
* A [user account created](https://kbase.whitelabel-loyalty.com/product/loyalty-engine/users/creating-users) in the **Test mode** of your console (the event reported in this tutorial will be linked to this user).
* A tool to make API requests (e.g. <kbd>curl</kbd>, Postman, or your preferred programming language).

***

## Instructions

{% stepper %}
{% step %}

### Create a private event type

Follow the instructions in [Creating event types](https://kbase.whitelabel-loyalty.com/product/loyalty-engine/events/event-types/creating-event-types) to create a private event type called <kbd>VISITED\_VENUE</kbd> using the Loyalty Console.

Once the event type is created, keep the event secret handy for the next steps.

<div data-with-frame="true"><figure><img src="/files/qowCDrJAvIfVO4BOslqU" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Set your base URL

All calls in this tutorial will use the **staging (Test) environment**:

```
https://api.staging.rewards.wlloyalty.net/v1
```

{% endstep %}

{% step %}

### Prepare your authorization header

You’ll use the event type **secret** to authenticate.

```
Authorization: Bearer <event_type_secret>
```

{% endstep %}

{% step %}

### Prepare the user ID

You need the user ID of the account you're reporting the event for.

1. In the Loyalty Console, go to **Users → Members**.
2. Select the intended user.
3. Copy the UUID visible under **ID** (e.g. `0e647aed-d12d-4b1c-9521-4ee122424e12`).
   {% endstep %}

{% step %}

### Send your first event

Here’s a minimal example using <kbd>curl</kbd>:

{% code expandable="true" %}

```bash
curl -X POST "https://api.staging.rewards.wlloyalty.net/v1/events" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <event_type_secret>" \
  -H "x-api-key: <your_tenant_api_key>" \
  -d '{
    "type": "VISITED_VENUE",
    "subject": "<user_id>",
    "payload": {
      "amountSpent": 100,
      "currency": "USD",
      "minutesSpent": 120,
    }
  }'
```

{% endcode %}

Here's an example in Node.js using <kbd>axios</kbd>:

{% code expandable="true" %}

```javascript
import axios from "axios";

const EVENT_TYPE_SECRET = "<event_type_secret>";
const EVENT_TYPE_NAME = "VISITED_VENUE";
const API_KEY = "<your_tenant_api_key>"

async function reportEvent() {
  const response = await axios.post(
    "https://api.staging.rewards.wlloyalty.net/v1/events",
    {
      type: EVENT_TYPE_NAME,
      subject: "<user_id>",
      properties: {
        amountSpent: 100,
        currency: "USD",
        minutesSpent: 120
      },
    },
    {
      headers: {
        Authorization: `Bearer ${EVENT_TYPE_SECRET}`,
        "Content-Type": "application/json",
        "x-api-key": API_KEY
      },
    }
  );

  console.log("Event reported:", response.data);
}

await reportEvent();
```

{% endcode %}
{% endstep %}

{% step %}

### Verify the response

* A successful response returns **200 OK** with the reported event payload.
* In the Loyalty Console, check the **Activity** section to confirm the event appears for the intended user.
  {% endstep %}
  {% endstepper %}

### Recap

* You authenticated using an **event type secret**.
* You reported a **private event** to the WLL API.
* You confirmed the event was accepted in staging mode for the intended user.

***

## Assessment

Try the following:

1. Change the `subject` from user `ID` to `accountNumber` or `authIdentifier` and send another event.
2. Add a custom property (e.g., `"venueId": "12345"`) to the event payload.
3. What response do you get if you use an invalid secret?

***

## Next steps

* See [Reporting events](https://kbase.whitelabel-loyalty.com/product/loyalty-engine/events/reporting-events) for deeper explanation
* See the [API reference for reporting events](https://docs.whitelabel-loyalty.com/rewards.html#events-events-collection-post) for all available fields
* Continue to the next tutorial, [Checking audience membership](/developer/tutorials/checking-audience-membership.md)

***
