/Docs
Search docs or ask a question⌘K
DocsAgent
Changelog
CLI CLI Reference stx login

stx login

Authenticate the CLI with your Syntext account via browser or API token.

4 min read

Authenticate with Syntext. Credentials are stored locally and used by commands that talk to the Syntext API (stx deploy, stx build, stx projects, stx connect).

Usage

bash
stx login [options]

Options

FlagTypeDefaultDescription
--token <token>stringCLI session token to store instead of browser login (project API keys are passed to deploy/build/dev with --token)
--api-url <url>stringhttps://api.syntext.devAPI URL to sign in against. Only stx check --explain and stx migrate reuse it; other commands read SYNTEXT_API_URL (see Environment Variables)
bash
stx login

Starts a device flow: your browser opens to a verification page, you approve the request, and the CLI picks up the session automatically.

text
Syntext CLI Login
Opening browser to complete login...
If the browser doesn't open, visit:
https://app.syntext.dev/auth/device?code=XXXX-XXXX
✔ Authenticated as Jane Doe (jane@example.com)

The verification page shows the code from your terminal and the account you are signed in to. Check that the code matches, then choose Authorize device — or Deny if you did not start this login, which grants nothing (then sign out of every device from Profile).

If you are not signed in, the page sends you to log in first and returns you to the same code afterwards. A code is good for a short window and can only be used once: if the page says the code no longer works, run stx login again for a new one.

Since stx 0.7.0, stx login reacts to the browser at once instead of waiting for the code to time out:

•
Deny in the browser stops stx login with exit code 1: Sign-in was denied in the browser. Run stx login to try again.
•
A code that has expired or no longer exists stops it straight away, with exit code 1.

Releases before 0.7.0 kept polling until the code's own timeout in both cases.

The session is listed as stx CLI in the dashboard's sessions list, where you can revoke it. Since stx 0.7.0 every request carries a User-Agent of stx/<version> (<platform>; <arch>), which the dashboard uses to name the session (for example "stx CLI · macOS").

If browser login is unavailable, the CLI prints how to deploy with a project API key instead. Since stx 0.7.0 that message links straight to your project's Settings › API keys page (https://app.syntext.dev/projects/<project-id>/settings/api-keys) when you run it inside a connected project, and to https://app.syntext.dev/projects otherwise.

Unverified accounts

Accounts must verify their email before creating or changing anything — this is being rolled out. Once it applies, an account whose email isn't verified can't approve an stx login request: choosing Authorize device takes you to the dashboard's verification step instead. Verify there — open the link Syntext emailed you, or resend it — then approve.

If a request approved by an unverified account is still waiting to be picked up — say it was approved just before the requirement applied — stx login stops with exit code 1 and this message:

text
Verify your email address before signing in to the CLI. Open the link we emailed you (or resend it from the Syntext dashboard), then run `stx login` again.

Releases before stx 0.7.0 don't show it; they keep polling until the code times out. See Email verification.

Token-Based Login (CI / Headless)

For CI pipelines and machines without a browser, use a project API key instead of stx login:

1.
Open your project in the dashboard and go to Settings › API keys (https://app.syntext.dev/projects/<project-id>/settings/api-keys)
2.
Create a key with the build scope — the full key is shown once, so copy it then
3.
Pass it to the command that needs it:
bash
stx deploy --token stx_abc12345_...

An API key belongs to one project, not to a user — see Authentication and the CI/CD guide.

stx login --token <token> saves a token without the browser flow, but it checks the token against your account profile first, so it only accepts a user session token — an API key is refused there.

Revoked sessions

A CLI session can be signed out from elsewhere — revoked in the dashboard's sessions list, by a password change, or by signing out everywhere. The API then answers 401 session_revoked (see Sessions).

Since stx 0.7.0, every command handles this the same way:

•
It stops with exit code 1 and tells you to run stx login again.
•
If the revoked token is the one stx login saved, the saved credentials are deleted. A token you passed with --token leaves the saved login alone.
•
With --json, the error includes the code: { "success": false, "error": "…", "code": "session_revoked" }.
•
stx dev stops watching instead of retrying.

Releases before 0.7.0 reported the 401 as a failed request.

Logging Out

Remove stored credentials at any time:

bash
stx logout

stx logout deletes the credentials stored on this machine. It does not sign the session out on the server: the CLI session stays listed under your account until you revoke it — from the dashboard's sessions list, or with Revoke Session.

•
stx connect — link local docs to a project
•
stx projects — manage projects from the CLI
•
CI/CD — deploying from pipelines
Was this page helpful? Yes No
Previous
Product
Resources
Company
© 2026 SyntextBuilt with Syntext