ChartnautDocs

Get a frame URL for a user

POST/users/{user}/frame-token
Base URL
https://api.chartnaut.com/partner/v1
Auth
Bearer key
Operation ID
createFrameToken

Needs frame:instant (403 scope_not_granted otherwise). Valid 24 hours. Asking again returns the same token while it has more than an hour left, so cache it; one live token per user. frame_url is ready to render: https://terminal.chartnaut.com/embed/<partner>?api=<api_host>[&session=ses_…]#ft=<frame_token>. api_host is the API origin the user linked through (their region), or the one you called if that isn't known. A token opens a backtest-only sign-in that ends when the token expires or the user is unlinked. Each token can be claimed 100 times a day. 403 switched_off while frames are paused. An unknown field is 400 invalid_request. One token per grant (app, mode, persist, session): the same grant gets the same token while it has over an hour left. Past 60 mints an hour for one user and app: 429 rate_limited with Retry-After and details.retry_after (cache the URL until an hour before expires_at).

Backtests by key (backtest, instead of session; needs terminal:write or sessions:write, else 403 scope_not_granted): the first mint for a key creates a normal backtest owned by the user (their plan's window and history apply: 422 plan_limit; every market; basic costs; per-asset-class margin at 1:100), tagged with the app so orders from your page may trade in it; every later mint with that key in that app returns the same session, whatever window it sends. The frame is bound to it. It is not a partner session: GET /sessions doesn't list it. A bad field is 400 invalid_request with details.field (backtest.key, backtest.start, backtest.end, backtest.starting_balance). The window keeps its times of day (start 08:00 and end 20:00 on one day is twelve hours). The backtest is made only once nothing else refuses the mint (the hourly ceiling, seats, your plan, switches): a refused mint makes nothing. Later mints may also name it by its id (session).

Path parameters#

userstringRequired

usr_<id>, or your own ref as ext:<external_user_ref> (URL-encoded).

Pattern ^(usr_[0-9]+|ext:.+)$Example ext:user-8812

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, optional#

object
appstring

app_<id> or the app's slug. Default your default app (its slug is your partner slug).

modestring

Left out is today's backtest frame. live needs frame:live on your account and from the user.

One of backtest live
persiststring

Where the layout is kept. Default the app's. account is refused for a managed user.

One of device account none host
sessionstring

Open this session (one of yours for this user, or the user's backtest made in this app, e.g. by backtest.key; 404 not_found with details.session otherwise). Not with backtest.

Pattern ^ses_[0-9]+$
backtestobject
Show fields
keystringRequired

Your name for this backtest: visible ASCII, no spaces. Unique per app and user.

1 to 200 characters
startstringRequired

As CreateSession.start: a UTC date or an RFC 3339 time, in the past.

endstring

As CreateSession.end. Left out: plays on to the latest data.

starting_balancenumber

USD.

Default 100000More than 0, at most 1,000,000,000

Other fields are refused.

Other fields are refused.

Responses#

200OKapplication/json

The live frame token.

Headers

Idempotent-Replayedstring

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

Only true

Body

object · FrameToken
frame_tokenstringRequired

A bearer credential for this user's frame: keep it out of logs and other users' pages.

Pattern ^cnft_[0-9a-f]{64}$
expires_atstring (date-time)Required
frame_urlstring (uri)Required

https://terminal.chartnaut.com/embed/<partner>?api=<api_host>[&session=ses_…]#ft=<frame_token>. Ready to render; the token is in the #fragment.

api_hoststring (uri)Required

The API origin the frame signs in on, e.g. https://eu-api.chartnaut.com: the one the user linked through, else the one you called. Already in frame_url.

sessionstring

The session the frame is bound to (the one you named, or the backtest's). Left out when none.

Pattern ^ses_[0-9]+$
backtestobject

With backtest in the request.

Show fields
keystringRequired
sessionstringRequired
Pattern ^ses_[0-9]+$
createdbooleanRequired

True when this mint made the session.

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