Chartnaut API
Author and run indicators, definitions and studies on Chartnaut computeBase URL and keys#
- Base URL
https://api.chartnaut.com/v1- Authentication
Authorization: Bearer $CHARTNAUT_API_KEY- Version
- 1.0.0-draft · OpenAPI 3.1.0
The public API, called with a personal API key (the CLI's chartnaut login, or
Developers → CLI and API keys). A key works in the region where it was made.
A personal API token (cn_live_…) minted in Settings → Developers
(terminal.chartnaut.com/morpheus/settings/developers). Stored hashed; shown
once. Scopes: scripts:read (every GET, and validate),
scripts:write (create, save, patch, delete), runs:write (start and
cancel runs). 300 requests a minute per token. The same token works for
the CLI and the MCP server.
The public contract behind the Chartnaut CLI and the Chartnaut MCP server. Every CLI command and every MCP tool is a call to an operation in this file; neither has operations of its own.
Design rules (see README.md for the reasoning):
- Public names only.
definition(never "flow"),run,script,version. No internal type is ever serialised directly; every response is a DTO here. - Versions are immutable.
slug@3means the same code and the same dependency pins forever. A bareslugresolves to the latest version at run time and the run records which version it used. - Every run is async.
waitlets short runs return finished in one call. - No raw market data. Runs return what the script produced (series, events, study results), never candles or tape.
- A save that is not runnable fails (422). There is no "saved but not promoted" success.
Errors#
Error.
Body
errorobjectRequiredShow fields
codestringRequiredStable. Branch on this, never on message.
messagestringRequireddetailsobjectdocs_urlstring (uri)request_idstringPagination#
cursorstringOpaque cursor from a previous page's next_cursor.
limitintegerA page carries
next_cursorstringNullableIdempotency#
Idempotency-Key header
Any unique string. A retry with the same key within 24h returns the first response instead of creating a second script, version or run.
Endpoints#
Scripts
Your indicators, definitions and studies, and their versions.
- GET
/scriptsList your scripts - POST
/scriptsCreate a script and its first version - POST
/scripts/validateLint and resolve a script without saving or running it - GET
/scripts/{slug}Get a script (latest version, orslug@N) - PUT
/scripts/{slug}Save a new version - DEL
/scripts/{slug}Delete a script - PATCH
/scripts/{slug}Rename or describe a script - GET
/scripts/{slug}/versionsList versions, newest first - GET
/scripts/{slug}/eventsList a definition's events - GET
/scripts/{slug}/events/summarySummarise a definition's events - POST
/scripts/{slug}/collectRun a definition over history
Runs
Execute a saved version or inline source on an instrument and window.
Forward Insights
A study on the chart: click one of a definition's events and a card shows what happened
after events like it. Made from a succeeded run of a study that publishes pin_cell.
- GET
/insightsList your Forward Insights, newest change first - POST
/insightsPut a study run on the chart as a Forward Insight - GET
/insights/{insight_id}Get one Forward Insight - DEL
/insights/{insight_id}Take an insight off your charts. The study and its runs are kept - PATCH
/insights/{insight_id}Rename an insight, change its description, or choose what a click on its events opens - POST
/insights/{insight_id}/activateMake an insight active, so it shows on your charts of its definition, instrument and timeframe - POST
/insights/{insight_id}/deactivateStop an insight showing on your charts. It stays in your library
Library
Every script the caller can use: their own, Chartnaut's built-ins, other people's public
scripts and the ones they added to their library. Described by ref; source is never
returned. Another author's script runs only once it is added to the caller's library,
which also adds the scripts it needs after an explicit confirm.
- GET
/librarySearch the scripts the caller can use. No source - GET
/library/{author}/{slug}Describe one library script, with its interface and dependencies. No source - POST
/library/{author}/{slug}Add another author's script to your library, with the scripts it needs - DEL
/library/{author}/{slug}Remove a script you added from your library - GET
/library/{author}/{slug}/requirementsWhat adding a script to your library would add, and anything that stops it
Catalog
Instruments, timeframes and coverage. Metadata only.
- GET
/instrumentsSearch instruments you can run on - GET
/datasetsList the reference datasets scripts can read - GET
/datasets/econ.calendar/codesSearch economic calendar indicator codes - GET
/instruments/{symbol}Get one instrument, including the coverage your plan can reach - GET
/timeframesList supported timeframes
Account
Usage, limits and webhooks.
- POST
/auth/deviceStart a browser sign-in - POST
/auth/tokenFinish a browser sign-in - POST
/auth/revokeRevoke the key making this request (sign out) - GET
/meWho this token belongs to, its scopes and the plan - GET
/usageCompute used this period, and every plan cap with its current count - GET
/webhooksList webhooks (not available yet, 501) - POST
/webhooksRegister a webhook (not available yet, 501) - DEL
/webhooks/{webhook_id}Delete a webhook (not available yet, 501)
Docs
The scripting reference, served in slices sized for an agent's context.
Projects
Your developer projects (once called apps): the Chartnaut side of what you build with the SDK. Test keys and Test sites only; Live keys and Live sites are made on the Developers page.
- GET
/projectsList your developer projects - POST
/projectsCreate a developer project and its first Test key (the secret is shown once) - GET
/projects/{slug}Get one project - POST
/projects/{slug}/keysMint a Test key (Live keys are only made in the browser: env "live" is 403 live_keys_browser_only) - GET
/projects/{slug}/sitesList Test sites - POST
/projects/{slug}/sitesAdd a Test site (Live sites are only added in the browser: 403 test_only) - GET
/projects/{slug}/quickstartWhat Test and Live still need, and the one CLI command - GET
/appsOld path of listProjects - POST
/appsOld path of createProject - GET
/apps/{slug}Old path of getProject - POST
/apps/{slug}/keysOld path of createProjectKey - GET
/apps/{slug}/sitesOld path of listProjectSites - POST
/apps/{slug}/sitesOld path of addProjectSite - GET
/apps/{slug}/quickstartOld path of getProjectQuickstart
