ChartnautDocs

API overview

The Chartnaut API is the one the CLI calls, so anything the CLI does, your own code can do with HTTP and JSON: save indicators, definitions and studies, run them on Chartnaut's servers, read what they produced, and search the library of your own, Chartnaut's and the community's scripts. It returns indicator values, definition events and study results, never candles or tape. It is included on Starter and above.

The Chartnaut CLI is an open-source client for this API: its source on GitHub shows every call, with retries, paging and error handling.

Base URL

https://api.chartnaut.com/v1

Authentication

Make an API key on the Developers page, or sign in with chartnaut login. Send the key as a bearer token in the Authorization header on every call.

Your first call

Check that the key works:

curl https://api.chartnaut.com/v1/me \
  -H "Authorization: Bearer cn_live_XXXX"
{
  "user": "jane",
  "plan": "pro",
  "token": {
    "name": "Laptop script",
    "scopes": ["scripts:read", "scripts:write", "runs:write"],
    "expires_at": null
  }
}

Then run a built-in RSI on BTC over the last 30 days of 1-hour bars, holding the call for up to 30 seconds while it runs:

curl https://api.chartnaut.com/v1/runs \
  -H "Authorization: Bearer cn_live_XXXX" \
  -H "Content-Type: application/json" \
  -d '{"script":"chartnaut/rsi","instrument":"BTC","timeframe":"1h","window":{"last":"30d"},"wait":30}'

The answer is a Run with its status and a summary of what it produced. Create a run covers the rest of the loop.

The API reference has what every call shares, such as scopes, heavy calls, paging, errors and idempotency, and a page for every endpoint.