Put a study run on the chart as a Forward Insight
/insights- Base URL
https://api.chartnaut.com/v1- Auth
- Bearer key
- Operation ID
createInsight
The run must have succeeded, and its study version must declare pin_cell as
popover_layout and publish exactly one cell per combination of its indexedBy
dimensions. The insight shows on the caller's charts of the definition, and of the run's
instrument and timeframe. Never spends AI credits: the study is used as written. With
dry_run nothing is saved and the response is the preview. Counts as a heavy request.
A new insight is saved to your library, and shows on charts only once it is active
(POST /insights/{insight_id}/activate); message says which. The library holds the
plan's Forward Insights (Free 5, Pro 25): only your own live
insights count, not ones you added. Re-saving one (replaces, or replace by name) keeps
its place and never needs a slot; it also keeps its active state.
Request bodyapplication/json#
runstringRequiredA succeeded study run: run_… from POST /runs, or srun_… for a run made in the app.
namestringRequiredWhat the chart shows as the card's title.
definitionstringYour definition slug. Needed only when the study reads more than one of yours.
descriptionstringreplacebooleanReplace an insight with the same name on the same definition. false refuses with conflict instead.
replacesstringRe-save this insight of yours (on the same definition) whatever its name is now: it keeps its place in the library, its active state and who added it, and never needs a library slot. Takes precedence over replace.
dry_runbooleanRun every check and return the preview without saving.
projectionbooleanA click on one of its events also draws the study's projection (outlook.js) on the chart (show: both). Needs the study to have one. If it cannot be set, the insight is still created and projection_error says why.
Responses#
200OKapplication/json
dry_run: every check passed. Nothing was saved.
dry_runbooleanRequireddefinitionstringRequiredscope_dimensionsarray of stringRequiredThe card compiled for one sample event of the run.
Show fields
cardobjectsample_eventobjectNullableThe scope values of the event the card was compiled for.
201Createdapplication/json
Created. Also carries the preview card.
Includes Insight
idstringRequirednamestringRequireddescriptionstringRequireddefinitionstringRequiredThe definition slug whose events show the card.
studystringRequiredThe study slug.
study_versionintegerRequiredNullableinstrumentstringRequiredprofilestringRequiredNullableThe definition profile of the run. The card shows on charts using this profile.
Exactly one of {from,to}, last or bars. Warmup is fetched before
the window automatically and never counted in results. Clamped to the
plan's historical depth.
Show fields
fromstring (date-time)tostring (date-time)Defaults to now.
laststringbarsintegerscope_dimensionsarray of stringRequiredpin_cell's indexedBy. Empty for one global card.
is_ownerbooleanRequiredfalse for someone else's shared insight you added in the app (read-only).
authorstringThe username of whoever shared it. Only when is_owner is false.
app_urlstringRequiredOpens the insight's study run in the app. Empty when is_owner is false.
created_atstring (date-time)Requiredupdated_atstring (date-time)Requiredproblemsarray of objectWhat stops this insight working for you: a dependency of its study that is not in your library, or no longer shared with you. Empty when it works.
Show item fields
codestringRequiredkindstringRequirednamestringRequiredaddstringreasonstringactivebooleanRequiredIt shows on your charts of its definition, instrument and timeframe (POST /insights/{insight_id}/activate).
active_statestringNullableOnly when active: live, or paused when the account is over its plan's Forward Insights on charts (after a downgrade).
valid_fromstring (date-time)RequiredNullableThe first moment its numbers know nothing about (the run's end, plus how far the study read past an event, to the next bar). Setups from then on are out of sample. Null when unknown.
headlineobjectRequiredNullableThe one number its label shows, across every setup. Null when it has none, or an older insight's is not worked out yet.
Show fields
valuestringRequiredlabelstringRequiredbasisstringRequiredThe card compiled for one sample event of the run.
Show fields
cardobjectsample_eventobjectNullableThe scope values of the event the card was compiled for.
messagestringRequiredWhere it shows: saved to your library, and on charts once it is active (a re-save of an active insight already shows).
projectionbooleanPresent when projection was asked: whether the click now draws the projection too.
projection_errorstringWhy the projection could not be set. The insight was created with its card only.
400Bad requestapplication/json
invalid_request: missing run or name, not a study run, or definition is needed (the error lists the choices) or was not read by the run.
errorobjectRequiredShow fields
codestringRequiredStable. Branch on this, never on message.
messagestringRequireddetailsobjectdocs_urlstring (uri)request_idstring403Forbiddenapplication/json
forbidden: the definition is someone else's. Insights go on your own definitions (when sharing is on for your account: on definitions in your library). plan_limit: your library is full (the plan's Forward Insights); delete one, re-save one with replaces, or upgrade.
errorobjectRequiredShow fields
codestringRequiredStable. Branch on this, never on message.
messagestringRequireddetailsobjectdocs_urlstring (uri)request_idstring404Not foundapplication/json
not_found: no such run, or replaces is not one of your live insights on the definition.
errorobjectRequiredShow fields
codestringRequiredStable. Branch on this, never on message.
messagestringRequireddetailsobjectdocs_urlstring (uri)request_idstring409Conflictapplication/json
run_not_finished: the run has not succeeded (details.status). conflict: replace is false and an insight with that name exists on the definition.
errorobjectRequiredShow fields
codestringRequiredStable. Branch on this, never on message.
messagestringRequireddetailsobjectdocs_urlstring (uri)request_idstring422Unprocessableapplication/json
script_invalid: the study does not meet the pin_cell contract. details.fix says what to change when it can; details.docs_topic is the reference page.
errorobjectRequiredShow fields
codestringRequiredStable. Branch on this, never on message.
messagestringRequireddetailsobjectdocs_urlstring (uri)request_idstringErrorAny other statusapplication/json
Error.
errorobjectRequiredShow fields
codestringRequiredStable. Branch on this, never on message.
messagestringRequireddetailsobjectdocs_urlstring (uri)request_idstring