---
title: "Sign in from a terminal or a script | Hostemi"
description: "The browser sign-in, a key for scripts and CI, where it is stored, and signing out. Step-by-step help from the Hostemi docs for vacation rental hosts."
canonical: https://hostemi.com/docs/cli/authentication
source: https://hostemi.com/docs/cli/authentication.md
---

# Sign in from a terminal or a script

The browser sign-in, a key for scripts and CI, where it is stored, and signing out.

#### On this page

1. [In a terminal: the browser sign-in](#in-a-terminal-the-browser-sign-in)
2. [Where the key is kept](#where-the-key-is-kept)
3. [Scripts and CI: a key](#scripts-and-ci-a-key)
4. [Not signed in](#not-signed-in)
5. [Another API address](#another-api-address)

## In a terminal: the browser sign-in

`hostemi login` starts a device sign-in: it opens the Hostemi page in your browser, you sign in and approve this computer, and the CLI stores the key it receives. Nothing to copy, no password typed into the terminal, and no booking platform login is involved.

Without a terminal (a script, an agent) it never waits by default: it prints the sign-in link on stderr and exits with code 3. Add `--wait` to keep waiting for the approval instead.

## Where the key is kept

| What | Where |
| --- | --- |
| Config file | `~/.config/hostemi/config.json` (or `$XDG_CONFIG_HOME/hostemi/config.json`), readable only by you (mode 600, folder 700) |
| Sign out | `hostemi logout` removes the stored key |
| Check | `hostemi whoami` shows which API the key talks to, and whether it still works |

## Scripts and CI: a key

Create a key in Hostemi under Settings, AI & apps (an API key starts with `hst_`). Pass it in `HOSTEMI_TOKEN`: it wins over a stored key and is never written to disk. Or store it once from stdin, which checks it first:

**Environment**

```bash
export HOSTEMI_TOKEN=hst_your_key
hostemi bookings --json
```

**Store once**

```bash
hostemi login --token-stdin < key.txt
```

**GitHub Actions**

```yaml
env:
  HOSTEMI_TOKEN: ${{ secrets.HOSTEMI_TOKEN }}
steps:
  - run: npm i -g hostemi
  - run: hostemi pricing pace --json > pace.json
```

A key is a password for your workspace. Keep it in a secret store, never in source code; a key follows its owner's current role in the workspace.

## Not signed in

Command

```bash
hostemi whoami
```

Output (recorded, exit 3)

```text
Error: Not signed in.
  Run: hostemi login (or set HOSTEMI_TOKEN).
```

## Another API address

`--api <url>` or `HOSTEMI_API_URL` point the CLI at another API (the default is `https://api.hostemi.com`); `HOSTEMI_APP_URL` changes where approval links point.

Documentation pages

Something missing from this page? Write to [hello@hostemi.com](mailto:hello@hostemi.com), or use the form on the [Help](https://hostemi.com/help) page.
