All Products
Search
Document Center

Time Series Database:Set the data's validity period

Last Updated:Mar 28, 2026

Set the data's validity period

Sets the TTL (Time to Live) for data stored in Time Series Database (TSDB). Data that exceeds the TTL is automatically expired and deleted.

Request syntax

PathMethod
/api/ttlPOST

Request parameters

NameTypeRequiredDescriptionExample
valIntegerYesThe TTL in seconds. Valid values: 1 to 2147483647 (Integer.MAX\_VALUE).7776000

Example

Goal: Set the data's validity period to 90 days.

Request:

POST /api/ttl

Body:

{ "val": 7776000 }

Response

Returns HTTP status code 200 if the request succeeds. For a full list of status codes, see Response codes.

Get the data's validity period

Queries the current TTL for data stored in TSDB.

Request syntax

PathMethod
/api/ttlGET

Request parameters

No request body is required.

Response

Returns HTTP status code 200 if the request succeeds. For a full list of status codes, see Response codes.

Response body:

{ "val": 7776000 }

The val field contains the current TTL value in seconds.