Fix id encoding

API endpoint additions are still a WIP.

The second commit includes a fix for id encoding (now using base64 over the `bytes` method of `Bytes`).

Altogether, hopefully less broken than before, but still in need of more work. I'll follow up with more comprehensive tests.