If you are on machine itself, you can pass the api key located in /var/lib/mailinabox/api.key
as Authorization
header in which case no totp code should be required.
Hope this helps!
Edit: value for Authorization
header should look like Basic ${apiKey}
. Note that the apiKey changes after a restart