> For the complete documentation index, see [llms.txt](https://openapi.logto.io/llms.txt)

# Create a new subject token.

> POST /api/subject-tokens
> 
> Create a new subject token for the use of impersonating the user.



## Servers
- Logto endpoint address.: https://[tenant_id].logto.app (Logto endpoint address.)


## Authentication methods
- O auth2


## Parameters



### Body: application/json (object)

- **userId** (string)
  The ID of the user to impersonate.

- **context** (object)
  The additional context to be included in the token, this can be used in custom JWT.



## Responses
### 201
The subject token has been created successfully.

#### Body: application/json (object)
- **subjectToken** (string)

- **expiresIn** (number)


### 400
Bad Request

### 401
Unauthorized

### 403
Forbidden

### 404
The user does not exist.


[Powered by Bump.sh](https://bump.sh)
