> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gleap.io/llms.txt
> Use this file to discover all available pages before exploring further.

# REST

This package allows you to track server-side customer events.

## Identify users

```
POST https://api.gleap.io/admin/identify
```

**Request headers:**

```
Content-Type: application/json
Api-Token: YOUR_SECRET_API_TOKEN
```

Please replace *YOUR\_SECRET\_API\_TOKEN* with your secret API token, which can be found in your *project settings* -> *API token*.

**Request content:**

```
{
    "userId": "19283",
    "name": "John Doe",
    "email": "john@doe.com",
    "value": 1928,
    "phone": "+1 (129) 18283 8292",
    "createdAt": "2022-09-28T10:11:18.156Z",
    // You can also track custom user properties
}
```

### Last activity update

By default the last activity gets updated to `new Date()`. You can prevent this by adding `?preventLastActivityUpdate=true` to your request params.

```
POST https://api.gleap.io/admin/identify?preventLastActivityUpdate=true
```

## Track events

```
POST https://api.gleap.io/admin/track
```

**Request headers:**

```
Content-Type: application/json
Api-Token: YOUR_SECRET_API_TOKEN
```

**Request content:**

```
{
    "events": [{
            "date": "2022-09-28T10:11:18.156Z",
            "name": "Subscription started",
            "data": {
                "name": "Sub 1232",
                "value": 1200
            },
            "userId": "19283"
        }, {
            "date": "2022-09-28T10:11:18.156Z",
            "name": "Subscription canceled",
            "data": {
                "name": "Sub 1259",
                "value": 1200,
                "reason": "Stopped working on the project.",
            },
            "userId": "19283"
        }]
}
```

## Rate limit

Please note that the identify and track APIs do enforce a rate limit of 1000 requests / 60 seconds for every project.
