Retention policies are easy to get wrong, and a wrong one deletes your history. Before I let restic remove anything, I would run the policy with --dry-run first and read the list.
The restic docs show this exact pattern:
restic -r /srv/restic-repo forget --keep-daily 5 --dry-run
The output lists which snapshots restic would keep and which it would remove, and nothing changes in the repository. The keep options work per calendar period. For example --keep-daily 5 keeps the most recent snapshot of each of the last five days that have snapshots, so a quiet week does not use up the count. You can combine --keep-weekly, --keep-monthly and --keep-yearly in the same call, and --keep-within 7d keeps everything from the last seven days before the newest snapshot.
When the list looks right, run the same line without --dry-run. Adding --prune then removes the data that no snapshot uses any more:
restic -r /srv/restic-repo forget --keep-daily 5 --prune
Keep in mind that policies apply per group, and by default a group is a combination of host, paths and tags. If two machines back up into one repository, each gets its own five days. That is a safety feature against deleting unrelated backup sets, but it can surprise you if the paths of a machine change, because the old snapshots form another group.
There are two warnings in the docs I would pass on. Without --prune, forget only removes the snapshot references and does not free any space, which happens when prune runs. And during a prune the repository is locked, so a backup cannot complete in that time. Plan it for a quiet moment rather than the same minute as a nightly job.
Further reading: restic docs: Removing backup snapshots