In order to access the admin API endpoints you need to identify yourself. Unless you're using the `none` authentication method, you'll need to [create an ADMIN token](/user_guide/api-token) and add an Authorization header using the token.
| `project` | When applied, the endpoint will only return events from the given project. | No |
When called without any query parameters, the endpoint will return the **last 100 events** from the Unleash instance. When called with a `project` query parameter, it will return only events related to that project, but it will return **all the events**, and not just the last 100.
#### Get events by project
<ApiRequestverb="get"url="api/admin/events?project=<project-name>"title="Retrieve all events belonging to the given project."/>
Use the `project` query parameter to make the API return *all* events pertaining to the given project.
#### Responses
<details>
<summary>Responses</summary>
##### 200 OK
The last 100 events from the Unleash server when called without a `project` query parameter.
When called with a `project` query parameter: all events related to that project.
``` json title="Successful response; a list of events"
{
"version": 1,
"events": [
{
"id": 842,
"type": "feature-environment-enabled",
"createdBy": "user@company.com",
"createdAt": "2022-05-12T08:49:49.521Z",
"data": null,
"preData": null,
"tags": [],
"featureName": "my-constrained-toggle",
"project": "my-project",
"environment": "development"
},
{
"id": 841,
"type": "feature-environment-disabled",
"createdBy": "user@company.com",
"createdAt": "2022-05-12T08:49:45.986Z",
"data": null,
"preData": null,
"tags": [],
"featureName": "my-constrained-toggle",
"project": "my-project",
"environment": "development"
}
]
}
```
</details>
### Get events for a specific toggle
<ApiRequestverb="get"url="api/admin/events/<toggle-name>"title="Retrieve all events related to the given toggle."/>
Fetch all events related to a specified toggle.
#### Responses
<details>
<summary>Responses</summary>
###### 200 OK
The list of events related to the given toggle.
``` json title="Successful response; all events relating to the specified toggle"
{
"toggleName": "my-constrained-toggle",
"events": [
{
"id": 842,
"type": "feature-environment-enabled",
"createdBy": "user@company.com",
"createdAt": "2022-05-12T08:49:49.521Z",
"data": null,
"preData": null,
"tags": [],
"featureName": "my-constrained-toggle",
"project": "my-project",
"environment": "development"
},
{
"id": 841,
"type": "feature-environment-disabled",
"createdBy": "user@company.com",
"createdAt": "2022-05-12T08:49:45.986Z",
"data": null,
"preData": null,
"tags": [],
"featureName": "my-constrained-toggle",
"project": "my-project",
"environment": "development"
}
]
}
```
</details>
## Event type description
Unleash emits a large number of different events (described in more detail in the next sections). The exact fields an event contains varies from event to event, but they all conform to the following TypeScript interface before being transformed to JSON:
The event properties are described in short in the table below. For more info regarding specific event types, refer to the corresponding, following sections.
| `createdAt` | The time the event happened as a RFC 3339-conformant timestamp. |
| `data` | Extra associated data related to the event, such as feature toggle state, segment configuration, etc., if applicable. |
| `environment` | The feature toggle environment the event relates to, if applicable. |
| `featureName` | The name of the feature toggle the event relates to, if applicable. |
| `id` | The ID of the event. An increasing natural number. |
| `preData` | Data relating to the previous state of the event's subject. |
| `project` | The project the event relates to, if applicable. |
| `tags` | Any tags related to the event, if applicable. |
| `type` | The event type, as described in the rest of this section. |
## Feature toggle events
These events pertain to feature toggles and their life cycle.
### `feature-created`
This event fires when you create a feature. The `data` property contains the details for the new feature.
``` json title="example event: feature-created"
{
"id": 899,
"type": "feature-created",
"createdBy": "user@company.com",
"createdAt": "2022-05-31T13:32:20.560Z",
"data": {
"name": "new-feature",
"description": "Toggle description",
"type": "release",
"project": "my-project",
"stale": false,
"variants": [],
"createdAt": "2022-05-31T13:32:20.547Z",
"lastSeenAt": null,
"impressionData": true
},
"preData": null,
"tags": [],
"featureName": "new-feature",
"project": "my-project",
"environment": null
}
```
### `feature-updated`
:::caution Deprecation notice
This event type was replaced by more granular event types in Unleash 4.3. From Unleash 4.3 onwards, you'll need to use the events listed later in this section instead.
:::
This event fires when a feature gets updated in some way. The `data` property contains the new state of the toggle. This is a legacy event, so it does not populate `preData` property.
``` json title="example event: feature-updated"
{
"id": 899,
"type": "feature-updated",
"createdBy": "user@company.com",
"createdAt": "2022-05-31T13:32:20.560Z",
"data": {
"name": "new-feature",
"description": "Toggle description",
"type": "release",
"project": "my-project",
"stale": false,
"variants": [],
"createdAt": "2022-05-31T13:32:20.547Z",
"lastSeenAt": null,
"impressionData": true
},
"preData": null,
"tags": [],
"featureName": "new-feature",
"project": "my-project",
"environment": null
}
```
### `feature-deleted`
This event fires when you delete a feature toggle. The `preData` property contains the deleted toggle data.
``` json title="example event: feature-deleted"
{
"id": 903,
"type": "feature-deleted",
"createdBy": "admin-account",
"createdAt": "2022-05-31T14:06:14.574Z",
"data": null,
"preData": {
"name": "new-feature",
"type": "experiment",
"stale": false,
"project": "my-project",
"variants": [],
"createdAt": "2022-05-31T13:32:20.547Z",
"lastSeenAt": null,
"description": "Toggle description",
"impressionData": true
},
"tags": [],
"featureName": "new-feature",
"project": "my-project",
"environment": null
}
```
### `feature-archived`
This event fires when you archive a toggle.
``` json title="example event: feature-archived"
{
"id": 902,
"type": "feature-archived",
"createdBy": "user@company.com",
"createdAt": "2022-05-31T14:04:38.661Z",
"data": null,
"preData": null,
"tags": [],
"featureName": "new-feature",
"project": "my-project",
"environment": null
}
```
### `feature-revived`
This event fires when you revive an archived feature toggle (when you take a toggle out from the archive).
``` json title="example-event: feature-revived"
{
"id": 914,
"type": "feature-revived",
"createdBy": "user@company.com",
"createdAt": "2022-06-01T09:57:10.719Z",
"data": null,
"preData": null,
"tags": [],
"featureName": "new-feature",
"project": "my-other-project",
"environment": null
}
```
### `feature-metadata-updated`
This event fires when a feature's metadata (its description, toggle type, or impression data settings) are changed. The `data` property contains the new toggle data. The `preData` property contains the toggle's previous data.
The below example changes the toggle's type from *release* to *experiment*.
This event fires when you update a feature strategy. The `data` property contains the new strategy configuration. The `preData` property contains the previous strategy configuration.
This event fires when you create a new user. The `data` property contains the user's information.
``` json title="example event: user-created"
{
"id": 965,
"type": "user-created",
"createdBy": "user@company.com",
"createdAt": "2022-06-03T10:23:47.713Z",
"data": {
"id": 44,
"name": "New User Name",
"email": "newuser@company.com"
},
"preData": null,
"tags": [],
"featureName": null,
"project": null,
"environment": null
}
```
### `user-updated`
This event fires when you update a user. The `data` property contains the updated user information; the `preData` property contains the previous state of the user's information.
``` json title="example event: user-updated"
{
"id": 967,
"type": "user-updated",
"createdBy": "user@company.com",
"createdAt": "2022-06-03T10:24:26.301Z",
"data": {
"id": 44,
"name": "New User's Name",
"email": "newuser@company.com"
},
"preData": {
"id": 44,
"name": "New User Name",
"email": "newuser@company.com"
},
"tags": [],
"featureName": null,
"project": null,
"environment": null
}
```
### `user-deleted`
This event fires when you delete a user. The `preData` property contains the deleted user's information.
``` json title="example event: user-deleted"
{
"id": 968,
"type": "user-deleted",
"createdBy": "user@company.com",
"createdAt": "2022-06-03T10:24:49.153Z",
"data": null,
"preData": {
"id": 44,
"name": "New User's Name",
"email": "newuser@company.com"
},
"tags": [],
"featureName": null,
"project": null,
"environment": null
}
```
## Environment events
### `environment-import`
This event fires when you import an environment (custom or otherwise) as part of an import job. The `data` property contains the configuration of the imported environment.
This event fires when you delete existing environments as part of an import job.
The `data.name` property will always be `"all-environments"`.
``` json title="example event: drop-environments"
{
"id": 21,
"type": "drop-environments",
"createdBy": "import-API-token",
"createdAt": "2022-06-03T11:30:40.549Z",
"data": {
"name": "all-projects"
},
"preData": null,
"tags": [],
"featureName": null,
"project": null,
"environment": null
}
```
## Segment events
### `segment-created`
This event fires when you create a segment. The `data` property contains the newly created segment.
``` json title="example event: segment-created"
{
"id": 969,
"type": "segment-created",
"createdBy": "user@company.com",
"createdAt": "2022-06-03T10:29:43.977Z",
"data": {
"id": 5,
"name": "new segment",
"description": "this segment is for events",
"constraints": [
{
"values": [
"appA",
"appB",
"appC"
],
"inverted": false,
"operator": "IN",
"contextName": "appName",
"caseInsensitive": false
}
],
"createdBy": "user@company.com",
"createdAt": "2022-06-03T10:29:43.974Z"
},
"preData": null,
"tags": [],
"featureName": null,
"project": null,
"environment": null
}
```
### `segment-updated`
This event fires when you update a segment's configuration. The `data` property contains the new segment configuration; the `preData` property contains the previous segment configuration.