logs from API endpoint, does not work for instance

I’m using the golang client to interact with the fly API. It has been useful for creating and destroying machines.

However, I’ve run into an issue related to logs. When using the client, GetAppLogs which is what the fly CLI uses under the hood.

I can get logs for the for the app, but I cannot the logs for individual machine ID.

This works: https://api.fly.io/api/v1/apps/<app name>/logs
This does not work: https://api.fly.io/api/v1/apps/<app name>/logs?instance=<ID>

I noticed that when the fly CLI get’s the log for the particular machine, it uses a Bearer token.

I am using the FlyV1 token created for fly tokens create deploy and fly tokens create org. When I hit the endpoint with the instance, it returns empty logs; when I hit the entire app, it returns all machines’ logs.

I know the API endpoint is undocumented, but I’m so close.

Thanks for any help or insight.