ChartnautDocs

Make a link for one of your users

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

Server to server only: if a browser could make links, anyone could attach their own Chartnaut account to someone else's account on your site. A link is single-use and expires in 30 minutes. Render frame_url in an iframe, or send the user to connect_url.

On approval your external_user_ref is bound to the Chartnaut account that signed in, with the scopes the user ticked: every required_scopes entry is shown ticked and fixed; other scopes are ticked and can be unticked. One-to-one per partner: a ref already bound to another Chartnaut account, or a Chartnaut account already bound to another of your refs, is refused in the window ("This <partner> account is linked to a different Chartnaut account."). A user who is already linked and asked for new scopes is shown only the new ones.

Send account_label, your own name for the person (their username or email on your site). The window shows it masked next to the Chartnaut account that is signed in: "Link <App> account j…@x.com to your Chartnaut account c…@gmail.com". Someone sent another person's link then sees the account isn't theirs before connecting. The full label never reaches the browser.

20,000 links in any 24 hours per partner and 5 open (unused, unexpired) links per ref. Past either it is 422 partner_limit with details.limit (links_per_day or open_links_per_user). An unknown scope, a scope not enabled for you, a required scope missing from scopes, an empty scopes, a bad external_user_ref or a session_id that isn't one of your sessions is 400 invalid_request. 403 switched_off while links are paused.

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
external_user_refstringRequired

Your id for the user. Stable; never an email.

1 to 200 characters
scopesarray of string · ScopeRequired
At least 1 items
required_scopesarray of string · Scope

A subset of scopes the user can't untick.

session_idstring

Open this session once linked. Must be one of your sessions (400 invalid_request otherwise) and belong to the user who signs in.

Pattern ^ses_[0-9]+$
account_labelstring

Your name for the person on your site (a username or email), shown masked on the consent screen ("j…@x.com", "ja…th"). Strongly recommended. Up to 200 characters; control, invisible and text-direction characters are 400 invalid_request.

At most 200 charactersExample [email protected]

Other fields are refused.

Responses#

201Createdapplication/json

The link.

Headers

Idempotent-Replayedstring

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

Only true

Body

object · Link
frame_urlstring (uri)Required

https://terminal.chartnaut.com/embed/<partner>?api=<api_host>&link=<token>[&session=ses_…]. Render it in an iframe.

connect_urlstring (uri)Required

https://terminal.chartnaut.com/connect?link=<token>, for a link from your own page instead of the frame.

expires_atstring (date-time)Required

30 minutes after it was made.

api_hoststring (uri)Required

The API origin that answered, e.g. https://eu-api.chartnaut.com. Already in frame_url.

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