---
title: "Create a new JWT Token"
method: POST
path: "/auth/get_JWT"
tags: ["auth"]
deprecated: true
---

# Create a new JWT Token

`POST /auth/get_JWT`

> **Deprecated.**

## This endpoint is *deprecated* : use /auth/ephemeral and /auth/token instead

This endpoint requires authentication and requires the user to have the role **edit_users**: you can
then request a JWT on behalf of another user, specified in the request **username** attribute.

This endpoint has 2 modes depending on the presence or absence of the *roles* attribute in the request
data:

## Regular token

When sending only a **username**: a regular JWT Token bound to the given user is created and returned.

## Temporary token

When sending **username** AND a list **roles** of **role** (defined by the UID, optional the inbox to restrict access to):
a temporary token is created that will behave like a regular user with the given roles until the access token expires.

**Permission required:** edit_users

## Headers

- `X-Fields` string, mask

## Request body

- TokenModelBase
  - `roles` TokenRoleModel[] — the user roles
    - `document_id` string — limited to a document
    - `inbox` string
    - `role` string, required
  - `username` string, required — the user username

## Response `201`

Success

- TokenReplyModel
  - `authentication_token` string, required

## Other responses

- `403` — Permission insufficient

---

[API](https://skmtc.net/contractp/apis/contract-p.md) · [All operations](https://skmtc.net/contractp/apis/contract-p/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/contractp/contract-p/revisions/8ce53ebd6bd3/schema)
