Skip to main content
Use the Analysis API to query the same production data available in Agnost AI: Patterns, Conversations, and Events. It is useful for internal tools, scheduled reports, and investigations driven by an AI agent.
Patterns combine user needs and agent behavior in one catalog. The retired intent and SOP endpoints have no compatibility aliases.

Before you begin

Create an API key in Agnost AI, then set it as an environment variable using your runtime, deployment platform, or preferred .env loader:
Every request uses:
  • Base URL: https://api.agnost.ai
  • Header: x-api-key: $AGNOST_API_KEY
  • Content type: application/json for request bodies
Most endpoints accept time_range. Supported values are 5min, 1h, 1d, 1w, 1m, all, and custom durations written as custom:<hours>h<minutes>m, such as custom:2h30m or custom:0h45m. Most endpoints use the last 30 days when the value is omitted or invalid; run-spotlight-query defaults to 1w and rejects invalid values. Endpoints that return conversation or event detail (user-stories, conversation-*, event-io, raw-logs, run-spotlight-query) are limited by your plan’s detailed-record allowance. When the organization is over it, they return HTTP 200 with {"access_state":"limit_exceeded","limit_exceeded":true,"tier":...,"calls_used":...,"calls_limit":...,"message":...,"scope":"detailed_read"} instead of data (run-spotlight-query sends the same fields as a stream line). Check access_state before reading results. Stats, timelines, and distribution summaries remain keyed by exact pattern title. Use titles returned by the catalog and stats endpoints; do not invent normalized tags. These analytics do not add a definition-ID selector. Patterns are classified proactively, so there is no manual classification step.

Patterns

POST /dashboard/api/pattern-stats

Lists top pattern clusters and counts in a time window. Best for: Ranking the patterns that matter across recent conversations. Request: Response schema: Call:

POST /dashboard/api/pattern-messages

Returns paginated event-level exchanges that matched one pattern, newest first. For a suggested pattern, it returns the evidence stored when the pattern was suggested (up to 20 messages). Best for: Inspecting evidence after selecting an exact pattern title from pattern-stats or patterns. Request: Response schema: If the organization has used up its detailed-read allowance, this endpoint returns 200 with {"access_state":"limit_exceeded","limit_exceeded":true,"scope":"detailed_read",...} instead of messages. Call:

POST /dashboard/api/pattern-timeline

Returns a bucketed count timeline for one active pattern. Best for: Seeing whether one pattern is rising, falling, or spiking over time. Request: Response schema: Call:

POST /dashboard/api/pattern-timelines

Returns bucketed timelines for multiple pattern clusters in one call. Best for: Comparing several known patterns over the same time window. Request: Response schema: Call:

POST /dashboard/api/summarize-pattern-distribution

Summarizes why one active pattern is appearing in the selected time window. The summarizer reads up to 500 of the most recent matched exchanges. Best for: Producing a short explanation after reviewing pattern-stats or pattern-messages. Request: Returns 403 when AI features are disabled for the organization. Response schema: Call:

GET /dashboard/api/patterns

Lists active and suggested pattern definitions. Best for: Finding an existing pattern before querying or creating one. Request: Response schema: Output format: object[] at the JSON response root. Decode directly as an array/list, not as { "patterns": [...] }. Call:

POST /dashboard/api/patterns

Creates a new pattern definition for future proactive classification. An active pattern is also checked asynchronously against up to 500 recent conversations. Best for: Creating an pattern only when no existing definition covers the need. Request: The API also accepts status (active, inactive, or suggested), which overrides active. Agents should use active. Response schema: Both responses use status 200. Created response: Duplicate skip response: Call:

PUT /dashboard/api/patterns/{id}

Updates an existing pattern definition or lifecycle status. Only the fields you send change. Approving a suggested pattern (setting active:true) checks it asynchronously against up to 500 recent conversations. Other edits, including description changes, apply to future classification only. Best for: Correcting, enabling, or disabling an existing pattern. Use active, not status. Request: A request with none of these fields returns 400. Response schema: Call:

Conversations and events

POST /dashboard/api/user-stories

Lists conversations with event rows, metadata, pattern matches. Without group_by, each page holds one representative conversation per user (the newest, or the oldest with sort:"oldest"); a conversation without a user id counts as its own user. Filtering to one user with search_field user_id or user_email returns that user’s conversations instead. It can also page conversation- or user-metadata groups, then page users within one selected group. Best for: Building a paginated group → user → conversation inventory. Use event-io or raw-logs for exact input and output. Request: Response schema: With group_by and group_level:"groups" (the grouped default), the response contains groups instead of conversations. Each group includes value, user_count, conversation_count, message_count, pattern counts/labels, last_active, and cost_metadata. The legacy message_count field counts distinct captured events, including tool events, and equals the sum shown for its child conversations. With group_level:"users", the response contains users with the same metrics plus an opaque key, user_id, label, and representative_conversation_id. Send that key as group_user_key with group_level:"conversations" to retrieve the user’s conversations through the exact same group membership logic. Metadata arrays can place one conversation in more than one group. Each cost_metadata entry is either an explicit USD cost bucket or a model/provider token bucket. Token buckets combine requests that share the same input-token count, expose that count as tokens.request_input, and use tokens.aggregated:"true"; clients should select any request-level pricing tier from tokens.request_input, then apply it to the aggregated token totals. pricing.invalid:"true" marks malformed numeric metadata. If an event has neither a valid explicit cost nor enough valid model/token data to price it, a computed total is incomplete. Call:
Grouped metadata call:

POST /dashboard/api/conversation-detail

Fetches one conversation’s metadata, transcript messages, and full span tree. Best for: Loading messages and trace spans when you already have a conversation_id. Request: Response schema: Call:

POST /dashboard/api/conversation-messages

Returns the user-facing transcript for one conversation. Each top-level event adds a user row for its input and an assistant or system row for its output; empty sides are skipped. Returns 404 when the conversation does not exist. Best for: Replaying the user-visible message flow without internal tool or model spans. Request: Response schema: Call:

POST /dashboard/api/conversation-spans

Returns the event/span hierarchy for one conversation, including child spans. Best for: Debugging tool calls, model execution, latency, errors, and parent-child spans. Request: Response schema: Call:

POST /dashboard/api/event-io

Fetches only the readable input and output for an exact event id. The text is not truncated. Best for: Fetching readable input and output when you already have an event_id. Request: Response schema: Call:

POST /dashboard/api/raw-logs

Fetches raw event rows with optional metadata, agent, connection, success, and IO filters. Best for: Paginating raw events with metadata, status, latency, and optional input and output. Request: Filter guidance:
  • Use dedicated fields for exclude_io, agent_name, and success; metadata_filters cannot express those event columns or output-shaping options.
  • connection_type is equivalent to metadata_filters[{source:"conversation_metadata", key:"transport_type"}]; prefer connection_type for this common filter.
  • client_config is equivalent to metadata_filters[{source:"conversation_metadata", key:"client_config"}]; prefer client_config for this common filter.
  • Use metadata_filters for arbitrary event/conversation/user metadata keys and user_id.
  • If dedicated filters and metadata_filters are both sent, the backend applies all of them with AND semantics.
Response schema: Call:

Ask Agnost AI

POST /dashboard/api/run-spotlight-query

Runs an open-ended investigation from a natural-language question. Best for: Questions that the deterministic pattern, conversation, and event endpoints cannot answer. Keep limit as small as possible. Request: Response schema: Output transport: text/event-stream. Decode SSE events. The final answer is sent in a chunk event as {"text": string}; completion metadata is sent in a done event. By default text is prose. With response_format: "json", text contains one compact JSON object synthesized from the template after Spotlight chooses and runs its read-only MCP tools. SSE event payloads: When the organization is over its detailed-record limit, the stream contains a single data: line (no event: name) with type:"error" and the limit fields described in Before you begin. Call:

Metadata filters

Values within one filter match any; separate filters must all match. event_field supports only key success, with values such as success, failure, non_critical, true, or false. For user_id, values match the user id, user_metadata.email, or user_metadata.name.

Next steps

  • Authentication: create and use an Agnost AI API key.
  • Patterns: understand the pattern data returned by these APIs.
  • Patterns: review the pattern model and workflow.