# The event feed

> Every event of the last 30 days, in order — to catch up on webhooks you missed, or instead of receiving them at all.

Every event the platform sends to [webhook receivers](/guides/webhooks) is also kept for **30 days**
in a feed you can read: the same events, with the same `id`s, whether or not anybody received them.
Use it to catch up after your receiver was down, or read it instead of running a receiver at all.
Reading needs `conversations:read`.

**curl**

```sh
#!/bin/sh
# Read the event feed. Keep the last page's next_cursor and send it back as cursor= next time.
curl -sS --fail-with-body -X GET "https://api.aigently.ai/v1/events?type=conversation.ended&limit=50" \
  -H "Authorization: Bearer $AIGENTLY_API_KEY"
```

**JavaScript**

```js
// Read the event feed. Keep the last page's next_cursor and send it back as cursor= next time.
const response = await fetch("https://api.aigently.ai/v1/events?type=conversation.ended&limit=50", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.AIGENTLY_API_KEY}`,
  },
});
const answer = await response.json();
if (!response.ok) throw new Error(`${answer.code}: ${answer.detail}`);
console.log(answer);
```

**Python**

```python
# Read the event feed. Keep the last page's next_cursor and send it back as cursor= next time.
# pip install httpx
import os

import httpx

response = httpx.get(
    "https://api.aigently.ai/v1/events",
    headers={
        "Authorization": f"Bearer {os.environ['AIGENTLY_API_KEY']}",
    },
    params={
        "type": "conversation.ended",
        "limit": 50,
    },
)
if response.is_error:
    raise SystemExit(response.text)
print(response.json())
```

**Go**

```go
// Read the event feed. Keep the last page's next_cursor and send it back as cursor= next time.
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	request, err := http.NewRequest("GET", "https://api.aigently.ai/v1/events?type=conversation.ended&limit=50", nil)
	if err != nil {
		panic(err)
	}
	request.Header.Set("Authorization", "Bearer "+os.Getenv("AIGENTLY_API_KEY"))
	response, err := http.DefaultClient.Do(request)
	if err != nil {
		panic(err)
	}
	defer response.Body.Close()
	body, _ := io.ReadAll(response.Body)
	if response.StatusCode >= 400 {
		fmt.Fprintln(os.Stderr, string(body))
		os.Exit(1)
	}
	fmt.Println(string(body))
}
```

**Java**

```java
// Read the event feed. Keep the last page's next_cursor and send it back as cursor= next time.
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.aigently.ai/v1/events?type=conversation.ended&limit=50"))
            .header("Authorization", "Bearer " + System.getenv("AIGENTLY_API_KEY"))
            .method("GET", HttpRequest.BodyPublishers.noBody())
            .build();
        // HTTP/1.1: on a plain-http address Java's default asks to upgrade, which not every
        // server allows.
        HttpClient client = HttpClient.newBuilder().version(HttpClient.Version.HTTP_1_1).build();
        HttpResponse<String> response =
            client.send(request, HttpResponse.BodyHandlers.ofString());
        if (response.statusCode() >= 400) {
            System.err.println(response.body());
            System.exit(1);
        }
        System.out.println(response.body());
    }
}
```

**C#**

```csharp
// Read the event feed. Keep the last page's next_cursor and send it back as cursor= next time.
using System.Net.Http.Headers;
using System.Text;

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("AIGENTLY_API_KEY"));
var request = new HttpRequestMessage(HttpMethod.Get, "https://api.aigently.ai/v1/events?type=conversation.ended&limit=50")
{
};
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
{
    Console.Error.WriteLine(body);
    return 1;
}
Console.WriteLine(body);
return 0;
```

**PHP**

```php
<?php
// Read the event feed. Keep the last page's next_cursor and send it back as cursor= next time.
$curl = curl_init("https://api.aigently.ai/v1/events?type=conversation.ended&limit=50");
curl_setopt_array($curl, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("AIGENTLY_API_KEY"),
    ],
]);
$body = curl_exec($curl);
if (curl_getinfo($curl, CURLINFO_RESPONSE_CODE) >= 400) {
    fwrite(STDERR, $body . "\n");
    exit(1);
}
echo $body, "\n";
```

## Read it in order

Events come **oldest first**. Read until `has_more` is `false`, keep the last page's
`next_cursor`, and next time send it back as `cursor`: you get every event since, once. Events from
the last minute wait for a later page, so one still being written is never skipped.

Each event is what a receiver would have been sent:

```json
{
  "object": "event",
  "id": "0f9a7c2e-5b1d-4e8a-9c3f-2d6b8e1a4c7f",
  "event": "conversation.ended",
  "created_at": "2026-10-07T09:14:03.120394+00:00",
  "livemode": true,
  "revision": 6,
  "data": { "object": "conversation", "id": "5f0c9a52-…", "status": "completed", "…": "…" }
}
```

An event you already received through a webhook has the same `id` here, so keep the ids you have
handled and skip them. As with webhooks, keep the conversation with the higher `revision`.

## Narrow it

| Parameter | |
|---|---|
| `type` | One event type, like `conversation.ended`. Repeat it for several. |
| `conversation_id` | Only the events about one conversation. |
| `created_after` | Only events from this time on — where to start the first time. |

## What a key sees

The feed follows the same rules as everything else a key reads: its own projects and agents, and its
own side of [test mode](/guides/test-mode). `conversation.transcript` events are listed only for a
key with `transcripts:read`.
