All paid accounts allow messages to be persisted for 72 hours, and free accounts allow messages to be persisted for 24 hours. See the complete list of account limits by package type.
If you would like to store your messages for a different period of time, please see the article "Can I store my messages for longer?".
Messages are not persisted by default
By default, all channels in an application are configured to not persist messages. Persisting messages is turned off by default because every message persisted will count towards your monthly allocation of messages you can send. For example, if you publish a single message that is persisted, then that will count as two messages. If you later retrieve that message from history, that will count as a further message.
Enabling message persistence
If you want messages to be stored so that they can be retrieved via the history API, then you must configure a channel rule to enable message persistence. Find out more about configuring channel rules.
Enabling state persistence
If you would like to store the last message on a channel for up to 365 days then you should configure a channel rule to enable state persistence. The last message can then be retrieved via the history API. Find out more about configuring channel rules.
Ephemeral message storage
Ably always stores the last 60-120 seconds of message history on our servers so that clients that need to reconnect can recover their message history whilst they were disconnected. These messages will be returned in a history API request, however we do not provide any guarantees on how many messages will be available unless you enable persistence on your channel.