Get started with PlanetScale Postgres for just $5/month. Learn more
Navigation

Service token expiration with TTL

You can now set an expiration date for service tokens, giving you more control over token lifecycle and security. When you create a service token with an expiration, the token will automatically stop working once that date is reached.

This feature is available in the dashboard, API, and CLI.

Dashboard

When creating a service token in the PlanetScale dashboard, you can optionally set an expiration date. The token will stop working once the expiration date is reached.

API

When creating a service token via the API, you can now include a ttl parameter (in seconds):

curl --request POST \
     --url 'https://api.planetscale.com/v1/organizations/{organization}/service-tokens' \
     --header 'Authorization: <SERVICE_TOKEN_ID>:<SERVICE_TOKEN>' \
     --header 'Content-Type: application/json' \
     --data '{"name": "My Token", "ttl": 3600}'

The response now includes an expires_at field showing when the token will expire.

CLI

When creating a service token through the pscale CLI, use the --ttl flag to specify the expiration time in seconds:

pscale service-token create --name "My Token" --ttl 3600

The output now displays the expiration time for tokens created with a TTL. You can also see expiration times when listing service tokens with pscale service-token list.

Read more about service tokens