Skip to content
getgeolens.com

Set Dataset Retention

PUT
/datasets/{dataset_id}/retention/
curl --request PUT \
--url 'https://example.com/datasets/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/retention/?dry_run=false' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "retention": { "column": "example", "days": 1 } }'

Set or clear how many days of rows a feature dataset keeps.

Hourly worker runs delete rows whose retention column is older than the cutoff, in batches, so a large backlog can take several runs; rows where it is null are kept. A dry run counts the rows past the cutoff now in rows_past_cutoff; a save skips that scan and returns null. The instance’s dataset editing switch does not apply: this is the owner’s setting, not an edit.

dataset_id
required
Dataset Id
string format: uuid
dry_run
Dry Run

Check the setting and count its rows without saving it.

boolean

Check the setting and count its rows without saving it.

Media type application/json
DatasetRetentionUpdate

The retention setting to store; null turns retention off.

object
retention
required
Any of:
DatasetRetention

Keep only the rows from the last days days, judged by column.

object
column
required
Column

A date or timestamp column of the dataset’s table. Rows where it is null are kept.

string
<= 63 characters
days
required
Days
integer
>= 1 <= 3650

Example generated

{
"retention": {
"column": "example",
"days": 1
}
}

Successful Response

Media type application/json
DatasetRetentionResponse
object
retention
required
Any of:
DatasetRetention

Keep only the rows from the last days days, judged by column.

object
column
required
Column

A date or timestamp column of the dataset’s table. Rows where it is null are kept.

string
<= 63 characters
days
required
Days
integer
>= 1 <= 3650
rows_past_cutoff
required
Any of:
integer
cutoff
Any of:
string format: date-time

Example generated

{
"retention": {
"column": "example",
"days": 1
},
"rows_past_cutoff": 1,
"cutoff": "2026-04-15T12:00:00Z"
}

Bad request — invalid payload

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Unauthorized — missing or invalid credentials

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Forbidden — caller lacks write access

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Not found

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Conflict — resource state prevents the operation

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Validation error

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Too many requests — retry after the advertised interval

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}
Retry-After
integer

Seconds until the request may be retried

Internal server error

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Service unavailable — the database could not serve the request

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}