Integrating GraphQL with c#

I have the following code but when executed it fails on " var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();"

I have run the query in the playground with my apikey and it works. When I run it here I get a 500 error with no details.

var q2 = new GraphQLRequest
{
Query = @"
query {
boards (limit:3) {
id
name
items {
id
name
column_values {
id
text
}
}
}
}"
};

            var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://api.monday.com/v2/");
            httpWebRequest.ContentType = "application/json; charset=UTF-8";
            httpWebRequest.Method = "POST";
            httpWebRequest.Headers.Add("Authorization", apiKey);

            using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                streamWriter.Write(q2.Query);
            }

            var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                var result = streamReader.ReadToEnd();
            }