Account, keys and webhooks ›
Update data retention
PATCH
/v1/data-retentionKeep it 1, 7, 30 or 90 days, or until the sandbox is deleted.
RequestTypeScript
- import { Agental } from "agental-sdk";
- const agental = new Agental();
- await agental.setDataRetention(7);
Answer200 OK · DataRetention
- {
- "keepDays": object,
- "enabled": boolean,
- "choices": integer[],
- "defaultKeepDays": integer,
- "lastCleared": {
- "at": string,
- "commands": integer,
- "conversations": integer,
- "events": integer,
- },
- "retained": [{
- "what": string,
- "kept": string,
- }],
- }
The period is set.
Headers
AuthorizationrequiredBearer key | An API key that may make this call. |
Body
keepDaysobject | Days the history is kept: 1, 7, 30 or 90. null keeps it until the sandbox is deleted. |
enabledboolean | 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
keepDaysobject
Days the history is kept: 1, 7, 30 or 90.
More
null keeps it until the sandbox is deleted.enabledboolean
Whether history is deleted on a schedule: keepDays is not null.
choicesinteger[]
The periods keepDays may take, in days.
defaultKeepDaysinteger
What an account that has not chosen keeps.
lastClearedobjectnull4 fields
What the last clean-up that deleted anything of the account's deleted.
More
null until one has.atstring
When the clean-up ran, ISO 8601.
commandsinteger
conversationsinteger
eventsinteger
retainedobject[]2 fields
What agental keeps for periods of its own, which the account does not choose.
whatstring
keptstring
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.