spaces

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

get/api/spaces/{namespace}/{repo}/jwt

Request

  • Base URL: https://huggingface.co
  • URL: https://huggingface.co/api/spaces/{namespace}/{repo}/jwt
  • Auth: HTTP bearer

Path parameters

namespacestring required
repostring required

Query parameters

writestring
expirationstring 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_ininteger

Requested lifetime in seconds, capped at the default (600s with write, 86400s for spaces, 3600s otherwise)

encryptedstring
inference_apistring
include_pro_statusstring

Use billing_details instead.

billing_detailsstring

Response

The JWT token and related information

accessTokenstring required

The JWT token with Bearer prefix

expinteger

Token expiration timestamp in seconds (JWT standard)

tokenstring required

The JWT token

Changes

    • warning

      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))$

    • info

      for the query request parameter billing_details, the type was generalized from no type to string

    • info

      for the query request parameter encrypted, the type was generalized from no type to string

    • info

      for the query request parameter include_pro_status, the type was generalized from no type to string

    • info

      for the query request parameter inference_api, the type was generalized from no type to string

    • info

      for the query request parameter write, the type was generalized from no type to string

    • info

      added the new optional query request parameter expires_in