service-accounts

Create service-account token

Changed on

Create a new access token for a service account. Store the token securely - it cannot be retrieved later.

post/api/organizations/{name}/service-accounts/{serviceAccountId}/tokens

Request

  • Base URL: https://huggingface.co
  • URL: https://huggingface.co/api/organizations/{name}/service-accounts/{serviceAccountId}/tokens
  • Auth: HTTP bearer

Path parameters

namestring required
serviceAccountIdstring required

Request body

displayNamestring

Display name for the token

permissionsstring[]

Org-wide permissions for this token

repoIdsstring[]

Repositories to grant repoPermissions on. Can be repositories owned by the organization or any public repository. These override the org-wide permissions.

repoPermissionsstring[]

Permissions granted on the selected repoIds.

endpointPatternsstring[]

Inference endpoint name patterns (wildcards allowed, e.g. gpt2-*) restricting the token's org-wide Inference Endpoint permissions to matching endpoints. Empty means all endpoints.

skipNetworkSecurityboolean

Exempt this token from the org's Network Security enforcement (IP allowlist and content access policy). Enterprise Plus only, and requires the org.networkSecurity.write permission.

Response

Created token

tokenstring required

The access token - store this securely, it cannot be retrieved later

Changes

    • info

      added the new repo.contribute.write enum value to the request property /

    • breaking

      the / request property type changed from no type to string

    • breaking

      the / request property type changed from no type to string