Closing the stream - my bad, I added it prematurely. :doh: Please disregard my suggestion to close the request stream before sending the request or add it after the stream were read. (401) Unauthorized response, it seems that your server did not accept the given credentials as valid. - There are a few things you can try. Make sure that the API you are accessing is expecting basic authentication and that the credentials should be provided in the Authorization header. If the API expects a different authentication method, such as API keys or OAuth, you will need to adjust your authentication to accept the request as per their requirements. Check that the API endpoint you are using (https://api.dev.name.com/v4/domains) is 100% correct. To isolate or debug the issue, you could try using a different client, such as cURL or Postman, with the same credentials and endpoint. This might help determine if the problem lies with the code or if there might be an issue with the credentials or API itself. Check your API documentation to make sure that you are following the correct authentication process and that there are no additional steps required. Hope this points you in the right direction.