---
title: "POST /gateway/v2/token"
method: POST
path: "/gateway/v2/token"
tags: ["token"]
---

# POST /gateway/v2/token

`POST /gateway/v2/token`

## Request

- Base URL: `https://developers.conduktor.io` (the document declares no server; this is the origin it was published from)
- URL: `https://developers.conduktor.io/gateway/v2/token`
- Auth: HTTP basic
- TypeScript: <https://skmtc.dev/conduktor/apis/conduktor-gateway-api/docs/gateway/v2/token/post.ts> (a function with typed inputs; its response is checked against the schema)

[![Generally Available](https://img.shields.io/badge/Lifecycle-Generally%20Available-blue)](#tag/Versioning)

Create a new token for given service account and a given virtual cluster.

If the vcluster is not provided, the token will be created for the passthrough virtual cluster.

## Request body

- TokenRequest
  - `vCluster` string: The name of the virtual cluster to create the token for. "passthrough if omitted"
  - `username` string, required: The username of the local service account to create the token for.
  - `lifeTimeSeconds` integer, required: The life time of the token in seconds.

## Response `200`

- TokenResponse
  - `token` string, required: The token created for the given username on the given virtual cluster.

## Other responses

- `400`: Invalid value for: body
- `401`: The given credentials are not valid
- `404`: The searched entity was not found
- `409`: Requesting a JWT token when no user pool service is configured in the Gateway or requesting a token for an external service account.
- `500`: An unexpected error occurred in the server

---

[API](https://skmtc.dev/conduktor/apis/conduktor-gateway-api.md) - [All operations](https://skmtc.dev/conduktor/apis/conduktor-gateway-api/llms.txt) - [OpenAPI document](https://skmtc.dev/conduktor/apis/conduktor-gateway-api/revisions/73ad742aa630?raw)
