---
title: "Generate short lived bearer token"
method: POST
path: "/authenticate"
tags: ["Authentication"]
---

# Generate short lived bearer token

`POST /authenticate`

Generates and returns a bearer token. Behavior of this API differs on the basis of the auth mechanism used to make the request.
  - For API key auth, this API generates a JWT token whcih is valid for 24 hours and returns it.
  - For JWT bearer auth, returns the same JWT token in response
For information on how to generate API token, refer [Generating New API Keys](https://docs.togai.com/api-reference/authentication#generating-new-api-keys) section of docs.

## Response `200`

OK

- TokenResponse
  - `token` string, required

## Other responses

- `401` — Error response
- `403` — Error response
- `404` — Error response
- `429` — Error response
- `default` — Error response

## Changes

- **2024-07-11** `5abfbfe439be` — 1 breaking
  - removed the media type `text/plain` for the response with the status `200`
- **2023-10-06** `4d0b22a4b65c` — 1 info
  - endpoint added
- **2023-09-02** `6b13f6f47735` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/togaihq/apis/togai-apis/changes/authenticate/post.md)

---

[API](https://skmtc.dev/togaihq/apis/togai-apis.md) · [All operations](https://skmtc.dev/togaihq/apis/togai-apis/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/togaihq/togai-apis/revisions/442f5d8f4aa0/schema)
