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

# Flywheel events handler

> **Required scope:** read

**Required scope:** `read`

### Query parameters

<ParamField query="limit" type="integer">
  Maximum number of events to return (1..1000)
</ParamField>

### Response

`FlywheelEventsResponse`

<ResponseField name="events" type="LearningEvent[]" required>
  <Expandable title="LearningEvent">
    <ResponseField name="confidence" type="number (float)" required>
      Outcome confidence
    </ResponseField>

    <ResponseField name="event_type" type="LearningEventType" required>
      <Expandable title="LearningEventType">
        <ResponseField name="error" type="string" required />

        <ResponseField name="raw_query" type="string" required />

        <ResponseField name="type" type="string" required />
      </Expandable>
    </ResponseField>

    <ResponseField name="id" type="string" required>
      Unique event ID
    </ResponseField>

    <ResponseField name="metadata" type="object" required>
      Additional metadata
    </ResponseField>

    <ResponseField name="org_id" type="string">
      Organization context
    </ResponseField>

    <ResponseField name="query" type="string" required>
      The query that triggered this event
    </ResponseField>

    <ResponseField name="strategy" type="string" required>
      Strategy used
    </ResponseField>

    <ResponseField name="success" type="boolean" required>
      Whether the outcome was successful
    </ResponseField>

    <ResponseField name="timestamp" type="string (date-time)" required>
      When this event occurred
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="total" type="integer" required />

### Status codes

| Code  | Meaning                                            |
| ----- | -------------------------------------------------- |
| `200` | Recent learning events                             |
| `401` | Unauthorized — missing or invalid credentials      |
| `403` | Forbidden — the key/token lacks the required scope |
| `429` | Rate limited — see Retry-After / X-RateLimit-Reset |

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://api.nsr.stateset.com/api/v1/flywheel/events' \
    --header 'X-API-Key: YOUR_API_KEY'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "events": [
      {
        "confidence": 7.5,
        "event_type": {
          "error": null,
          "raw_query": null,
          "type": null
        },
        "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "metadata": null,
        "org_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "query": "string",
        "strategy": "string",
        "success": true,
        "timestamp": "2026-08-31T14:22:05Z"
      }
    ],
    "total": 102
  }
  ```
</ResponseExample>
