Records a sign-in.
Records a sign-in. Signing in again from another browser adds to the session rather than replacing it, so one person can be signed in from a laptop and a…
POST /v1/iam/sessions/create
| Address | https://api.hanzo.ai/v1/iam/sessions/create |
| Method | POST |
| Operation | createSession |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Records a sign-in. Signing in again from another browser adds to the session rather than replacing it, so one person can be signed in from a laptop and a phone at once.
Ask for an exclusive sign-in and the opposite holds: the new sign-in is the only one left and every other browser is signed out. That is the setting to use when one person may hold only one live session at a time.
Request
5 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
application | body | string | yes | |
exclusiveSignin | body | boolean | — | |
name | body | string | yes | |
owner | body | string | yes | |
sessionId | body | string[] | — |
Response
| Status | Body | Meaning |
|---|---|---|
200 | iam.Session | ok |
200 body — 10 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
application | body | string | — | |
createdAt | body | string (date-time) | — | |
createdTime | body | string | — | |
deleted | body | boolean | — | |
exclusiveSignin | body | boolean | — | ExclusiveSignin is a transient control flag (v1 xorm:"-"): a caller sets it on a create to collapse SessionId down to the single incoming cookie instead of… |
id | body | string | — | |
name | body | string | — | |
owner | body | string | — | |
sessionId | body | string[] | — | |
updatedAt | body | string (date-time) | — |
Failure carries the platform error shape — see Errors.
Examples
hanzo iam sessions create \
--application <application> \
--name <name> \
--owner <owner>import { Configuration, IamApi } from 'hanzoai';
const api = new IamApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.createSession({ owner: "<owner>", name: "<name>", application: "<application>" });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).create_session(owner="<owner>", name="<name>", application="<application>")cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.IamAPI.CreateSession(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::create_session(&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).createSession();curl -X POST https://api.hanzo.ai/v1/iam/sessions/create \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"owner": "<owner>",
"name": "<name>",
"application": "<application>"
}'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?