Oh no! Unexpected flooding is incredibly stressful, but I’m glad the damage wasn’t too bad. Thankfully, in this case, your home insurance should cover the carpet damage.
Note that carpet damage from external (weather-related) flooding will not be covered by home insurance. You’ll need separate flood insurance to cover such instances.
You’ll need to check your policy to determine if you have a deductible. If you do, you’ll be required to pay that amount before your insurance company chips in. Once you cover your deductible, your insurance will pay the remaining amount up to your policy’s limits.