---
title: "Exchange an Identity Platform ID token for a session cookie"
method: POST
path: "/auth/session"
---

# Exchange an Identity Platform ID token for a session cookie

`POST /auth/session`

## Request

- Base URL: `https://api.klanexai.com`
- URL: `https://api.klanexai.com/auth/session`
- Auth: none required

Verifies the ID token (email must be verified), links the identity to the tenant whose completed signup matches the email, and sets the HttpOnly klanex_session cookie (7-day TTL). The cookie is accepted by all /v1 endpoints as an alternative to X-API-Key; cookie-authed state-changing requests must also send an X-Requested-With header. Per-IP rate limited.

## Request body

- object
  - `id_token` string, required

## Response `200`

Signed in; Set-Cookie klanex_session.

- AuthMe
  - `email` string
  - `tenant_id` string
  - `name` string
  - `plan` 'free' | 'starter' | 'pro'

## Other responses

- `400`: Missing id_token.
- `401`: Token failed verification.
- `403`: EMAIL_UNVERIFIED or NO_ACCOUNT.
- `404`: Login is not enabled on this deployment.
- `429`: Too many login attempts from this IP.

---

[API](https://skmtc.dev/klanexai/apis/klanex-api.md) · [All operations](https://skmtc.dev/klanexai/apis/klanex-api/llms.txt) · [OpenAPI document](https://skmtc.dev/klanexai/apis/klanex-api/revisions/daf36597612f?raw)
