iMessages are stored up to 30 days in iCloud storage. SMS text messages are only stored in iCloud when the “SMS Forwarding” option is enabled on your iOS device. For those not stored in iCloud, you would need to contact your cellular provider to understand their text messaging retention policy.