---
title: "turnzero command reference"
description: "Look up each turnzero subcommand's usage line, options, and exit statuses, generated from the command's own sources."
slug: /reference/turnzero-command
order: 5
visibility: public
redirects_from: ["/reference/turnzero-cloud-command-reference","/reference/turnzero-cloud-command"]
---

# turnzero command reference

Generated automatically from the turnzero command's own texts, the ones its `--help` prints.

For installation steps, see [Install the turnzero command](/cloud/getting-started/prerequisites/#install-the-turnzero-command).

[The turnzero command](/cloud/concepts/turnzero-command/) says what the command is and how your AI coding tool runs it, and [The turnzero command's credential](/cloud/concepts/how-the-turnzero-command-finds-its-credential/) says which credential each line reads. This page gives each subcommand's usage line, its options, and the statuses it ends with.

In a usage line, `<command>` stands for the command that comes first. A person can use `turnzero`, or `turnzero.cmd` on Windows, if the command is installed. An AI coding tool should try `npx --no-update-notifier -y turnzero@next` first, using `npx.cmd` in place of `npx` on Windows. If npx cannot run, use the installed command if `--version` works. A part in square brackets is optional.

`<command> --help`, or `<command> -h`, prints every subcommand's usage line. `<command> <subcommand> --help` prints that subcommand's usage and options. `<command> --version` prints the command's version.

The list gives the statuses turnzero defines. Each subcommand section explains when it returns them:

- **0**: done.
- **1**: the command ran and failed, wholly or in part, as the printed lines say.
- **2**: the outcome is unknown, or the run stopped before its end\. The printed sentence gives the call that reads the outcome, or the command to run next. The command also ends 2 where it stops on an error of its own, and its last line says so\.
- **3**: nothing was started.

When a program started by `run` or `db connect` exits normally while turnzero waits for it, turnzero returns the program's exit status.

## hash

```text
<command> hash [--path <folder or .zip file>] [--list] [--origin <origin>]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--path` | `<folder or .zip file>` | The application folder to zip as deploy zips it, or a \.zip file whose bytes to hash as they are\. If omitted, the folder the command runs in\. |
| `--list` | None: a flag | After the hash and any warnings, prints one line for each file in the zip: its size in bytes, then its name\. It shows what a deploy from the folder would upload\. It lists only a folder's zip, so it is refused with a \-\-path that gives a \.zip file\. |
| `--origin` | `<origin>` | The platform's address, as in a command copied from beside a deploy command\. The hash subcommand sends no request, so the address has no use here: it is checked as under deploy, then ignored\. |

Its statuses:

- **0**: the hash printed.
- **3**: no hash was printed.

## deploy

```text
<command> deploy --application <application id> [--origin <origin>] [--path <folder or .zip file>] [--rotate-database-credential] [--json] [--env <environment>]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--application` | `<application id>` | The application to deploy, by its id, a lowercase UUID, as given in the command your tool's tzcloud\_deploy\_command call returns\. Required. |
| `--origin` | `<origin>` | The platform's address\. If omitted, the address in TURNZERO\_CLOUD\_ORIGIN, or <https://turnzero.ai> if that is unset\. Under TURNZERO\_CLOUD\_MINTED\_TOKEN the token is sent only to the address in TURNZERO\_CLOUD\_ORIGIN, or to <https://turnzero.ai> if that is unset\. Otherwise it gives the address whose token the command reads from this computer's credential file, and that token is sent only to that address\. |
| `--path` | `<folder or .zip file>` | The application folder to zip and upload, or a \.zip file to upload as it is\. If omitted, the folder the command runs in\. |
| `--rotate-database-credential` | None: a flag | Rotates production's database credential with this deploy, as given in the command a tzcloud\_deploy\_command call with rotate\_database\_credential returns\. |
| `--json` | None: a flag | Prints the result as one JSON object on standard output when the run ends, and every other line on standard error: contract\_version, status, outcome, application, environment, upload, version, address, failed\_step, and error\. The exit status is the same\. |
| `--env` | `<environment>` | The environment to deploy to, development or production\. If omitted, the platform chooses, and the command deploys to the environment given in the platform's response\. The command a tzcloud\_deploy\_command call returns does not include it\. |

Its statuses:

- **0**: the version deployed, or the deploy started if TURNZERO\_DEPLOY\_NO\_WAIT is set.
- **1**: the deploy failed.
- **2**: the wait stopped, or the start got no response: the deploy may go on, and tzcloud\_read\_status reads it.
- **3**: an option, credential, folder, or the folder's binding was refused, or no credential was read\. Or the platform was too old, or no usable upload was returned\. Or no zipped file refers to the health path\. Or the upload or start was refused, or the upload got no response.

## check

```text
<command> check --application <application id> [--origin <origin>] [--path <folder or .zip file>]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--application` | `<application id>` | The application whose deploy to check, by its id, a lowercase UUID, as given in the command your tool's tzcloud\_check\_deploy call returns\. Required. |
| `--origin` | `<origin>` | The platform's address\. If omitted, the address in TURNZERO\_CLOUD\_ORIGIN, or <https://turnzero.ai> if that is unset\. Under TURNZERO\_CLOUD\_MINTED\_TOKEN the token is sent only to the address in TURNZERO\_CLOUD\_ORIGIN, or to <https://turnzero.ai> if that is unset\. Otherwise it gives the address whose token the command reads from this computer's credential file, and that token is sent only to that address\. |
| `--path` | `<folder or .zip file>` | The application folder to zip as deploy zips it, or a \.zip file to check as it is\. If omitted, the folder the command runs in\. Nothing is uploaded\. |

Its statuses:

- **0**: none of the checks would refuse a deploy now.
- **1**: a deploy would be refused now, and the refused: lines give each refusal.
- **3**: the check could not finish\. An option, credential, folder, or the folder's binding was refused, or no credential was read and the routes were printed\. Or the platform was too old\. Or the check call was refused, got no response, was redirected, or failed.

## promote

```text
<command> promote --application <application id> [--version-number <number>] [--origin <origin>]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--application` | `<application id>` | The application to promote, by its id, a lowercase UUID, as tzcloud\_list\_applications returns it\. Required. |
| `--version-number` | `<number>` | The number of a version in the application's history to promote, as tzcloud\_list\_versions returns it: a whole number from 1, at most nine digits, with no leading zero\. If omitted, the version the development environment serves\. |
| `--origin` | `<origin>` | The platform's address\. If omitted, the address in TURNZERO\_CLOUD\_ORIGIN, or <https://turnzero.ai> if that is unset\. Under TURNZERO\_CLOUD\_MINTED\_TOKEN the token is sent only to the address in TURNZERO\_CLOUD\_ORIGIN, or to <https://turnzero.ai> if that is unset\. Otherwise it gives the address whose token the command reads from this computer's credential file, and that token is sent only to that address\. |

Its statuses:

- **0**: the promoted version serves production.
- **1**: the promote ended failed, as the printed detail says.
- **2**: the promote is still running, or its start is unknown: the printed line gives the tzcloud\_read\_status call that reads it.
- **3**: nothing was promoted\. An option or the credential was refused, or no credential was read and the routes were printed\. Or the platform was too old, or it refused the call.

## db connect

```text
<command> db connect --grant <request id> [--origin <origin>] -- <tool> [arguments]
  <command> db connect --environment development [--settings-file <path>] -- <tool> [arguments]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--grant` | `<request id>` | The lowercase UUID of the pending action returned by your AI tool's tzcloud\_open\_database\_connection call\. |
| `--environment` | `<environment>` | Use the development database\. The only accepted value is development\. Pass this option without \-\-grant\. |
| `--settings-file` | `<path>` | The environment file to read for development\. If omitted, the command reads \.env in the current folder\. |
| `--origin` | `<origin>` | The platform's address\. If omitted, the address in TURNZERO\_CLOUD\_ORIGIN, or <https://turnzero.ai> if that is unset\. Under TURNZERO\_CLOUD\_MINTED\_TOKEN the token is sent only to the address in TURNZERO\_CLOUD\_ORIGIN, or to <https://turnzero.ai> if that is unset\. Otherwise it gives the address whose token the command reads from this computer's credential file, and that token is sent only to that address\. |

Its statuses:

- **0**: the tool exited with status 0\. For a normal exit with any other status, the command returns the tool's status.
- **1**: the tool could not start or ended by a signal.
- **3**: nothing was opened\. Check the option, credential or approval message.

## secret

```text
[echo <secret grant> |] <command> secret store|rotate --name <name> [--application <application id>] [--environment <environment>] [--value-file <file>] [--value-variable <variable name>] [--value-prompt] [--restart] [--origin <origin>]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--name` | `<name>` | The name the value is stored under, as given in the command the tzcloud\_store\_secret call returns\. Required. |
| `--application` | `<application id>` | The application whose scope contains the secret\. If omitted, the account's scope\. |
| `--environment` | `<environment>` | The environment of that application whose scope contains the secret, development or production\. It goes with \-\-application\. |
| `--value-file` | `<file>` | The file that contains the value, read as UTF\-8 with one trailing line end dropped\. Give exactly one of this, \-\-value\-variable, and \-\-value\-prompt\. |
| `--value-variable` | `<variable name>` | The name of an environment variable that contains the value, for a run where a machine sets it, such as a hosted run's secrets store\. The command gives the variable's name, never its value, and an unset or empty variable is refused\. So is the name of one of the command's own credential variables, TURNZERO\_CLOUD\_MINTED\_TOKEN or TURNZERO\_CLOUD\_UPLOAD\_GRANT, in any letter case\. |
| `--value-prompt` | None: a flag | Asks for the value at the terminal without showing it\. It needs a terminal of your own, one that also shows the command's output: in a tool's shell the command refuses it, so use \-\-value\-file there instead\. |
| `--restart` | None: a flag | Only under rotate, with no grant piped: the write under this computer's token also restarts the environment whose running copy has the old value, and the restart in the response says how\. A run under a grant refuses it\. |
| `--origin` | `<origin>` | The platform's address\. If omitted, <https://turnzero.ai>; with no grant piped, the address in TURNZERO\_CLOUD\_ORIGIN if that is set\. With no grant piped, it gives the address whose token the command reads from this computer's credential file, and that token is sent only to that address\. |

Its statuses:

- **0**: the value written.
- **2**: the write got no response, or a response that is not a refusal: tzcloud\_list\_secrets shows when the name was last written.
- **3**: nothing was written.

## put

```text
echo <upload grant> | <command> put --area <area> --name <name> --path <file> [--origin <origin>]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--area` | `<area>` | The storage area the file lands in, one of the application's, as given in the command the tzcloud\_mint\_upload\_grant call returns\. Required. |
| `--name` | `<name>` | The name the file is stored under in the area, as given in that command\. Required. |
| `--path` | `<file>` | The file on this machine to upload, sent as it is\. Required. |
| `--origin` | `<origin>` | The platform's address\. If omitted, <https://turnzero.ai>\. |

Its statuses:

- **0**: the file written.
- **2**: the write got no response, or a response that is not a refusal: the file may have landed, and a fresh command writes it again.
- **3**: nothing was written.

## export download

```text
echo <download grant> | <command> export download --export <application id>/<export id> [--path <folder>] [--origin <origin>]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--export` | `<application id>/<export id>` | The application and its completed export, as the tzcloud\_request\_export call with download: true returned them, joined by a slash\. Required. |
| `--path` | `<folder>` | The folder the files are written into: a new or empty one, or one an earlier run of the same export wrote\. If omitted, a new folder named for the export in the folder the command runs in\. That is refused if the folder the command runs in contains package\.json, since a deploy from it would carry the export\. |
| `--origin` | `<origin>` | The platform's address\. If omitted, <https://turnzero.ai>\. |

Its statuses:

- **0**: every file the manifest lists on disk, moved ones reported.
- **1**: a file failed, was cut short, or was refused: the closing lines give the command to run again, or a fresh export if a file was reported as an absent name.
- **2**: the run stopped before the end: a fresh command from the tzcloud\_request\_export call with download: true resumes it.
- **3**: an option, the grant, the folder, or the manifest was refused, or the platform was too old, and nothing was written.

## library take

```text
<command> library take --entry <name> [--path <project root>] [--origin <origin>]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--entry` | `<name>` | The library entry to take, by the name tzcloud\_read\_library returns, such as storage or ui/styles\. Required. |
| `--path` | `<project root>` | The project's root: the folder that contains system/ or system\.json beside app/\. When taking a first entry, it is the folder where a new system/ is made\. If omitted, the folder the command runs in\. |
| `--origin` | `<origin>` | The platform's address\. If omitted, the address in TURNZERO\_CLOUD\_ORIGIN, or <https://turnzero.ai> if that is unset\. Under TURNZERO\_CLOUD\_MINTED\_TOKEN the token is sent only to the address in TURNZERO\_CLOUD\_ORIGIN, or to <https://turnzero.ai> if that is unset\. Otherwise it gives the address whose token the command reads from this computer's credential file, and that token is sent only to that address\. |

Its statuses:

- **0**: the entry taken, and installed if it has compiled modules.
- **1**: the entry, its row, and the copy written, and an install failed, the copy stayed unreadable after the second install, or the application manifest's packages was not written.
- **3**: nothing was written.

## provision

```text
<command> provision --application <application id> [--settings-file <file>] [--origin <origin>] [--claim]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--application` | `<application id>` | The application whose development settings are written, by the id tzcloud\_create\_application returned, as given in the command the tzcloud\_submit\_manifest call returns\. Required. |
| `--settings-file` | `<file>` | The environment file to write, named \.env or \.env\.&lt;name&gt;, the names every zip the command builds leaves out\. If omitted, \.env in the folder the command runs in\. A path outside that folder, such as \.\./\.env\.turnzero, is allowed, so the credentials can stay out of the project\. An existing file keeps every line the command does not set\. |
| `--origin` | `<origin>` | The platform's address, which is also written as TURNZERO\_CLOUD\_API and TURNZERO\_CLOUD\_GATEWAY\_URL\. If omitted, the address in TURNZERO\_CLOUD\_ORIGIN, or <https://turnzero.ai> if that is unset\. Under TURNZERO\_CLOUD\_MINTED\_TOKEN the token is sent only to the address in TURNZERO\_CLOUD\_ORIGIN, or to <https://turnzero.ai> if that is unset\. Otherwise it gives the address whose token the command reads from this computer's credential file, and that token is sent only to that address\. |
| `--claim` | None: a flag | With no token for the address, presents this computer's pending verifier, the one the first step kept, as the credential of the provision grant the tzcloud\_submit\_manifest call recorded\. If the platform has no such grant, the run prints the first step\. Under a token it runs as the command without \-\-claim does\. |

Its statuses:

- **0**: the settings written, or the first step printed its challenge and call.
- **1**: the settings written without a connection limit, which the platform's response did not include.
- **2**: a credential was re\-minted, or may have been, and its value was not written: the printed sentence gives the command that re\-mints again.
- **3**: nothing was re\-minted.

Provisioning can restart an already deployed development environment so it uses the replacement credentials\. The restart uses the version already serving\.

## run

```text
<command> run [--path <folder>] [--settings-file <file>] [--port <port>] [--sign-in <hostname>] [--origin <origin>]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--path` | `<folder>` | The application folder npm start runs in\. If omitted, the folder the command runs in\. |
| `--settings-file` | `<file>` | The environment file whose settings the application receives, as provision writes it\. If omitted, \.env in the folder the command runs in\. A file that is not there is read as no settings\. |
| `--port` | `<port>` | The port the application listens on, a whole number from 1 to 65535, set as PORT over the file's line and the shell's\. With \-\-sign\-in, or where the folder holds client/, it is the port the command listens on and the browser opens, and the application gets another port behind it as PORT\. |
| `--sign-in` | `<hostname>` | For server applications only, the application's hostname for browser sign\-in on this machine\. The command listens on the run's port and serves a GET naming a file in client/ first\. Of the remaining requests, those under /\_\_account/ go to that hostname\. The others go to the application\. The hostname must be one of the application's own, which one tzcloud\_read\_status call names under the credential deploy reads\. |
| `--origin` | `<origin>` | The platform's address, as the other subcommands take it\. Without \-\-sign\-in, run reads no origin, since it starts the application on this machine and makes no request to another machine\. The option is accepted so every command can include it: it is checked as under deploy, then ignored\. With \-\-sign\-in, it names the address of the tzcloud\_read\_status call, as under deploy\. |

Its statuses:

- **0**: the application ended with status 0.
- **3**: no application was started.

Once the app starts, this command can return the app’s own exit status, including 3\. The command prints a message if it could not start the app\.

## scaffold

```text
<command> scaffold [--template <template>] [--resource <plural>] [--singular <singular>] [--fields <list>] [--path <project root>] [--origin <origin>] [--application <application id>]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--template` | `<template>` | The template to write, one of server\-hello, server\-database, server\-scheduled\-job, server\-sign\-in, server\-ai\-chat, static\-site, functions\-database, and functions\-sign\-in, server\-hello if omitted\. The server\-hello template is a server running the smallest deployable service, whose one API route, GET /api/hello, returns hello world\. The server\-database template is a server running a notes service that keeps its data in the platform's database\. The server\-scheduled\-job template is a server running the server\-hello service with one handler that the platform runs each hour through the Schedule package\. The server\-sign\-in template is a notes app with sign\-in that runs on an application server and stores each user's own notes in the platform's database\. The server\-ai\-chat template is a server with sign\-in and a plain HTML and script page for an AI conversation, with platform model calls charged to your account balance\. The static\-site template is a static site whose pages, styles and other files under client/ are served without a server of the application's own\. The functions\-database template is a notes page with a function and a database, served as a serverless application\. The functions\-sign\-in template is a notes app with sign\-in that runs as a serverless application and stores each user's own notes in the platform's database\. For a public gallery with no sign\-in, follow the complete starter in Store files, under A public upload service with no sign\-in \(read\_documentation, page /cloud/guides/store\-files/\)\. |
| `--resource` | `<plural>` | Under the server\-database and server\-sign\-in templates, the resource the service keeps, by its plural, the word of its table and its route\. It is an ASCII lower\-case letter, then ASCII lower\-case letters and digits, at most 30 characters\. It is never the word of the template's own route: health under server\-database and health under server\-sign\-in\. The files use its names wherever the template uses notes, note, Notes, and Note, file names included\. If omitted, the service keeps notes\. A template that keeps no resource refuses it\. |
| `--singular` | `<singular>` | The resource's singular, in the same form, with \-\-resource\. If omitted, the plural without its closing s, so a plural that does not end in s needs it\. |
| `--fields` | `<list>` | Under the server\-database and server\-sign\-in templates, the resource's columns: fields separated by commas, each a name, a colon, and a kind, such as "name:text,message:text", written between double quotes\. A name is an ASCII lower\-case letter, then ASCII lower\-case letters, digits, and underscores, at most 30 characters\. It is never a column the migration writes itself: id under server\-database and id, owner, or created\_at under server\-sign\-in\. A kind is text, integer, boolean, or timestamp\. For a type outside these, name the nearest kind, then change the written migration and routes: the files are your service's own\. Every column is required, and a list has one to 20 fields\. Without \-\-fields, server\-database keeps title and server\-sign\-in keeps body, each a text column\. A template that keeps no resource refuses it\. |
| `--path` | `<project root>` | The project's root, the folder app/ and system/ are written in, made if it does not exist\. If omitted, the folder the command runs in\. |
| `--origin` | `<origin>` | The platform's address\. Under a template that takes library entries, if omitted, the address in TURNZERO\_CLOUD\_ORIGIN, or <https://turnzero.ai> if that is unset\. There, under TURNZERO\_CLOUD\_MINTED\_TOKEN the token is sent only to the address in TURNZERO\_CLOUD\_ORIGIN, or to <https://turnzero.ai> if that is unset\. Otherwise it gives the address whose token the command reads from this computer's credential file, and that token is sent only to that address\. Under a template that takes none, if omitted, <https://turnzero.ai>\. |
| `--application` | `<application id>` | Under every template, the application the service deploys to, by its id, a lowercase UUID, as tzcloud\_create\_application returns it\. The written manifest\.json gives it in its application member, which binds the folder to that application, so a deploy or check command that gives another is refused\. If omitted, the first deploy writes the member\. |

Its statuses:

- **0**: the files written, the entries taken if the template takes any, and, where it holds package\.json, dependencies installed and tests passed.
- **1**: the files written, and an install or the tests failed, or a taken entry stayed unreadable after the second install.
- **2**: the run stopped before its end\. An interrupt or another signal ended npm, or the command met an error of its own, or something came to exist at app while it wrote\. The printed sentence gives the next step.
- **3**: nothing was written.

## authorize

```text
<command> authorize [--origin <origin>] [--mint <id>]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--origin` | `<origin>` | The platform's address this computer is authorized at\. If omitted, the address in TURNZERO\_CLOUD\_ORIGIN, or <https://turnzero.ai> if that is unset\. A \-\-origin given in the command must be <https://turnzero.ai>, <https://dev.turnzero.ai>, or the address in TURNZERO\_CLOUD\_ORIGIN\. It may be an address of this machine only if TURNZERO\_CLOUD\_ORIGIN is set to it\. |
| `--mint` | `<id>` | The mint, by its id, a lowercase UUID, as given in the command a mint\_token call returns\. The id is not a credential\. With it, authorize reads nothing on standard input and presents this computer's verifier for that mint\. |

Its statuses:

- **0**: the challenge printed, or this computer authorized.
- **1**: a token was minted and not kept, or the token this computer had before was not revoked: the printed lines name revoke\_token.
- **2**: the exchange got no response, or a response that is not a refusal: list\_tokens shows whether a token was minted.
- **3**: nothing was minted\. An option, the mint's id, the credential file, or a token code piped to it was refused\. Or no request was pending, the platform was too old, or the exchange was refused.

## logout

```text
<command> logout [--origin <origin>]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--origin` | `<origin>` | The platform's address whose authorization this computer ends\. If omitted, the address in TURNZERO\_CLOUD\_ORIGIN, or <https://turnzero.ai> if that is unset\. |

Its statuses:

- **0**: the entries removed and the token revoked or ended, or none was kept.
- **1**: the token was refused its revocation, or the credential file could not be written after it: the printed lines name revoke\_token.
- **2**: the revocation got no response, or a response that is not a refusal: list\_tokens shows whether the token still exists.
- **3**: nothing was sent or removed: an option or the credential file was refused.

## token

```text
[echo <token code> |] <command> token request|claim [--origin <origin>]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--origin` | `<origin>` | The platform's address the token is minted at\. If omitted, the address in TURNZERO\_CLOUD\_ORIGIN, or <https://turnzero.ai> if that is unset\. A \-\-origin given in the command must be <https://turnzero.ai>, <https://dev.turnzero.ai>, or the address in TURNZERO\_CLOUD\_ORIGIN\. It may be an address of this machine only if TURNZERO\_CLOUD\_ORIGIN is set to it\. |

Its statuses:

- **0**: the challenge printed, or the value printed once.
- **1**: the token minted was an authorized computer's, and is revoked if it could be: the printed lines name revoke\_token.
- **2**: the exchange got no response, or a response that is not a refusal: list\_tokens shows whether a token was minted.
- **3**: nothing was minted\. An option, the credential file, the token code, or a standard error that is not a terminal was refused\. Or no request was pending, the platform was too old, or the exchange was refused.

## login

```text
<command> login [--origin <origin>] [--no-browser] [--device]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--origin` | `<origin>` | The platform's address this computer signs in at\. If omitted, the address in TURNZERO\_CLOUD\_ORIGIN, or <https://turnzero.ai> if that is unset\. A \-\-origin given in the command must be <https://turnzero.ai>, <https://dev.turnzero.ai>, or the address in TURNZERO\_CLOUD\_ORIGIN\. |
| `--no-browser` | None: a flag | Opens no browser and binds no port: open the printed address in a browser on any computer, approve, and paste the code the page shows\. |
| `--device` | None: a flag | For an AI coding tool that cannot authorize this computer through a signed\-in Turn Zero connection, with no terminal for a person\. It prints a link for a person to open on any device and approve, and needs no terminal, port, or browser here\. It checks every 5 seconds for up to an hour, and keeps the token once the person approves\. Run again within the hour, it prints a link to the same request and takes the token once approved\. |

Its statuses:

- **0**: this computer signed in.
- **1**: a token was minted and not kept, or the token this computer had before was not revoked: the printed lines name revoke\_token.
- **2**: the exchange got no response, or a response that is not a refusal: list\_tokens shows whether a token was minted.
- **3**: nothing was minted\. An option or the credential file was refused, or no code or approval arrived in time or could arrive\. Or the prompt was stopped, or given what is not a token code\. Or the platform was too old, or the exchange was refused.

## whoami

```text
<command> whoami [--origin <origin>]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--origin` | `<origin>` | The platform's address whose token this computer reads\. If omitted, the address in TURNZERO\_CLOUD\_ORIGIN, or <https://turnzero.ai> if that is unset\. |

Its statuses:

- **0**: the account was read.
- **1**: the platform refused the read, for example because it no longer accepts the token: the printed lines name login.
- **2**: the read got no response, or a response that is not a refusal.
- **3**: nothing was read\. An option or the credential file was refused, or the platform was too old\. Or no live token exists for the address, and the printed lines give the next steps that need no new sign\-in, then the sign\-in route.

## session

```text
<command> session --application <application id> --environment <environment> --end-user <end user id or label> --out <path> [--origin <origin>] [--force]
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--application` | `<application id>` | The application whose test end user signs in, by its id, as given in the command your tool's tzcloud\_sign\_in\_test\_end\_user call returns\. Required. |
| `--environment` | `<environment>` | The environment the end user signs in to, development or production\. Required. |
| `--end-user` | `<end user id or label>` | The test end user, by the id or the label tzcloud\_add\_test\_end\_users returned\. Required. |
| `--out` | `<path>` | The cookie jar file the session's cookie is written into, which curl \-b reads\. Its folder must exist\. An existing file there is refused unless the command includes \-\-force\. A path inside the folder the command runs in is refused if that folder contains package\.json, since a deploy from it would upload the jar\. Required. |
| `--origin` | `<origin>` | The platform's address\. If omitted, the address in TURNZERO\_CLOUD\_ORIGIN, or <https://turnzero.ai> if that is unset\. Under TURNZERO\_CLOUD\_MINTED\_TOKEN the token is sent only to the address in TURNZERO\_CLOUD\_ORIGIN, or to <https://turnzero.ai> if that is unset\. Otherwise it gives the address whose token the command reads from this computer's credential file, and that token is sent only to that address\. |
| `--force` | None: a flag | Replaces the file given to \-\-out if one exists\. |

Its statuses:

- **0**: the end user was signed in and the session's cookie written to the file given to \-\-out.
- **1**: the platform refused the sign\-in, and the printed lines name the platform's error and detail\. Or the end user was signed in, and the cookie jar could not be written, so the session's cookie was not kept.
- **2**: the sign\-in call got no response, was redirected, failed, or got a response that is neither a refusal nor a session, and nothing was written.
- **3**: nothing was sent, or nothing was written\. An option, the file given to \-\-out, or the credential was refused\. Or no credential was read, and the two routes to get one were printed\. Or the platform was too old, or the jar's folder did not allow a write.

## tzmesh

```text
<command> tzmesh register --name <name> [--rotate] [--secret <secret name>] [--to-file <file>] [--application <application id>] [--environment <environment>] [--webhook-origin <origin>] [--webhook-secret <secret name>] [--description <text>] [--title <text>] [--join <channels>] [--public] [--force] [--origin <origin>] [--tzmesh-estate <estate>] [--mint <id>]
  <command> tzmesh listen --wake-url <wake URL> --recovery-check <check ID> [--codex-executable <executable>] [--resume] [--previous-state <state file>] [--recheck <failed generation>] [--change-reference <reference>]
  <command> tzmesh status --wake-url <wake URL>
  <command> tzmesh capture --wake-url <wake URL>
  <command> tzmesh complete --wake-url <wake URL> --generation <generation>
  <command> tzmesh stop --wake-url <wake URL>
```

Its options:

| Option | Value | Description |
|---|---|---|
| `--name` | `<name>` | For register \(required\): The agent's name, 1 to 32 letters, digits, hyphens, and underscores\. Its handle is this name under your account's handle\. |
| `--rotate` | None: a flag | For register: Adds a program key to the standing agent named by \-\-name and saves it to the chosen destination\. For webhook rotations, it sets the webhook on the new key\. After the command succeeds, restart your program, then end the old key\. |
| `--secret` | `<secret name>` | For register: The name the agent's secret is stored under in your account's secret store\. Give exactly one of this and \-\-to\-file\. Under it, the secret never reaches your tool\. |
| `--to-file` | `<file>` | For register: A file the agent's secret is written into, alone on one line and readable by you alone, for a program on this computer\. Anything that runs as you can read it, your tool among them\. |
| `--application` | `<application id>` | For register: Under \-\-secret, the application whose scope holds the secret\. Where absent, the account's scope\. |
| `--environment` | `<environment>` | For register: Under \-\-secret, the environment of that application whose scope holds the secret, development or production\. It goes with \-\-application\. |
| `--webhook-origin` | `<origin>` | For register: Under \-\-secret, the https origin of the application that hosts the agent\. The run sets the agent's webhook to /tzmesh/webhook at that origin, and stores its signing secret under \-\-webhook\-secret\. |
| `--webhook-secret` | `<secret name>` | For register: With \-\-webhook\-origin, or alone under \-\-rotate, the name the webhook's signing secret is stored under, in the scope \-\-secret is stored in\. It names the secret and never holds it\. |
| `--description` | `<text>` | For register: Under \-\-secret, the agent's description, at most 120 characters\. |
| `--title` | `<text>` | For register: Under \-\-secret, the agent's title, at most 80 characters\. |
| `--join` | `<channels>` | For register: Under \-\-secret, the channels the agent joins, as one value: channel ids, \#names, or account/\#names, separated by commas\. |
| `--public` | None: a flag | For register: Under \-\-secret, makes the agent public at its register\. Whether it is public is your choice: a tool passes this only after you answer\. |
| `--force` | None: a flag | For register: Under \-\-to\-file, replaces the file that stands there\. |
| `--origin` | `<origin>` | For register: The platform's address the secret is stored at, <https://turnzero.ai> or <https://dev.turnzero.ai>\. Where absent, the address TURNZERO\_CLOUD\_ORIGIN holds, or <https://turnzero.ai> where it is unset\. |
| `--tzmesh-estate` | `<estate>` | For register: The estate the agent is registered at, production or development: its platform mints the run's token, and its tzMesh service registers the agent\. Where absent, the estate of \-\-origin\. |
| `--mint` | `<id>` | For register: The mint the line names, by its id, as the line a mint\_token call answers names it\. The id is no credential\. Under it, the command presents this computer's verifier for that mint\. |
| `--wake-url` | `<wake URL>` | For listener acts, this chat’s returned secret\-free wake URL, with its wait values\. |
| `--recovery-check` | `<check ID>` | For listen, the existing native scheduled recovery check for this chat\. The host verifies it is active before starting\. |
| `--codex-executable` | `<executable>` | For listen, an optional concrete native Codex executable\. Unsupported command shims require an explicitly selected executable\. |
| `--generation` | `<generation>` | For complete, the generation captured before all\-channel acknowledged reading and handling\. A stale generation completes nothing\. |
| `--resume` | None: a flag | For listen, explicitly resume after stopping, correcting configuration, or a successful diagnostic read of a missing listener\. |
| `--previous-state` | `<state file>` | For the first listen, import the old documented shell\-loop state after its wrapper and hold actually ended\. Its files remain intact\. |
| `--recheck` | `<failed generation>` | For listen, deliberately recheck a completed failed generation after an actual verified capability or authorization change\. Never retry an uncertain enqueue\. |
| `--change-reference` | `<reference>` | With recheck, the host’s retained reference to that verified change\. This records the decision; it grants no permission\. |

Its statuses:

- **0**: the challenge printed\. On completion, setup registered the agent and saved its secret, or rotation added a key and saved the required values\. The run token was revoked; a listener act completed or its loop stopped.
- **1**: a step failed, or the run token could not be revoked\. Read the printed lines to see what changed and how to recover; a listener stopped with a retained failure or missing\-listener result.
- **2**: an outcome is unknown: the printed lines name list\_tokens, tzmesh\_list\_participants, or tzcloud\_list\_secrets\. Follow the printed recovery before restarting or ending a key; for a listener, inspect local status and its retained generation before restarting.
- **3**: the command stopped before changing the agent or destination\. If the command minted a run token, it revoked it\. An option, the credential file, the file \-\-to\-file names, or this computer's token was refused\. Or no request was pending, the platform was too old, or the exchange was refused\. Or, under \-\-rotate, the agent, a stored name, or the signing secret's name was missing; a listener act was refused, with its evidence retained.

The stop command can confirm that it accepted the request while the listener finishes work already in progress\. Check that the listener has ended before starting a replacement\.
