---
title: "Mint End User Token"
method: POST
path: "/manage/end-user-token"
tags: ["manage", "manage"]
---

# Mint End User Token

`POST /manage/end-user-token`

## Request

- Base URL: `https://api.agent4.io` (the document declares no server; this is the origin it was published from)
- URL: `https://api.agent4.io/manage/end-user-token`
- Auth: none declared

为集成方的某个用户换一个终端用户令牌（proxy 模式的单点登录握手）。

`auth_mode=proxy` 的租户在平台上没有原生登录——身份由集成方提供。此前这条路只在
**请求头**（X-End-User）里走得通，也就是只有服务端对服务端的调用能用；浏览器落在
`/t/{alias}` 上时无从获得身份，那个页面因此是**无法登录**的。

有了这个接口，集成方在自己站点确认用户身份后，用租户 API Key 换一个令牌交给浏览器，
握手就闭合了。

**只对 proxy / both 开放**：platform 模式的租户有自己的登录，再开一条「凭 API Key 就能
冒充任意终端用户」的路没有必要，只是白白扩大攻击面。

调用方必须在**服务端**持有 API Key。把它放到浏览器里，等于任何人都能签发任意身份。

## Request body

- EndUserTokenIn
  - `external_user_id` string, required
  - `ttl` integer, nullable

## Response `200`

Successful Response

- EndUserTokenOut
  - `token` string, required
  - `external_user_id` string, required
  - `expires_in` integer, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/agent4/apis/chatagent-platform.md) · [All operations](https://skmtc.dev/agent4/apis/chatagent-platform/llms.txt) · [OpenAPI document](https://skmtc.dev/agent4/apis/chatagent-platform/revisions/18e58f082ce3?raw)
