Is there APFS system (e.g. API) documentation anywhere? I want to snapshot an external drive

Yes, there is indeed such documentation. It comes with macOS preinstalled.

I would suggest running the following command in the Terminal:

man fs_snapshot_create

The manual page contains documentation on not only how to create a snapshot, but also how to list, delete, rename, mount and revert them.

Note that most of these functions, with the exception of fs_snapshot_list(), requires your program to have a specific entitlement (com.apple.private.vfs.snapshot).

As this is about making a tool for your own personal machine, then you can just give the tool that entitlement when compiling the code. Use AMFIExemption to allow your program (and others on your Mac) to have that entitlement without it being "endorsed" by Apple.

If you want to create a tool for wide distribution, you would want to apply with Apple to get the entitlement. My understanding is that these are granted to backup applications.