Search documentation

Search the Fumadocs-backed documentation index.

Insights

HTTP API routes for insights.

Insights are org-scoped saved SQL queries. {ref} is an ins_... id or the immutable slug.

RouteUseCLI equivalent
GET /insightsList insight metadata.ax insight list
POST /insightsCreate an insight.ax insight create
GET /insights/{ref}Execute or inspect one insight.ax insight view
POST /insights/{ref}/sharePublish an immutable public insight URL.ax insight share
PATCH /insights/{ref}Update mutable fields.ax insight edit
DELETE /insights/{ref}Delete an insight.ax insight delete

Every route takes org_id (required only when the key can see several orgs). Parameters are optional unless marked required. Insight export stays client-side over the live GET response; there is no server export route.

GET /api/v1/insights

List insight metadata; no SQL runs.

curl -H "Authorization: Bearer $AX_API_KEY" \
  "https://app.514.ax/api/v1/insights?search=cost&limit=20"
ParameterWhat it does
searchText search over slug, heading, description, owner (query is an alias).
ownerOriginal owner's user id (owner_user_id is an alias).
experiment / runProvenance filters (experiment_id / run_id are aliases).
labelRequire this label.
limit / page_tokenPagination (page_size is an alias for limit).

The response includes nextPageToken when another page exists.

POST /api/v1/insights

Create an insight.

curl -X POST \
  -H "Authorization: Bearer $AX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"heading":"Cross-experiment cost","sql":"SELECT ..."}' \
  "https://app.514.ax/api/v1/insights"
Body fieldWhat it does
headingRequired. Human heading; mints the slug unless slug is given.
sqlRequired. The SQL body.
slugExplicit slug (immutable after create).
description / labelsOptional metadata.
forceOverwrite mutable content when the slug already exists.
provenance{kind, experimentId, runId} where kind is none, experiment, or run.
dataSchemalegacy or session_data_v1. Omitted defaults new insights to legacy and preserves the stamp on force overwrite.

Actor and org fields always come from authentication.

GET /api/v1/insights/{ref}

Execute the stored SQL live (the default, like ax insight view).

ParameterWhat it does
sql_onlytrue returns stored metadata and SQL without executing (sqlOnly is an alias).
limitMax live rows, up to 1,000.

POST /api/v1/insights/{ref}/share

Create or reuse an insight's immutable public publication. The response is {"url":"https://.../embed/insights/<token>"}. The URL is public: anyone who has it can see the publication's live query result. The query definition and presentation metadata are frozen on first share, while underlying data remains live. Source edits do not refresh the publication, and repeated requests return the same URL. Deleting the source insight is the only revocation mechanism in this release.

PATCH /api/v1/insights/{ref}

Partially update mutable fields. Ids and slugs are immutable.

Body fieldWhat it does
headingNew heading.
sqlNew SQL.
descriptionNew description; an empty string clears it.
labelsReplace the label set; an empty array or clear_labels: true clears it (not both).

DELETE /api/v1/insights/{ref}

Delete an insight. Deleting a missing reference is idempotent and returns deleted: false.