> For the complete documentation index, see [llms.txt](https://developer.celigo.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.celigo.com/cli/getting-started/authenticate.md).

# Authenticate

The CLI authenticates with one of two credentials, and a profile holds one or the other — never both:

* **An OAuth sign-in.** `celigo login` opens the integrator.io sign-in in your browser and stores the session on a profile. The session acts as you, with your own permissions in the account and environment you sign in to, and renews itself. Added in celigo-cli 2026.10.1.
* **An API token.** Any integrator.io bearer token: an admin-created service token, or a [personal access token](https://developer.celigo.com/api/getting-started/authentication) (PAT) you create yourself. A PAT inherits your own user permissions. Create either in **Resources → API tokens**. Use a token for CI and other unattended jobs.

## Sign in with OAuth

```bash
celigo login            # sign in through the browser
celigo profile whoami   # which account, environment, and credential the profile uses
```

`celigo login` names the profile after the account and environment the sign-in reaches — `acme-corp-production`, `acme-corp-sandbox` — creating it the first time and signing the same profile in again after that. Pass `--profile <name>` to name it yourself, and `--base-url` for an account in another region (`celigo login --base-url https://api.eu.integrator.io`).

On a machine without a browser — an SSH session, a container — run `celigo login --device`: it prints a URL and a code to enter in a browser on any other device. The CLI uses the device grant on its own when stdin is not a terminal or a CI environment variable is set.

`celigo logout` revokes the session. Which profile a sign-in goes to, the environment it binds the profile to, and how the session renews are in [login](https://developer.celigo.com/cli/commands/login.md) and [logout](https://developer.celigo.com/cli/commands/logout.md).

## Use an API token

```bash
export CELIGO_API_TOKEN="<paste>"
celigo workspace-users list --format table
```

Works on macOS, Linux, and Windows. In PowerShell: `$env:CELIGO_API_TOKEN = "..."`.

#### With a config file

If you'd rather not re-export the env var every shell session:

> ⚠️ **This stores your API token in plaintext on disk.** `~/.celigo/config.json` holds the raw token; keep its `0600` permissions and never commit it to version control.

```bash
celigo config set api_token "<paste>"
celigo config show
```

This writes `~/.celigo/config.json` with mode `0600` on Unix (owner read/write only; Windows uses NTFS ACLs scoped to the current user).

To keep the token in a profile named after the account and environment it reaches, give `profile add` no name: `celigo profile add --api-token "<paste>"` asks `GET /v1/tokenInfo` and creates a profile such as `acme-corp-production`, bound to that environment. See [Profiles & regions](https://developer.celigo.com/cli/getting-started/profiles.md#profile-names).

## Which credential a command uses

A command uses the first credential it finds, in priority order:

1. `--token <value>` CLI flag (one-off override)
2. `CELIGO_API_TOKEN` environment variable
3. The selected profile's one credential in `~/.celigo/config.json` — its OAuth sign-in or its `api_token`. The profile is `--profile`, else `CELIGO_PROFILE`, else the active profile.
4. Error, no credential available:

   ```
   No credentials configured.
   Run: celigo login, set CELIGO_API_TOKEN, or run: celigo config set api_token <token>
   ```

A token in the flag or the environment therefore wins over a sign-in, so an interactive `celigo login` on a machine never overrides a pipeline's token.

Since celigo-cli 2026.11.2, a blank `--token` — usually `--token "$TOKEN"` with the variable unset — is refused before any command runs, and so is a blank `--base-url`. Earlier releases read a blank value as the flag left out, and ran the command with the next credential in that order. See [Global flags](https://developer.celigo.com/cli/getting-started/global-flags.md#combine).

The base URL follows the same priority via `--base-url`, `CELIGO_BASE_URL`, or the profile's `base_url`. Default: `https://api.integrator.io`. A sign-in is the exception: its session is sent only to the host it was issued for, so a `--base-url` or `CELIGO_BASE_URL` naming another host is refused for a signed-in profile before any request. An API token goes wherever it is pointed.

## Multiple accounts: profiles

One binary, many accounts — typical setup is one profile per region or per environment.

```bash
celigo login                                           # named after its account, e.g. acme-corp-production
celigo login --base-url https://api.eu.integrator.io   # an account in the EU region
celigo profile add us --api-token "$US_TOKEN" --api-base-url https://api.integrator.io
celigo profile add eu --api-token "$EU_TOKEN" --api-base-url https://api.eu.integrator.io
celigo profile add au --api-token "$AU_TOKEN" --api-base-url https://api.au.integrator.io
celigo profile add ca --api-token "$CA_TOKEN" --api-base-url https://api.ca.integrator.io

celigo profile list
celigo profile use us               # set default
celigo --profile eu flows list      # one-off override
```

Full details in [Profiles & regions](https://developer.celigo.com/cli/getting-started/profiles.md).

## Verify authentication

`celigo profile whoami` says which account, environment, and credential the selected profile authenticates as. It calls `GET /v1/tokenInfo` for an API token and an OAuth sign-in alike, and prints the envelope as the API returns it:

| Key           | What it says                                                                                              |
| ------------- | --------------------------------------------------------------------------------------------------------- |
| `_userId`     | The environment's user — the identity a profile and a pulled tree are bound to.                           |
| `token`       | The credential the request used (`token.type` names its kind).                                            |
| `ownerUser`   | The account's owner: its `_id` is the account id, beside the company name and the owner's name and email. |
| `byUser`      | The user the credential acts as.                                                                          |
| `environment` | The environment, by id and name (`Production`, `Sandbox`).                                                |

A sign-in adds `_auth` (`"oauth"`), `_issuer`, `_expires_at`, and `_scope` (the granted scopes). Since celigo-cli 2026.10.1.

```bash
celigo profile whoami
```

The envelope names people — names and email addresses — so in a CI job log, project what the job needs:

```bash
celigo profile whoami --jq '{_userId, account: .ownerUser.company, environment: .environment.name, credential: .token.type}'
```

Any authenticated read also works as a smoke test:

```bash
celigo workspace-users list --format json
```

A successful response confirms the credential is valid. With an API token, a `401 Unauthorized` means the token is missing, expired, revoked, or pointed at the wrong region — a token authenticates only against its own region's base URL. A sign-in first renews its session once; when that fails, the message says what to do (see [Session renewal](https://developer.celigo.com/cli/commands/login.md#session-renewal)).

Since celigo-cli 2026.11.2, a `401` that reads `Not permitted` means something else: the credential is valid, and this request is closed to it. See [Troubleshooting](https://developer.celigo.com/cli/using-the-cli/troubleshooting.md#id-401-unauthorized).

To see your stored config without making an API call:

```bash
celigo config show          # selected profile
celigo profile show us      # a specific profile
```

Tokens are redacted in all output — first 4 and last 4 characters visible, the rest masked.

## Security

* Tokens are **redacted** in all CLI output: an API token, and a sign-in's access, refresh, and ID tokens.
* A sign-in's session lives in the profile's `oauth` block in `~/.celigo/config.json`. `config show`, `config get oauth`, `profile show`, and `profile list` print it with its tokens redacted.
* `~/.celigo/config.json` is written with `0600` permissions, through a temporary file that is itself created owner-only, so no moment of a write leaves the tokens readable by other users. Don't `chmod` it wider.
* `--verbose` redacts the `Authorization` header in its HTTP traces.
* The processes the CLI starts — npm and npx for updates and skills, the browser for a sign-in, the editor `resolve --open` launches — get an environment without `CELIGO_API_TOKEN` and `CELIGO_TARGET_API_TOKEN`.
* Never commit `~/.celigo/config.json` or any script with `--token <value>` hard-coded.
* For CI, pass a short-lived token via the CI secret store and set `CELIGO_API_TOKEN` at job time. A sign-in is for a person: the device grant waits for someone to approve it in a browser, which an unattended job cannot do.

## Rotating

An API token:

```bash
# Update the selected profile's token in place
celigo config set api_token "<new>"
celigo profile whoami            # verify

# Then revoke the old token in the UI under Resources → API tokens.
```

`config set api_token` is refused on a profile signed in with OAuth, since a profile holds one credential:

```
Profile 'acme-corp-production' is signed in with OAuth, and a profile holds one credential. To store an API token in it, sign out first: celigo logout --profile acme-corp-production. To keep both, put the token in a profile of its own: celigo profile add <name> --api-token <token>.
```

An OAuth sign-in:

```bash
celigo logout --profile acme-corp-production    # revoke the session
celigo login --profile acme-corp-production     # sign in again
```

`celigo login` on its own replaces a profile's session without revoking the old one — sign-ins from one browser session share a grant, and revoking the old session would end the new one too — so sign out first when the old session must stop working.

For profile-based setups, there is no `profile edit` — either `config set` against the selected profile, or `profile delete` + `profile add` to re-enter credentials cleanly.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.celigo.com/cli/getting-started/authenticate.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
