---
title: "Generate Token"
method: POST
path: "/v1/groups/{group_id}/auth/generate"
tags: ["DatabaseGroup"]
---

# Generate Token

`POST /v1/groups/{group_id}/auth/generate`

## Request

- Base URL: `https://api.bunny.net/database`
- URL: `https://api.bunny.net/database/v1/groups/{group_id}/auth/generate`
- Auth: one of:
  - API key in header `Authorization`
  - API key in header `AccessKey`
- TypeScript: <https://skmtc.dev/bunny/apis/bunny-database-backend-api/docs/v1/groups/:group_id/auth/generate/post.ts> (a function with typed inputs; its response is checked against the schema)

Generate a new token for the whole DatabaseGroup

## Path parameters

- `group_id` string, required: [DatabaseGroupId] is a `group_<ulid>`

## Request body

- GenerateTokenDatabaseGroupPayload
  - `expires_at` string, date-time, nullable: The expired at date for the token, if not degined the token won't expire until you invalidate the JWT Secrets. Needs to be a date-time under the [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
  - `authorization` 'full-access' | 'read-only', required

## Response `200`

- GenerateTokenDatabaseGroupResponse
  - `token` string, required: The generated JWT for the [DatabaseGroup].
  - `expires_at` string, date-time, nullable: The expired at date for the token. A date-time under the [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)

## Other responses

- `401`: A default error response for most API errors.
- `500`: A default error response for most API errors.

---

[API](https://skmtc.dev/bunny/apis/bunny-database-backend-api.md) - [All operations](https://skmtc.dev/bunny/apis/bunny-database-backend-api/llms.txt) - [OpenAPI document](https://skmtc.dev/bunny/apis/bunny-database-backend-api/revisions/f3bb69bad6b6?raw)
