InsightsCreate insight

Create insight

Create a new analytics insight. An insight defines a saved query with visualization settings that can be embedded in dashboards.

curl -X POST "https://api.mythic-analytics.com/api/v1/insights" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
  "name": "Daily Active Users",
  "description": "Tracks unique visitors per day over the last 30 days.",
  "query": {
    "metric": "unique_visitors",
    "dimension": "day",
    "period": "30d"
  },
  "visualization": {
    "type": "line",
    "color": "#F97316"
  }
}'
{
  "success": true,
  "data": {
    "id": "ins_8kN2mPqR",
    "name": "Daily Active Users",
    "description": "example_string",
    "query": {},
    "visualization": {},
    "created_at": "2024-05-10T08:00:00.000Z",
    "updated_at": "2024-06-01T12:30:00.000Z"
  }
}
POST
/insights
POST
Bearer Token
Bearer Tokenstring
Required

Admin API key as bearer token. Format: Bearer YOUR_ADMIN_KEY

Admin API key as bearer token. Format: Bearer YOUR_ADMIN_KEY
API Key (query: admin_key)
admin_keystring
Required

Alternative to the Authorization header for server-to-server scenarios.

Alternative to the Authorization header for server-to-server scenarios.
Content-Typestring
Required

The media type of the request body

Options: application/json
namestring
Required

Display name of the insight.

descriptionstring

Optional description.

queryobject
Required

Query definition including metrics, dimensions, filters, and time range.

visualizationobject

Visualization config (chart type, colors, axes, etc.).

Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. Admin API key as bearer token. Format: Bearer YOUR_ADMIN_KEY

query
admin_keystring
Required

API Key for authentication. Alternative to the Authorization header for server-to-server scenarios.

Body

application/json
namestring
Required

Display name of the insight.

descriptionstring

Optional description.

queryobject
Required

Query definition including metrics, dimensions, filters, and time range.

visualizationobject

Visualization config (chart type, colors, axes, etc.).

Responses