# Logout oauth — GET /v1/iam/oauth/logout

URL: https://docs.hanzo.ai/docs/openapi/iam/get-iam-oauth-logout

> Ends a sign-in and sends the browser somewhere sensible.

`GET /v1/iam/oauth/logout`

> [IAM →](https://docs.hanzo.ai/docs/openapi/iam) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                            |
| ------------- | ------------------------------------------ |
| **Address**   | `https://api.hanzo.ai/v1/iam/oauth/logout` |
| **Method**    | `GET`                                      |
| **Operation** | `get_iam_oauth_logout`                     |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`     |

Ends a sign-in and sends the browser somewhere sensible. Accepts
GET or POST, so it works as a plain link.

It ACTUALLY signs you out — worth stating, because a logout that computes a
redirect and answers {"status":"ok"} while ending no session and revoking no
token is worse than none: the person on the shared machine believes it worked.
Three things happen here, in this order:

1. The browser session dies — sid revoked server-side AND the cookie expired
   (sessions.Clear). Server-side revocation is the load-bearing half: a copy
   of the cookie taken before logout must not still resolve.
2. The relying party's tokens are revoked when an id\_token\_hint names it, so
   the refresh token cannot mint a fresh access token after the human left.
   Revocation state is authoritative — a JWT's `exp` still reads valid for
   days, so expiry is necessary but never sufficient.
3. Only then is a redirect considered, and only to a REGISTERED uri.

The open-redirect guard: a redirect happens only when a VERIFIED
id\_token\_hint (or client\_id) identifies the application and that application
has registered the target. Nobody can turn your logout link into a redirect to
a site of their choosing.

A GET is the end-session navigation (OIDC RP-Initiated Logout 1.0 §2), so it
always ends on a page: the registered address when one was asked for, else
this issuer's sign-in page for the application being signed out of. A relying
party therefore needs no configuration to sign someone out. A POST is also how
a program signs out, so it keeps the JSON answer unless it asks for HTML.

## Request

`GET /v1/iam/oauth/logout` takes no parameters and no body — the credential is the whole request.

## Response

The document declares no response body for this operation. It answers `200` on success and the platform error shape on failure — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo iam oauth logout get
```

**SDK**

**.ts**

```ts
import { Configuration, IamApi } from 'hanzoai';

const api = new IamApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getIamOauthLogout();
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import IamApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = IamApi(client).get_iam_oauth_logout()
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.IamAPI.GetIamOauthLogout(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, iam_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = iam_api::get_iam_oauth_logout(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.IamApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new IamApi(client).getIamOauthLogout();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/iam/oauth/logout \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

MCP reaches **iam** through the `iam` tool, which names its 44 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_iam_applications"
         }
       }
     }'
```

---

[IAM API](https://docs.hanzo.ai/docs/openapi/iam) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
