---
title: "Getting started with the Events API"
slug: "getting-started-with-the-events-api"
abstract: "Describes how to get started with the Events API."
---
# Getting started with the Events API

When integrating using REST APIs, you must use the Events API to track events and send them to Discover. In this integration option, the event object is the same as the one used with the runtime JS integration, except for some additional required keys.

The following table lists the additional keys required by the event object when making calls to the Events API, regardless of whether or not you use the [Discover beacon](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/integrate-using-discover-rest-apis/integrate-using-the-events-api/using-the-sitecore-discover-beacon.md "Using the Sitecore Discover beacon"):

| Key | Type | Description |
| --- | --- | --- |
| user_id OR uuid | string | Required.Anonymous user identifier.NoteIf beacon is present, use rfk.uid() to obtain uuid. If not, you must create your own user_id. |
| t | number | Required.Client (browser) epoch time, in milliseconds. |
| t0 | number | Required.Page load epoch time (when page was loaded), in milliseconds. |
| value.context.geo | geo object | Required.The user's location information. Located in the event object. |
| value.context.browser | browser object | Required.The user's browser information. Located in the event object. |

> [!note]
> Events submitted using the REST API do not include the actual HTTP headers of the user browsing the site. You must send these additional attributes about the user using the [geo object](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/integrate-using-discover-rest-apis/integrate-using-the-events-api/the-geo-object.html "The geo object") and the [browser object](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/integrate-using-discover-rest-apis/integrate-using-the-events-api/the-browser-object.html "The browser object").

The following is an example of a widget event object in an Events API request:

```JSON
{    
  "value": {        
    "context": {            
      "page": {                
        "uri": "/catalogsearch/result"            
      },            
      "geo": {                
        "ip": "<user's IP address>"            
      },            
      "browser": {                
        "user_agent": "<user agent>"            
      }        
    },        
    "rfkid": "rfkid_7",        
    "f": "sp"    
  },    
  "type": "widget",    
  "name": "appear",    
  "t": 1625144306397,    
  "t0": 1625144306397,    
  "uuid": "<uuid obtained using rfk.uid()>"
}
```

<details>
<summary><h2>Calling the Events API</h2></summary>

Method: `GET` or `POST`

The following table lists the keys for the Events API request:

| Key | Type | Description | Value |
| --- | --- | --- | --- |
| `data` | JSON string | Required.<br><br>JSON representing the [event object](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/integrate-using-discover-rest-apis/integrate-using-the-events-api/the-event-object-model.md "The event object model"). |     |
| `json` | integer | Optional.<br><br>Indicates whether to get pixel or JSON response. | 0 - pixel response (default)<br><br>1 - JSON response |

The following is an example of a `GET` request to the Events API:

```shell
GET {EVENT_URL}?data={<event object>}
```

The following is an example of a `POST` request to the Events API:

```shell
POST {EVENT_URL}
{
 "data": "{<event object>}"
}
```

</details>

<details>
<summary><h2>The Events API and the Discover beacon</h2></summary>

If you have included the [Discover beacon](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/integrate-using-discover-rest-apis/integrate-using-the-events-api/using-the-sitecore-discover-beacon.md "Using the Sitecore Discover beacon") on your site, you can take advantage of some of its functionality when integrating using REST APIs. The beacon takes care of the following considerations:

- *Anonymous user identifier* - When using the Events REST API, the event object must include an anonymous user identifier that is used to [track user behavior](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/integrate-using-discover-rest-apis/integrate-using-the-events-api/tracking-site-visitor-information.md "Tracking site visitor information"). If you include the Discover beacon on your site, Discover automatically creates a temporary, anonymous user ID (`uuid` )for each user. If you do not include the beacon, you must [create your own `user_id`.](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/integrate-using-discover-rest-apis/integrate-using-the-events-api/tracking-site-visitors-using-rest-apis.md "Tracking site visitors using REST APIs")
- *Product detail page views* - When present, the Discover beacon automatically captures page view events and sends them to Discover. These events are converted to product views based on URI resolution. If you have not included the beacon on your site, product detail page view events are not automatically reported. You must therefore manually track [`pdp:view` events.](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/integrate-using-discover-rest-apis/integrate-using-the-events-api/getting-started-with-the-events-api/send-a-funnel-event-using-the-events-rest-api.html "Send a funnel event using the Events REST API")

</details>