Chapter 4. APIToken Service


4.1. A P I Token Service

4.1.1. GenerateToken

POST /v1/apitokens/generate

GenerateToken generates API token for a given user and role.

4.1.1.1. Description

4.1.1.2. Parameters

4.1.1.2.1. Body Parameter
Expand
NameDescriptionRequiredDefaultPattern

body

V1GenerateTokenRequest

X

  

4.1.1.3. Return Type

V1GenerateTokenResponse

4.1.1.4. Content Type

  • application/json

4.1.1.5. Responses

Expand
Table 4.1. HTTP Response Codes
CodeMessageDatatype

200

A successful response.

V1GenerateTokenResponse

0

An unexpected error response.

GooglerpcStatus

4.1.1.6. Samples

4.1.2. GetAPIToken

GET /v1/apitokens/{id}

GetAPIToken returns API token metadata for a given id.

4.1.2.1. Description

4.1.2.2. Parameters

4.1.2.2.1. Path Parameters
Expand
NameDescriptionRequiredDefaultPattern

id

 

X

null

 

4.1.2.3. Return Type

StorageTokenMetadata

4.1.2.4. Content Type

  • application/json

4.1.2.5. Responses

Expand
Table 4.2. HTTP Response Codes
CodeMessageDatatype

200

A successful response.

StorageTokenMetadata

0

An unexpected error response.

GooglerpcStatus

4.1.2.6. Samples

4.1.3. GetAPITokens

GET /v1/apitokens

GetAPITokens returns all the API tokens.

4.1.3.1. Description

4.1.3.2. Parameters

4.1.3.2.1. Query Parameters
Expand
NameDescriptionRequiredDefaultPattern

revoked

 

-

null

 

4.1.3.3. Return Type

V1GetAPITokensResponse

4.1.3.4. Content Type

  • application/json

4.1.3.5. Responses

Expand
Table 4.3. HTTP Response Codes
CodeMessageDatatype

200

A successful response.

V1GetAPITokensResponse

0

An unexpected error response.

GooglerpcStatus

4.1.3.6. Samples

4.1.4. ListAllowedTokenRoles

GET /v1/apitokens/generate/allowed-roles

GetAllowedTokenRoles return roles that user is allowed to request for API token.

4.1.4.1. Description

4.1.4.2. Parameters

4.1.4.3. Return Type

V1ListAllowedTokenRolesResponse

4.1.4.4. Content Type

  • application/json

4.1.4.5. Responses

Expand
Table 4.4. HTTP Response Codes
CodeMessageDatatype

200

A successful response.

V1ListAllowedTokenRolesResponse

0

An unexpected error response.

GooglerpcStatus

4.1.4.6. Samples

4.1.5. RevokeToken

PATCH /v1/apitokens/revoke/{id}

RevokeToken removes the API token for a given id.

4.1.5.1. Description

4.1.5.2. Parameters

4.1.5.2.1. Path Parameters
Expand
NameDescriptionRequiredDefaultPattern

id

 

X

null

 

4.1.5.3. Return Type

Object

4.1.5.4. Content Type

  • application/json

4.1.5.5. Responses

Expand
Table 4.5. HTTP Response Codes
CodeMessageDatatype

200

A successful response.

Object

0

An unexpected error response.

GooglerpcStatus

4.1.5.6. Samples

Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2026 Red Hat
Back to top