TTL policy types
Configure any of these lifecycle policies:ttl-idle: Delete a sandbox after a specified period of inactivityttl-max-age: Delete a sandbox after a maximum age, regardless of activitydate: Delete a sandbox on a specific date
ttl: Set a maximum age with simpler syntaxexpires: Set an absolute expiration date
Configure TTL policies
Setttl, expires, or lifecycle when creating a sandbox:
Policy behavior
Idle TTL timing
Thettl-idle timer starts only after the sandbox receives its first API call or connection. Creating a sandbox without using it does not start the idle timer.
On Tier 1, a hard 30-day cap still applies. A sandbox is deleted after 30 days regardless of activity, so ttl-idle cannot provide rolling expiration. Rolling expiration based on activity is available on Tier 2 and above.
Processing frequency
TTL enforcement does not operate at one-second precision. The cleanup process runs approximately every 60 seconds.Computed termination time
Sandbox metadata includes the read-onlyexpiresIn field in TypeScript and expires_in field in Python. It reports the number of seconds until automatic termination under the current TTL or lifecycle policy.
Deletion process
When a sandbox expires:- Blaxel terminates the sandbox.
- The sandbox remains in the
terminatedstate for a retention period, which depends on your tier configuration. - Blaxel deletes the sandbox completely.
Tier limits
TTL restrictions depend on your account tier:- Tier 0: A maximum TTL of 7 days is enforced
- Tier 1: A hard 30-day maximum lifetime is enforced, and
expiresInreflects this limit - Tier 2 and above: No maximum TTL is enforced, and
ttl-idlesupports rolling expiration based on activity
Idempotent sandbox creation
When you callcreateIfNotExists with the same sandbox name, Blaxel replaces an existing terminated sandbox with a new one.
Use TypeScript SDK v0.2.45 or later or Python SDK v0.2.21 or later for this behavior.
Update an existing sandbox
Apply a TTL to an existing sandbox withupdateTtl or update its lifecycle policies. This is useful when cleaning up sandboxes created without expiration rules.
See sandbox expiration policies for TypeScript and Python examples.
Preview cleanup
Deleting a sandbox, including automatic deletion through TTL, also removes all associated preview URLs. You do not need to delete previews separately because they are scoped to the sandbox.Sandbox expiration policies
Configure, update, and clear sandbox expiry rules.
Sandbox best practices
Apply TTLs as part of a lifecycle management strategy.