---
title: "Generate JWT"
method: GET
path: "/api/datasets/{namespace}/{repo}/jwt"
tags: ["datasets"]
---

# Generate JWT

`GET /api/datasets/{namespace}/{repo}/jwt`

Generate a JWT token for accessing a repository. Supports optional write access for spaces in dev mode, custom expiration, and encryption.

## Path parameters

- `namespace` string, required
- `repo` string, required

## Query parameters

- `write` string
- `expiration` string, date-time — Requested expiration datetime, capped at the default (10 minutes with write, 24 hours for spaces, 1 hour otherwise). Use expires_in instead.
- `expires_in` integer — Requested lifetime in seconds, capped at the default (600s with write, 86400s for spaces, 3600s otherwise)
- `encrypted` string
- `inference_api` string
- `include_pro_status` string — Use billing_details instead.
- `billing_details` string

## Response `200`

The JWT token and related information

- object
  - `accessToken` string, required — The JWT token with Bearer prefix
  - `exp` integer — Token expiration timestamp in seconds (JWT standard)
  - `token` string, required — The JWT token
  - `encryptedToken` object — Encrypted JWT token and key ID (only if encrypted=true was requested)
    - `encrypted` string, required — The encrypted JWT token
    - `keyId` string, required — Key ID used to encrypt the token

## Changes

- **2026-09-08** `bd17546f47b8` — 1 warning, 5 info
  - changed the pattern of the `query` request parameter `expiration` from `^((\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\d|3[01])|(0[469]|11)-(0[1-9]|[12]\d|30)|(02)-(0[1-9]|1\d|2[0-8])))T([01]\d|2[0-3]):[0-5]\d:[0-5]\d(\.\d+)?(Z)$` to `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$`
  - for the `query` request parameter `billing_details`, the type was generalized from no type to `string`
  - for the `query` request parameter `encrypted`, the type was generalized from no type to `string`
  - for the `query` request parameter `include_pro_status`, the type was generalized from no type to `string`
  - …2 more
- **2026-08-15** `8187a0ec8763` — 1 info
  - added the new optional `query` request parameter `expires_in`

[Change history](https://skmtc.dev/huggingface/apis/hub-api-endpoints/changes/api/datasets/:namespace/:repo/jwt/get.md)

---

[API](https://skmtc.dev/huggingface/apis/hub-api-endpoints.md) · [All operations](https://skmtc.dev/huggingface/apis/hub-api-endpoints/llms.txt) · [OpenAPI document](https://skmtc.dev/huggingface/apis/hub-api-endpoints/revisions/2be5f0669ac6?raw)
