Quoting from the announcement Introducing Pi-hole v6
Upgrading to Pi-hole v6 should be straightforward. For existing users, we recommend backing up your current configuration before proceeding, as the upgrade is strictly a one-way operation.
Pi-hole's new REST API is fully documented, see Pi-hole API - Pi-hole documentation as well as the local documentation on your Pi-hole that allows for immediate interactive testing of API commands directly from the documentation website, available at http://pi.hole/api/docs.
You'd just need to configure and enable an app password via Settings | Web Interface - API in Expert mode and enter that into the local docs.
Changing your v6 DNS port and pulling a Pi-hole v5 image like 2024.07.0 to spin up a Pi-hole Docker container would be one way to keep playing around with v6 while you still have v5 serve your network from the same machine.