ChartnautDocs

Add another author's script to your library, with the scripts it needs

POST/library/{author}/{slug}
Base URL
https://api.chartnaut.com/v1
Auth
Bearer key
Operation ID
addToLibrary

Another author's indicator or definition runs only once it is in your library, as in the app. Adding it also adds the scripts it reads that you have not added, all or nothing. Adding never copies anything: each script stays its author's, tracks their edits, and can be removed at any time.

The agreement step: call getLibraryRequirements, show the person what will be added, and only if they agree send confirm listing every ref in its confirm. A confirm that leaves any out adds nothing and answers 409 confirmation_required with details.needs, details.confirm and details.missing.

Already usable (your own, a built-in, or already added): 200 with added: false and reason; nothing changes. A dependency not shared with you: 409 not_shared with details.cannot_add. A study: 409 not_installable. @N in the path is refused (400): a library entry is the live script.

Path parameters#

authorstringRequired

The author's username (or me / chartnaut where allowed), in any letter case.

Example bob
slugstringRequired

The script's slug. No @N; a library entry is the live script.

Example vwap-bands

Query parameters#

kindstring

When the author has an indicator and a definition with that slug.

One of indicator definition

Request bodyapplication/json, optional#

confirmarray of string

The refs the person agreed to add. Must include every ref in the requirements' confirm. @N is dropped.

Responses#

200OKapplication/json

Already usable. Nothing changed; added is false and reason says why.

addedbooleanRequired

True when this call added it.

rootobject · LibraryItemRequired
Show fields
refstringRequired
Example bob/session-vwap
kindstring · ScriptKindRequired
One of indicator definition study
namestringRequired
authorstring

Lowercase username, or chartnaut. Omitted on a requirements root.

statusstring · LibraryItemStatusRequired

installable: adding the root adds it. installed: already in your library. owned: yours. builtin: Chartnaut's. unavailable: not shared with you. not_installable: a study root.

One of installable installed owned builtin unavailable not_installable
added_witharray of stringRequired

Refs added along with it.

skippedarray of objectRequired

confirm entries not added, with not_a_dependency or the status that made them unnecessary.

Show item fields
refstring
reasonstring
reasonstring

Only when added is false: why nothing changed.

201Createdapplication/json

Added, with everything in added_with.

addedbooleanRequired

True when this call added it.

rootobject · LibraryItemRequired
Show fields
refstringRequired
Example bob/session-vwap
kindstring · ScriptKindRequired
One of indicator definition study
namestringRequired
authorstring

Lowercase username, or chartnaut. Omitted on a requirements root.

statusstring · LibraryItemStatusRequired

installable: adding the root adds it. installed: already in your library. owned: yours. builtin: Chartnaut's. unavailable: not shared with you. not_installable: a study root.

One of installable installed owned builtin unavailable not_installable
added_witharray of stringRequired

Refs added along with it.

skippedarray of objectRequired

confirm entries not added, with not_a_dependency or the status that made them unnecessary.

Show item fields
refstring
reasonstring
reasonstring

Only when added is false: why nothing changed.

400Bad requestapplication/json

invalid_request: the body is not JSON, the path has @N, or kind is not valid.

object · Error
errorobjectRequired
Show fields
codestringRequired

Stable. Branch on this, never on message.

One of unauthorized forbidden_scope plan_limit not_found version_conflict script_invalid in_use out_of_coverage unknown_instrument ambiguous_instrument unsupported_timeframe run_not_finished rate_limited busy invalid_request forbidden conflict not_in_library confirmation_required not_shared not_installable not_implemented authorization_pending slow_down access_denied expired_token internal
messagestringRequired
detailsobject
docs_urlstring (uri)
request_idstring
404Not foundapplication/json

not_found: no script by that author and slug the caller can see.

object · Error
errorobjectRequired
Show fields
codestringRequired

Stable. Branch on this, never on message.

One of unauthorized forbidden_scope plan_limit not_found version_conflict script_invalid in_use out_of_coverage unknown_instrument ambiguous_instrument unsupported_timeframe run_not_finished rate_limited busy invalid_request forbidden conflict not_in_library confirmation_required not_shared not_installable not_implemented authorization_pending slow_down access_denied expired_token internal
messagestringRequired
detailsobject
docs_urlstring (uri)
request_idstring
409Conflictapplication/json

confirmation_required: confirm does not list every script that would be added (details: needs, confirm, missing). not_shared: something it needs is not shared with you (details: cannot_add). not_installable: studies cannot be added. conflict: pass kind.

object · Error
errorobjectRequired
Show fields
codestringRequired

Stable. Branch on this, never on message.

One of unauthorized forbidden_scope plan_limit not_found version_conflict script_invalid in_use out_of_coverage unknown_instrument ambiguous_instrument unsupported_timeframe run_not_finished rate_limited busy invalid_request forbidden conflict not_in_library confirmation_required not_shared not_installable not_implemented authorization_pending slow_down access_denied expired_token internal
messagestringRequired
detailsobject
docs_urlstring (uri)
request_idstring
ErrorAny other statusapplication/json

Error.

object · Error
errorobjectRequired
Show fields
codestringRequired

Stable. Branch on this, never on message.

One of unauthorized forbidden_scope plan_limit not_found version_conflict script_invalid in_use out_of_coverage unknown_instrument ambiguous_instrument unsupported_timeframe run_not_finished rate_limited busy invalid_request forbidden conflict not_in_library confirmation_required not_shared not_installable not_implemented authorization_pending slow_down access_denied expired_token internal
messagestringRequired
detailsobject
docs_urlstring (uri)
request_idstring