Skip to main content
A chat request identifies its conversation in one of two ways. userId is meant to keep a stable conversation for a user across platforms such as WhatsApp, Discord, and Telegram.
Where an endpoint takes conversationRef (list messages, delete conversation, delete message, cancel tool call), you can pass either a conversationId or a persistent userId.

Per-user conversations in your app

If you need your own user and conversation management, build a thin wrapper around the API. As described in the API specification, the wrapper should:
  • Manage and identify users.
  • Store the mapping between your userId and the ReyGrid conversationId in your database.
  • Reuse the stored conversationId when the same user continues.
  • Verify a conversation ID belongs to the expected user before using it.
ReyGrid’s userId can also serve as the stable identifier. If you need your own mapping, keep it in your own database.
As the API specification recommends, verify in your wrapper that a stored conversation ID belongs to the expected user before using it.

Managing history

List conversations

Paginated, per agent.

List messages

By conversationId or userId.

Delete a conversation

Removes all of its messages.

Delete a message

Optionally with cascade=true.

Memory and retention

Every persistent conversation is kept for a duration defined by your ReyGrid plan. The same retention rules apply whether you key a conversation on a userId or on an explicit conversationId.

How retention works

ReyGrid follows one simple rule: a conversation is deleted in only one case — when there is no activity for the duration defined by your plan. There is no other deletion path based on time or volume:
  • Conversations do not expire while they are in use, regardless of how long they have been alive.
  • Conversations do not expire because they reach a message count.
  • Conversations do not expire on a calendar schedule — only on inactivity.

The expiration timer

  • The timer starts at the last message of a conversation.
  • Every call to POST /agents/{AgentId}/chat (or any other write to the conversation) resets the timer to the full retention window of your plan.
  • As long as activity continues, the conversation lives indefinitely.

Inspecting the expiration time

Each entry returned by GET /agents/{agentId}/conversations includes an expiresAt timestamp. It is the moment at which the conversation will be deleted if no further messages arrive before then.
A fresh message from user_42 will move expiresAt forward again, extending the lifetime of the conversation by the plan’s full retention window.
The exact retention window depends on your subscription plan. You can review your plan’s limits and current usage with GET /usage or in the ReyGrid dashboard.
If you need to keep a conversation’s history beyond your plan’s retention window, copy the messages into your own database before the conversation expires. Once a conversation is deleted, its messages cannot be recovered through the API.