> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.runtype.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.runtype.com/_mcp/server.

# Poll product events

GET https://api.runtype.com/v1/events

Reads your organization's product events in cursor order. Omit `after` to start from now: the response carries no events and the current cursor. Pass the returned `cursor` back as `after` on the next call. `waitMs` holds the request open until an event arrives or the wait ends (at most 50000 ms). Events are kept for seven days.

Reference: https://docs.runtype.com/api-reference/runtype-api/events/poll-product-events

## Authentication

- `Authorization` header (bearer token, required) — API key or Clerk session token

## Servers

- `https://api.runtype.com` (Production, default)
- `https://api.runtype-staging.com` (Staging)

## Request

### Query parameters

- `name` (string, optional) — One event type from `GET /v1/events/types`; omit for every type
- `after` (string, optional) — Decimal cursor; events after it are returned
- `maxAgeMs` (integer, optional, nullable) — Skip events older than this many milliseconds
- `maxEvents` (integer, optional) — Page size, default 50
- `waitMs` (integer, optional, nullable) — Long-poll: wait up to this long for a matching event
- `agentId` (string, optional) — Only events for this agent
- `flowId` (string, optional) — Only events for this flow
- `productId` (string, optional) — Only events inside this product
- `surfaceId` (string, optional) — Only events on this surface
- `scheduleId` (string, optional) — Only events for this schedule
- `suiteId` (string, optional) — Only events for this eval suite
- `taskId` (string, optional) — Only events for this delegated task
- `onlyRegressions` (enum, optional) — Eval runs only: keep runs whose pass rate dropped
  - Allowed values: `true`, `false`
- `minIntervalMs` (integer, optional, nullable) — Execution failures only: coalesce repeats within this window

## Response

### 200

Events after the cursor

- `cursor` (string, required, nullable) — Pass back as `after`: after the last returned event, or the head when none
- `events` (list of ProductEventOccurrence, required)
- `hasMore` (boolean, required) — More events matched beyond `maxEvents`; poll again now
- `nextPollMs` (integer, required) — Suggested wait before the next poll
- `truncated` (boolean, required) — True when `after` predates retention or `maxAgeMs`, so events were skipped

## Errors

### 400 Bad Request Error

Unknown event name or filter arguments it does not accept

- `error` (string, required)
- `code` (enum, required) — Stable error code
  - Allowed values: `EVENT_NOT_FOUND`, `INVALID_EVENT_ARGUMENTS`, `INVALID_EVENT_CURSOR`, `EVENT_SCOPE_FORBIDDEN`
- `details` (list of ProductEventErrorDetailsItems, optional)

### 401 Unauthorized Error

Unauthorized

- `error` (string, required)
- `details` (list of ErrorDetailsItems, optional)

### 403 Forbidden Error

Organization workspace required, or the API key lacks every scope the event requires

- `error` (string, required)
- `code` (enum, optional) — Stable error code
  - Allowed values: `EVENT_NOT_FOUND`, `INVALID_EVENT_ARGUMENTS`, `INVALID_EVENT_CURSOR`, `EVENT_SCOPE_FORBIDDEN`
- `details` (list of V1EventsGetResponsesContentApplicationJsonSchemaDetailsItems, optional)

## Types

### ProductEventOccurrence

- `cursor` (string, required) — Position of this occurrence in the organization log
- `data` (map from string to any, required) — Ids plus a short summary; shape per `payloadSchema`
- `eventId` (string, required) — Occurrence id (typeid, `pev_` prefix)
- `name` (enum, required)
  - Allowed values: `runtype.execution.failed`, `runtype.approval.requested`, `runtype.schedule.run_failed`, `runtype.eval.run_completed`, `runtype.conversation.human_takeover`, `runtype.skill.proposal_created`, `runtype.task.input_required`, `runtype.task.completed`, `runtype.task.failed`, `runtype.task.cancelled`
- `timestamp` (string, required) — When it happened (ISO 8601)

### ProductEventErrorDetailsItems

- `message` (string, required)
- `code` (string, optional) — Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM).
- `path` (string, optional) — Dotted JSON path to the offending field.
- `suggestion` (string, optional) — Actionable hint (allowed values, accepted range, …).

### ErrorDetailsItems

- `message` (string, required)
- `code` (string, optional) — Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM).
- `path` (string, optional) — Dotted JSON path to the offending field.
- `suggestion` (string, optional) — Actionable hint (allowed values, accepted range, …).

### V1EventsGetResponsesContentApplicationJsonSchemaDetailsItems

- `message` (string, required)
- `code` (string, optional) — Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM).
- `path` (string, optional) — Dotted JSON path to the offending field.
- `suggestion` (string, optional) — Actionable hint (allowed values, accepted range, …).

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "cursor": "1714000000000000001",
  "events": [
    {
      "cursor": "1714000000000000000",
      "data": {},
      "eventId": "pev_01hwz3k8x2f9v4n7m5q6r1j0yd",
      "name": "runtype.execution.failed",
      "timestamp": "2024-04-25T14:32:07Z"
    }
  ],
  "hasMore": false,
  "nextPollMs": 5000,
  "truncated": false
}
```

**SDK Code**

```python
import requests

url = "https://api.runtype.com/v1/events"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.get(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.runtype.com/v1/events';
const options = {
  method: 'GET',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.runtype.com/v1/events"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("GET", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/events")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.runtype.com/v1/events")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.runtype.com/v1/events', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/events");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/events")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```