> 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/commands/logout.md).

# logout

Sign a profile out. `celigo logout` revokes the profile's OAuth session at the authorization server — its refresh token and its access token — and removes the session from `~/.celigo/config.json`. The profile keeps its other settings and its environment binding, and holds no credential until you sign in again with [`celigo login`](https://developer.celigo.com/cli/commands/login.md).

`logout` manages local credentials, so it is never mode-gated.

> Added in celigo-cli 2026.10.1.

**REST API**: [Authentication](https://developer.celigo.com/api/getting-started/authentication)

```
celigo logout [flags]
```

Supports all [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md).

***

## `celigo logout`

Revoke and forget the OAuth session of the selected profile — `--profile`, else `CELIGO_PROFILE`, else the active profile.

**Signature**

```bash
celigo logout
```

**Arguments**

None.

**Flags**

Uses global flags only.

**Example**

```bash
celigo logout                               # the active profile
celigo logout --profile acme-corp-sandbox   # a named profile
```

```
Logged out of profile 'acme-corp-production'. It holds no credential now; sign in again with: celigo login --profile acme-corp-production
```

**Corresponds to**: the OAuth token revocation endpoint the issuer's metadata advertises — once for the refresh token, then once for the access token. No `/v1` API request is made.

### What logout reports

* **A revocation it could not make.** The issuer unreachable, a token its endpoint refused, or no revocation endpoint in the issuer's metadata is said on stderr. The profile is signed out on this machine either way, and any token not revoked stays valid on the server until it expires:

  ```
  warning: could not revoke the session at https://integrator.io (the authorization server advertises no revocation endpoint); none of its tokens is kept on this machine, but any not revoked stays valid on the server until it expires.
  ```
* **Other sign-ins the revocation may have ended.** Sign-ins made from the same browser session share one OAuth grant on the platform, and revoking one session's refresh token revokes the grant. After the sign-out, `logout` names the other signed-in profiles at the same issuer or bound to the same environment, on stderr; they need `celigo login` again if the grant was theirs too:

  ```
  note: logout can also end other CLI sign-ins made from the same browser session, so profile 'acme-corp-sandbox' may need a new sign-in: celigo login --profile acme-corp-sandbox
  ```
* **A profile that does not exist.** A misspelled `--profile` or `CELIGO_PROFILE` fails, exit `1`, instead of reporting a sign-out that never happened: `Profile 'acme-corp-prod' does not exist. Available: acme-corp-production, acme-corp-sandbox (run 'celigo profile list').`
* **A profile that is not signed in.** `Profile 'acme-sandbox' is not logged in.` (exit `0`). `logout` removes an OAuth session only; to clear a profile's API token, run `celigo config unset api_token`.
* **A session block the CLI cannot read** — one left by a hand edit or an older build, missing its access token, client id, or issuer. `logout` removes it, says so, and revokes nothing, since the block holds nothing it could revoke:

  ```
  Removed from profile 'acme-corp-production' an OAuth session block the CLI could not read (no access_token, client_id or issuer — a hand edit or an older build left it); nothing in it could be revoked. It holds no credential now; sign in again with: celigo login --profile acme-corp-production
  ```

### Commands running in parallel

The revocation and the removal run as one step under the session lock (`~/.celigo/oauth.lock`), so no renewal can swap the tokens in between and leave the new ones live on the server. A `celigo` command renewing the same session in another terminal finishes first, and the tokens it stored are the ones revoked. A command that has to renew the session after the sign-out fails at once, without waiting for the lock or spending the revoked refresh token:

```
Profile 'acme-corp-production' is signed out — its session was cleared while this command ran. Run: celigo login --profile acme-corp-production
```

***

## Gotchas

* **The environment binding stays.** The profile still references the environment it was bound to (`identity`), so the next `celigo login` into it is refused if it reaches another account or environment, unless `--allow-account-mismatch`. See [The environment binding](https://developer.celigo.com/cli/commands/login.md#the-environment-binding).
* **Deleting the config file is not a sign-out.** Removing `~/.celigo/config.json` or a profile's `oauth` block by hand revokes nothing: the session's tokens stay valid on the server until they expire. Run `logout` first. [`profile delete`](https://developer.celigo.com/cli/commands/profile.md#celigo-profile-delete) of a signed-in profile revokes its session as `logout` does.
* **Under `profile_pin_policy = strict`.** A `--profile` or `CELIGO_PROFILE` naming any profile other than the active one is refused with the policy's refusal, before anything is read or revoked. Under the default `allow`, `logout` on a profile pinned away from the active one prints `celigo: profile 'acme-corp-sandbox' → api.integrator.io (pinned with --profile; the active profile is 'acme-corp-production')` on stderr first. See [Refusing a pinned profile](https://developer.celigo.com/cli/getting-started/profiles.md#refusing-a-pinned-profile).
* **`CELIGO_API_TOKEN` is not affected.** `logout` clears only the profile's stored session; a token in `--token` or `CELIGO_API_TOKEN` keeps working, because it wins over the profile's credential.

## Related

* [login](https://developer.celigo.com/cli/commands/login.md) — sign in again, and how a session is bound and renewed.
* [profile](https://developer.celigo.com/cli/commands/profile.md) — `profile delete` revokes a signed-in profile's session; `profile whoami` shows what a profile authenticates as.
* [config](https://developer.celigo.com/cli/commands/config.md) — `config unset api_token` clears an API token.
* [Authenticate](https://developer.celigo.com/cli/getting-started/authenticate.md) — the two credentials, and rotating them.


---

# 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/commands/logout.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.
