Save a new version
/scripts/{slug}- Base URL
https://api.chartnaut.com/v1- Auth
- Bearer key
- Operation ID
updateScript
base_version is required. If the latest version is not
base_version the save is refused with version_conflict (409),
so an agent never overwrites an edit made in the app. A save always
adds a new version; it never rewrites the one you based it on.
An unchanged file set adds nothing and returns the current version.
Path parameters#
slugstringRequiredYour script's slug, optionally pinned as slug@N.
Query parameters#
kindstring · ScriptKindOnly needed when a study shares its slug with an indicator or definition.
Request bodyapplication/json#
The full file set for the new version. Missing files are deleted.
Show item fields
pathstringRequiredcodestringRequiredentrybooleanExactly one file is the entry. Indicators have one file, always the entry.
base_versionintegerRequiredchange_summarystringResponses#
200OKapplication/json
New version saved.
Includes ScriptSummary
idstringThe script's id for the Terminal SDK and partner API: ind_<n> for an indicator, flw_<n> for a definition. Pass it to cn.scripts.publish({ script }) or chart.scripts.add. Absent for a study.
slugstringkindstring · ScriptKindnamestringdescriptionstringvisibilitystring · VisibilityStudies are always private; setting visibility on a study is refused with 400.
latest_versionintegerupdated_atstring (date-time)app_urlstring (uri)Opens this script in the Chartnaut app.
versionintegerThe version this response describes.
interfaceobject · ScriptInterfaceWhat a caller needs to run the script and read its results. Derived from the code.
Show fields
settingsmap of object · SettingDefShow value fields
typestringAn indicator's settings take their type, bounds and options from its settings dialog.
defaultanyminnumbermaxnumberstepnumberoptionsarray of anyChoices for a select. From an indicator's settings dialog each is {label, value}.
outputsarray of object · OutputDefIndicator only.
Show item fields
idstringnamestringkindstringThe output's declared kind (line, area, baseline, histogram, fill, markers, labels, hline, range, …).
panestringeventsarray of object · EventDefDefinition only. The events it can emit.
Show item fields
idstringintentstringpayload_keysarray of stringresultsarray of objectStudy only. The result blocks it produces.
Show item fields
timeframesarray of string · TimeframeExtra timeframes the script reads besides the run's own.
warmup_barsintegerdependenciesarray of object · PinnedDependencyShow item fields
refstring · ScriptRefslug or slug@N for your own scripts; author/slug or
author/slug@N for library scripts; chartnaut/slug for built-ins
(which always run their latest version).
asstringThe alias the script uses.
versionintegerfilesarray of object · ScriptFilePresent with include=source on your own scripts.
Show item fields
pathstringRequiredcodestringRequiredentrybooleanExactly one file is the entry. Indicators have one file, always the entry.
409Conflictapplication/json
Error.
errorobjectRequiredShow fields
codestringRequiredStable. Branch on this, never on message.
messagestringRequireddetailsobjectdocs_urlstring (uri)request_idstring422Unprocessableapplication/json
The script does not lint, link or derive. Nothing was saved or run.
Includes Error
errorobjectRequiredShow fields
codestringRequiredStable. Branch on this, never on message.
messagestringRequireddetailsobjectdocs_urlstring (uri)request_idstringdiagnosticsarray of object · DiagnosticShow item fields
severitystringRequiredcodestringmessagestringRequiredpathstringlineintegersettingstringThe setting a finding is about, if any.
ErrorAny other statusapplication/json
Error.
errorobjectRequiredShow fields
codestringRequiredStable. Branch on this, never on message.
messagestringRequireddetailsobjectdocs_urlstring (uri)request_idstring