Docs
Account, keys and webhooks ›

Update data retention

PATCH/v1/data-retention

Keep it 1, 7, 30 or 90 days, or until the sandbox is deleted.

RequestTypeScript
  1. import { Agental } from "agental-sdk";
  2. const agental = new Agental();
  3. await agental.setDataRetention(7);
Answer200 OK · DataRetention
  1. {
  2. "keepDays": object,
  3. "enabled": boolean,
  4. "choices": integer[],
  5. "defaultKeepDays": integer,
  6. "lastCleared": {
  7. "at": string,
  8. "commands": integer,
  9. "conversations": integer,
  10. "events": integer,
  11. },
  12. "retained": [{
  13. "what": string,
  14. "kept": string,
  15. }],
  16. }

The period is set.

Headers

Authorizationrequired
Bearer key
An API key that may make this call.

Body

keepDays
object
Days the history is kept: 1, 7, 30 or 90. null keeps it until the sandbox is deleted.
enabled
boolean
Kept for callers from before keepDays: false is keepDays null, true the period set or the default.

Returns

200 The period is set. History older than it is deleted by the next clean-up, within the hour, and cannot be brought back; copies in the database's backups last 30 days more.

DataRetention6 fields
keepDays
object
Days the history is kept: 1, 7, 30 or 90.
More null keeps it until the sandbox is deleted.
enabled
boolean
Whether history is deleted on a schedule: keepDays is not null.
choices
integer[]
The periods keepDays may take, in days.
defaultKeepDays
integer
What an account that has not chosen keeps.
lastCleared
objectnull4 fields
What the last clean-up that deleted anything of the account's deleted.
More null until one has.
at
string
When the clean-up ran, ISO 8601.
commands
integer
conversations
integer
events
integer
retained
object[]2 fields
What agental keeps for periods of its own, which the account does not choose.
what
string
kept
string

Errors and other answers

404 Not found.

Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.