Skip to content
Start here

Service Tokens

List service tokens
client.ZeroTrust.Access.ServiceTokens.List(ctx, params) (*V4PagePaginationArray[ServiceToken], error)
GET/{accounts_or_zones}/{account_or_zone_id}/access/service_tokens
Get a service token
client.ZeroTrust.Access.ServiceTokens.Get(ctx, serviceTokenID, query) (*ServiceToken, error)
GET/{accounts_or_zones}/{account_or_zone_id}/access/service_tokens/{service_token_id}
Create a service token
client.ZeroTrust.Access.ServiceTokens.New(ctx, params) (*AccessServiceTokenNewResponse, error)
POST/{accounts_or_zones}/{account_or_zone_id}/access/service_tokens
Update a service token
client.ZeroTrust.Access.ServiceTokens.Update(ctx, serviceTokenID, params) (*ServiceToken, error)
PUT/{accounts_or_zones}/{account_or_zone_id}/access/service_tokens/{service_token_id}
Delete a service token
client.ZeroTrust.Access.ServiceTokens.Delete(ctx, serviceTokenID, body) (*ServiceToken, error)
DELETE/{accounts_or_zones}/{account_or_zone_id}/access/service_tokens/{service_token_id}
Refresh a service token
client.ZeroTrust.Access.ServiceTokens.Refresh(ctx, serviceTokenID, body) (*ServiceToken, error)
POST/accounts/{account_id}/access/service_tokens/{service_token_id}/refresh
Rotate a service token
client.ZeroTrust.Access.ServiceTokens.Rotate(ctx, serviceTokenID, params) (*AccessServiceTokenRotateResponse, error)
POST/accounts/{account_id}/access/service_tokens/{service_token_id}/rotate
ModelsExpand Collapse
type ServiceToken struct{…}
ID stringOptional

The ID of the service token.

maxLength36
ClientID stringOptional

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

Duration stringOptional

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

ExpiresAt TimeOptional
formatdate-time
Name stringOptional

The name of the service token.