Data lifetime
Sessions and files are deleted after 7 days, so keep what your users need on your side.
Sessions
A session, its conversation and its answers are deleted 7 days after it starts; expires_at says when. Closing a session only stops new messages. To have it deleted sooner, pass lifetime_seconds (60 or more) when you start it. If your users need their conversations for longer, keep them on your side.
Files
Every document and file link has expires_at. It defaults to 7 days after creation, the plan maximum. Pass lifetime_seconds to POST /v1/documents to make it shorter. At expires_at the files and the stream are deleted, even if the session they came from is still open.
Deleting a session
DELETE /v1/sessions/{session} erases the conversation, the answers and every document made from the session, at once. Do it when your user deletes their account or asks you to forget a conversation.
After expiry or deletion
Gone objects return 410 Gone: session_deleted, document_expired or file_expired. Start a new session, or generate again, if you need it.
What we always keep
Usage records stay after deletion: IDs and timings, for billing and the usage page. If you allowed it when you issued the key, we also keep the chat messages for our analytics; you can no longer read them through the API. Answers and files are deleted either way. Keep personal data out of what you name things with: metadata and Docgen-Subject should hold IDs or hashes, never an email or a name.