How to use fetch tool with IPv6

Try with

:put [/tool fetch url="http://$ipv6add/index.php" http-header-field="Host:api.myip.com" output=user as-value]

Note: use http protocol, https requires (E)SNI host name which is not set from URL when accesing over IP and SSL handshake will fail since certificate is not issued for IP. Also this will not work on web services which redirects http to https but api.myip.com is not doing that, unfortunately api.wedos.com (from OP) does and this trick cannot be used on that host.