# User agent http header not set

**URL:** <https://api-discuss.freeagent.com/t/user-agent-http-header-not-set/2102>\
**Category:** Uncategorized\
**Created:** [19 June 2020 16:13 UTC](https://api-discuss.freeagent.com/t/user-agent-http-header-not-set/2102 "2020-06-19T16:13:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nishitcaax](https://api-discuss.freeagent.com/letter_avatar_proxy/v4/letter/n/fbc32d/32.png) [@nishitcaax](https://api-discuss.freeagent.com/u/nishitcaax)\
**Post date:** [19 June 2020 16:13 UTC](https://api-discuss.freeagent.com/t/user-agent-http-header-not-set/2102/1 "2020-06-19T16:13:35Z")

</div>

Hi,

I want to get company details, it gives me a message “User agent http header not set”.

Is there something like tenant id in freeagent api?

My code is as below.

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;  
var nclient = new HttpClient();  
nclient.DefaultRequestHeaders.TryAddWithoutValidation(“Content-Type”, “application/x-www-form-urlencoded;”);  
nclient.DefaultRequestHeaders.Add(“accept”, “application/json”);  
nclient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(“Bearer”, new\_access\_token);  
var nreq = new HttpRequestMessage(HttpMethod.Get, “[https://api.sandbox.freeagent.com/v2/company](https://api.sandbox.freeagent.com/v2/company)”);  
var nres = await nclient.SendAsync(nreq);  
string nrep = await nres.Content.ReadAsStringAsync();

Thanks

---

<div class="post-metadata">

**Author:** ![nishitcaax](https://api-discuss.freeagent.com/letter_avatar_proxy/v4/letter/n/fbc32d/32.png) [@nishitcaax](https://api-discuss.freeagent.com/u/nishitcaax)\
**Post date:** [20 June 2020 16:44 UTC](https://api-discuss.freeagent.com/t/user-agent-http-header-not-set/2102/2 "2020-06-20T16:44:46Z")

</div>

Hi @Ewa_Lipinska,

Can you please help me for the same?

Thank you

---

<div class="post-metadata">

**Author:** ![Ewa\_Lipinska](https://api-discuss.freeagent.com/user_avatar/api-discuss.freeagent.com/ewa_lipinska/32/235_2.png) [@Ewa\_Lipinska](https://api-discuss.freeagent.com/u/Ewa_Lipinska)\
**Post date:** [22 June 2020 08:53 UTC](https://api-discuss.freeagent.com/t/user-agent-http-header-not-set/2102/3 "2020-06-22T08:53:55Z")

</div>

Hi @nishitcaax,

Thanks for your patience – I’m afraid we don’t have anyone monitoring the API Forum on weekends. We don’t have any specific requirements as to the contents of your User-Agent header – and we certainly don’t expect it to contain a unique user identifier (which is what I understand the `tenant id` to be in some of Microsoft’s systems).

The User-Agent header usually contains information about the application/operating system/vendor/version of the agent making a request on behalf of a user. Could you try setting this header as the error message you’re receiving would suggest and see how you get on?

Best wishes,

Ewa

---

<div class="post-metadata">

**Author:** ![nishitcaax](https://api-discuss.freeagent.com/letter_avatar_proxy/v4/letter/n/fbc32d/32.png) [@nishitcaax](https://api-discuss.freeagent.com/u/nishitcaax)\
**Post date:** [23 June 2020 09:35 UTC](https://api-discuss.freeagent.com/t/user-agent-http-header-not-set/2102/4 "2020-06-23T09:35:42Z")

</div>

Thank you @Ewa_Lipinska
