# snizu login

Source: https://snizu.dev/docs/cli/login

## Usage [#usage]

```sh title="Usage"
snizu login [--token snz_pat_…] [--api <url>]
```

## Flags [#flags]

<Fields>
<Field name="--token" type="snz_pat_…">
The Partner API token. Without it, the CLI asks for one and doesn't show what you type. `SNIZU_TOKEN` works too.
</Field>

<Field name="--api" type="url">
Where the API answers, kept with the token. `SNIZU_API_URL`, then what was saved before, then `https://api.snizu.com`.
</Field>
</Fields>

## The token [#the-token]

Make one in the developer console under **Settings → API tokens**. It starts with `snz_pat_` and belongs to your organization, not to you, so it keeps working when someone leaves. What it may do is chosen when you make it:

<Fields>
<Field name="apps:deploy">
Register apps, make their versions and run a draft on a store: `snizu app init`, `app deploy`, `app dev`.
</Field>

<Field name="themes:push">
Start, preview, check and push themes: `snizu theme init`, `theme dev`, `theme check --server`, `theme push`.
</Field>

<Field name="logs:read">
Read your apps' webhook deliveries: `snizu app logs`.
</Field>

<Field name="stores:create">
Open and find development stores, and put functions on them: `snizu store create`, `function deploy`, and the store `app dev` and `theme dev` run on.
</Field>
</Fields>

A command that works on a development store needs both of its permissions: `snizu theme dev` needs `themes:push` and `stores:create`.

`snizu login` asks the API whose token it is before saving it, so a typo fails here rather than in the next command.

## Examples [#examples]

```shellsession title="Terminal"
$ snizu login
Make a token in the developer console: Settings → API tokens.
Partner API token:
✓ Signed in to Nakhla Studio.
This token can deploy apps, push themes, read logs, create development stores.
Saved in /home/salma/.config/snizu/credentials.json
```

Without a terminal, pass the token:

```shellsession title="Terminal"
$ snizu login --token "$SNIZU_TOKEN"
✓ Signed in to Nakhla Studio.
```

## Sign out [#sign-out]

`snizu logout` deletes the saved token from this machine. The token itself still works until you revoke it in the console.

```shellsession title="Terminal"
$ snizu logout
✓ Signed out. The token still works until you revoke it in the console.
```

<Callout title="In CI, skip login">
Set `SNIZU_TOKEN` and every command uses it. With no terminal, `snizu login` won't ask: it stops with "Pass --token, or set SNIZU_TOKEN, when no one is at the terminal."
</Callout>