ChartnautDocs

Publish one of your scripts to your app

POST/scripts
Base URL
https://api.chartnaut.com/partner/v1
Auth
Bearer key
Operation ID
publishScript

Publishes an indicator (layers included), a definition or an insight your team owns (the account owner's or a team member's own Chartnaut scripts; private ones are the point) to one of your apps. Every user of the app runs it inside the app without installing anything; on chartnaut.com it doesn't run, and it is never listed in the community.

No version follows the script's current version; a version pins it (a workspace pinned to a version you published before keeps it). run_only: the frame never receives the source, only a scrambled bundle. That hides the code from casual view; it is not cryptographic protection (anything a browser runs can be recovered). listed: false keeps it out of the script picker: add it by id from your page. Republishing changes only what you send. 201 the first time, 200 after.

Someone else's script, or an id that doesn't exist: 404 not_found. A version that doesn't exist, or a version on an insight: 400 invalid_request. run_only on a script whose source is already shared in the community (public or unlisted, source shown): 409 conflict. At most 500 scripts an app (409 partner_limit).

Headers#

Idempotency-KeystringRequired

Required on every POST (400 invalid_request without it): any unique string of 1–255 visible ASCII characters (a UUID is ideal). Keys are per environment. A retry with the same key, path and body within 24 hours returns the first response with Idempotent-Replayed: true and runs nothing. The same key with a different path or body is 422 idempotency_key_reused; while the first request is still running, 409 conflict. 5xx and 429 answers are not stored, so a retry with the same key runs again.

1 to 255 characters

Request bodyapplication/json#

object
scriptstringRequired

ind_<n> an indicator or layer, flw_<n> a definition, ins_<n> an insight.

Pattern ^(ind|flw|ins)_[0-9]+$
versioninteger

A saved version number; leave it out to follow the current one.

At least 1
run_onlyboolean

Never send the source to the frame. Default false.

listedboolean

In the script picker. Default true.

appstring

app_<n> or the app's slug. Default your default app.

Other fields are refused.

Responses#

200OKapplication/json

Republished.

object · AppScript
scriptstringRequired
Example ind_61
appstringRequired
Example app_3
kindstringRequired
One of indicator definition insight
namestringRequired
descriptionstring
versionintegerRequiredNullable

The published version; null follows the current one.

run_onlybooleanRequired
listedbooleanRequired
published_atstring (date-time)Required
updated_atstring (date-time)Required
201Createdapplication/json

Published.

Headers

Idempotent-Replayedstring

true when this is the stored response of an earlier request with the same Idempotency-Key.

Only true

Body

object · AppScript
scriptstringRequired
Example ind_61
appstringRequired
Example app_3
kindstringRequired
One of indicator definition insight
namestringRequired
descriptionstring
versionintegerRequiredNullable

The published version; null follows the current one.

run_onlybooleanRequired
listedbooleanRequired
published_atstring (date-time)Required
updated_atstring (date-time)Required
ErrorAny other statusapplication/json

Error. Every response to a request whose key checked out, errors included, carries RateLimit-Limit (requests a minute), RateLimit-Remaining and RateLimit-Reset (seconds until the minute resets). A 401, the 403 switched_off when the whole API is off for you, and the 429 for too many bad keys from one IP come before that check and carry none. A 429 also carries Retry-After (seconds).

Headers

RateLimit-Limitinteger
RateLimit-Remaininginteger
RateLimit-Resetinteger
Retry-Afterinteger

Body

object · Error
errorobject · ErrorBodyRequired
Show fields
codestringRequired

Stable. Branch on this, never on message.

Code Status Meaning
unauthorized 401 missing, unknown or revoked key (no RateLimit headers)
scope_not_granted 403 the user didn't grant details.scope
forbidden 403 your partner account isn't allowed this (details.reason, e.g. no_access for frame:live when live mode isn't enabled for you; details.scope)
permission_denied 403 this key lacks the key permission the call needs (details.permission, e.g. users:export; details.reason: "key_permission"): use a key that has it, or add it in the partner portal
not_managed 409 the call is for managed users only, and this user is linked (their own Chartnaut account and plan apply; details.reason: "not_managed")
switched_off 403 this part of the API is paused for you (everything, writes, frames, links, demo account creation, bulk actions); contact [email protected]
not_linked 404 the user isn't linked to you (details.user when the user was named in the request)
not_found 404 no such object for you; an id of the wrong type or shape is this too
conflict 409 external_ref already used (sessions: details.existing_id; accounts: details.field); the same Idempotency-Key still running; lock or unlock on an ended session
expected_count_mismatch 409 a bulk action matched a different number (details.expected, details.actual)
invalid_request 400 malformed body or unknown field (named in message, no details), a bad field (details.field where the endpoint names it), bad id, missing Idempotency-Key, invalid rules. Also 413 for a body over 2 MiB
idempotency_key_reused 422 the Idempotency-Key was used with a different path or body
plan_limit 422 / 403 the user's Chartnaut plan doesn't allow it (details.reason), or your developer plan's cap (details.owner: "developer", details.limit: apps (an app past your plan's count after a downgrade takes no new users), free_linked, managed_users, data; with used, cap). No auto top-up: upgrade on the Developers page
seat_limit 403 your Business seats are full this month (details.limit seats or pro_seats, used, cap): a new managed user can't start until you add seats; users active this month carry on
partner_limit 422 one of your partner limits (details.limit, and for demo accounts details.max)
rate_limited 429 your rate limit: details.limit is rate_minute or rate_burst. Also, with no details and Retry-After: 60, any call from an IP that sent 30 bad keys this minute, good keys included. See Retry-After
internal 500 retry; if it persists contact [email protected]
One of unauthorized scope_not_granted forbidden permission_denied not_managed not_linked plan_limit seat_limit partner_limit not_found conflict expected_count_mismatch rate_limited idempotency_key_reused switched_off invalid_request internal
messagestringRequired
detailsobject