ChartnautDocs

Create a Forward Insight

POST/insights

Puts a finished study run on your charts as a Forward Insight: click one of the definition's events and a card shows what happened after events like it. Call it once the study publishes pin_cell and a run of it has succeeded.

Scope

Heavy call

Long poll

CLI

scripts:write

Yes

No

chartnaut insights create

Guidance

  • The in-app Attach to chart wizard has an agent write pin_cell for you. This endpoint never does, and never spends AI credits: you, or your own AI, write pin_cell into the study first. Forward Insights is the contract.

  • The usual flow: save the study with pin_cell using Save a script version, start it with Create a run, wait on Get a run, then read keys=pin_cell from Get run results and check there is one row per combination of its indexedBy dimensions. Then call this with dry_run: true, look at the card, and call it again without.

  • dry_run runs every check and compiles the preview card for a sample event, then saves nothing. It skips only the name check that replace: false makes.

  • The insight goes on the definition the study reads. When it reads only one of yours, that one is used. When it reads several, name one in definition, or you get 400 with the choices. Forward Insights go on your own definitions only: to use someone else's, save a copy, have the study declare the copy, and run it again.

  • It shows on your charts of that definition, on the run's instrument and timeframe, with the definition profile the run used. Run the study on the instrument and timeframe you trade.

  • To change the numbers, change the study, run it again and call this with the same name. replace defaults to true, so the new insight archives the old one on that definition. Send replace: false to be refused with 409 conflict instead.

  • A 422 script_invalid answer is a change the study needs. details.fix, when present, is the code to add, and details.docs_url links the contract. Fix the study, save it, run it again, and retry with the new run: a run is never re-checked against a newer version.

Request body

Field

Type

Required

Description

run

string

Yes

A succeeded study run: run_… from the API or srun_… from the app

name

string

Yes

What you see on the chart and in the definition's Forward Insights tab. At most 120 characters

definition

string

No

Your own definition's slug. Needed only when the study reads more than one of your definitions

description

string

No

What the card answers. At most 2,000 characters

replace

boolean

No

Default true: archive your insight with the same name on that definition. false refuses instead

dry_run

boolean

No

Default false. true checks everything and returns the preview without saving

Response

201 with the new Forward Insight and a preview. A dry run answers 200 with the fields below and saves nothing.

Field

Type

Description

dry_run

boolean

Dry run only. Always true

definition

string

Dry run only. The definition the insight would go on

scope_dimensions

array of string

Dry run only. pin_cell's indexedBy: the dimensions the card is broken down by. [] for one global card

preview.card

object or null

The card as the chart would show it for preview.sample_event: a heading, its lines and groups, and the methodology with the sample

preview.sample_event

object or null

The scope values of the event the card was compiled for, such as {"direction": "long"}

Status codes

Status

Code

Meaning

201

-

The Forward Insight was saved and is on your charts

200

-

Dry run: every check passed. Nothing was saved

400

invalid_request

The body is not JSON; run or name is missing; name or description is too long; run is an indicator or definition run; the study reads several of your definitions and definition is missing (the message lists them); the run did not read definition (the message lists what it read); or Chartnaut refused the insight, and the message says why

403

forbidden

definition, or every definition the study reads, is someone else's

403

plan_limit

A limit of your plan. Do not retry

404

not_found

No run with that id on your account

409

run_not_finished

The run has not succeeded. details.status is its status

409

conflict

replace is false and you already have an insight with that name on the definition

422

script_invalid

The study does not meet the pin_cell contract, or declares no definition. details has docs_topic, docs_url and, for some causes, fix

429

busy

Past your heavy calls at once. Retry after Retry-After