Ends a sign-in and sends the browser somewhere sensible. — GET /v1/iam/oauth/logout
Ends a sign-in and sends the browser somewhere sensible. Accepts GET or POST, so it works as a plain link.
GET /v1/iam/oauth/logout
| 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:
- 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.
- 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
expstill reads valid for days, so expiry is necessary but never sufficient. - Only then is a redirect considered, and only to a REGISTERED uri.
The open-redirect guard is unchanged: a redirect happens only when a VERIFIED id_token_hint identifies the application and that application has registered the target. Anything else refuses to redirect — nobody can turn your logout link into a redirect to a site of their choosing.
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.
Examples
hanzo iam oauth logout getimport { Configuration, IamApi } from 'hanzoai';
const api = new IamApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getIamOauthLogout();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()cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.IamAPI.GetIamOauthLogout(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::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?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.IamApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new IamApi(client).getIamOauthLogout();curl https://api.hanzo.ai/v1/iam/oauth/logout \
-H "Authorization: Bearer $HANZO_API_KEY"The door reaches iam through the iam tool, which names its 75 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
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__well_known_jwks"
}
}
}'How is this guide?