Authentication
Personal access tokens, ayt login, and the AGENTIC_YT_TOKEN environment variable.
Every operation except GET /v1/health and the two CLI-login endpoints needs a personal access
token in the Authorization header:
Authorization: Bearer ayt_pat_…A token is ayt_pat_ followed by 43 URL-safe characters (32 random bytes). It carries your whole
account: its daily quota, its jobs and, if you connected one, its YouTube account. There are no
scopes.
The server stores only the SHA-256 hash of a token. The plaintext is shown once, when it is created, and cannot be recovered afterwards — if you lose it, revoke it and make another.
Getting a token
From the dashboard
Dashboard → Tokens → name it → Create token → copy it. Name tokens after
where they live (ci, claude-code on laptop); the list shows each token's prefix and when it was
last used, which is how you find the one to revoke.
With ayt login
ayt loginThis is a device-code flow, for machines where pasting a secret is awkward:
- The CLI calls
POST /v1/cli/deviceand receives auser_codelikeBCDF-2345, a secretpoll_token, and averification_url. - It prints the code and opens
verification_url_complete— the dashboard's/clipage with the code pre-filled. If no browser can be opened (--no-browser, SSH), open the URL yourself. - You sign in to the dashboard, check the code matches the one in your terminal, and approve.
- The CLI, which has been calling
POST /v1/cli/device/tokenevery couple of seconds, receives the new token on its next poll — exactly once — and saves it.
Codes expire after ten minutes and work once. The token created this way appears on the tokens page like any other, named after the client, and revoking it there signs that machine out.
ayt login --token ayt_pat_… stores a token you already have without the browser round-trip.
ayt logout forgets the saved token locally; it does not revoke it on the server.
Where the CLI looks for a token
In order:
AGENTIC_YT_TOKENin the environment.- The saved profile in
~/.agentic-yt/config.json(mode0600), written byayt login.
| Variable | Purpose |
|---|---|
AGENTIC_YT_TOKEN | Personal access token. Beats the saved one. |
AGENTIC_YT_URL | API base URL. Default https://api.agentic-yt.crafter.run. |
AGENTIC_YT_PROFILE | Which saved profile to use; --profile beats it. |
AGENTIC_YT_CONFIG | Path of the config file. |
For an agent, prefer the environment variable: it survives a fresh container and never touches disk.
Who am I?
ayt whoami # account, token source, profile, API URL — exit code 3 if not signed in
ayt me --json # the full GET /v1/me responseGET /v1/me returns the account (id, email, role, daily_quota), the token making the
request, the state of the connected YouTube account, and the limits that apply — a cheap first call
for an agent to confirm its credential works before starting real work.
When it fails
A missing, malformed or revoked token answers 401 with code
unauthorized. Retrying will not help; the agent needs a human to run
ayt login or supply a new token.
The dashboard is not the API
The dashboard signs humans in with Clerk and reads the database directly. A Clerk session is not a
credential for api.agentic-yt.crafter.run, and a personal access token does not sign you in to the
dashboard.