Skip to content
Start here

Service Tokens

List service tokens
zero_trust.access.service_tokens.list(ServiceTokenListParams**kwargs) -> SyncV4PagePaginationArray[ServiceToken]
GET/{accounts_or_zones}/{account_or_zone_id}/access/service_tokens
Get a service token
zero_trust.access.service_tokens.get(strservice_token_id, ServiceTokenGetParams**kwargs) -> ServiceToken
GET/{accounts_or_zones}/{account_or_zone_id}/access/service_tokens/{service_token_id}
Create a service token
zero_trust.access.service_tokens.create(ServiceTokenCreateParams**kwargs) -> ServiceTokenCreateResponse
POST/{accounts_or_zones}/{account_or_zone_id}/access/service_tokens
Update a service token
zero_trust.access.service_tokens.update(strservice_token_id, ServiceTokenUpdateParams**kwargs) -> ServiceToken
PUT/{accounts_or_zones}/{account_or_zone_id}/access/service_tokens/{service_token_id}
Delete a service token
zero_trust.access.service_tokens.delete(strservice_token_id, ServiceTokenDeleteParams**kwargs) -> ServiceToken
DELETE/{accounts_or_zones}/{account_or_zone_id}/access/service_tokens/{service_token_id}
Refresh a service token
zero_trust.access.service_tokens.refresh(strservice_token_id, ServiceTokenRefreshParams**kwargs) -> ServiceToken
POST/accounts/{account_id}/access/service_tokens/{service_token_id}/refresh
Rotate a service token
zero_trust.access.service_tokens.rotate(strservice_token_id, ServiceTokenRotateParams**kwargs) -> ServiceTokenRotateResponse
POST/accounts/{account_id}/access/service_tokens/{service_token_id}/rotate
ModelsExpand Collapse
class ServiceToken:
id: Optional[str]

The ID of the service token.

maxLength36
client_id: Optional[str]

The Client ID for the service token. Access will check for this value in the CF-Access-Client-ID request header.

duration: Optional[str]

The duration for how long the service token will be valid. Must be in the format 300ms or 2h45m. Valid time units are: ns, us (or µs), ms, s, m, h. The default is 1 year in hours (8760h).

expires_at: Optional[datetime]
formatdate-time
name: Optional[str]

The name of the service token.

class ServiceTokenCreateResponse:
id: Optional[str]

The ID of the service token.

client_id: Optional[str]

The Client ID for the service token. Access will check for this value in the CF-Access-Client-ID request header.

client_secret: Optional[str]

The Client Secret for the service token. Access will check for this value in the CF-Access-Client-Secret request header.

duration: Optional[str]

The duration for how long the service token will be valid. Must be in the format 300ms or 2h45m. Valid time units are: ns, us (or µs), ms, s, m, h. The default is 1 year in hours (8760h).

name: Optional[str]

The name of the service token.

class ServiceTokenRotateResponse:
id: Optional[str]

The ID of the service token.

client_id: Optional[str]

The Client ID for the service token. Access will check for this value in the CF-Access-Client-ID request header.

client_secret: Optional[str]

The Client Secret for the service token. Access will check for this value in the CF-Access-Client-Secret request header.

duration: Optional[str]

The duration for how long the service token will be valid. Must be in the format 300ms or 2h45m. Valid time units are: ns, us (or µs), ms, s, m, h. The default is 1 year in hours (8760h).

name: Optional[str]

The name of the service token.