# Upcoming: API Key Sunset

**URL:** <https://community.hubspot.com/t/upcoming-api-key-sunset/58154>\
**Category:** Developer Announcements\
**Tags:** api\
**Created:** [June 1, 2022, 4:44pm UTC](https://community.hubspot.com/t/upcoming-api-key-sunset/58154 "2022-06-01T16:44:19Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![GKenyon](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/gkenyon/32/43030_2.png) [@GKenyon](https://community.hubspot.com/u/GKenyon)\
**Post date:** [June 3, 2022, 1:34am UTC](https://community.hubspot.com/t/upcoming-api-key-sunset/58154/10 "2022-06-03T01:34:00Z")

</div>

Thanks Dennis,

For the benefit of anyone else using C# and an API key to access the API from an external application this is all you will need to change.

I created a private app - assigned scope and the creation generated a token.

This is an excerpt from the original code (using RestSharp)

hapiKey = “your\_api\_key”; // real app reads this from a config

var client = new RestClient(baseURL);

var request = new RestRequest(“crm/v3/objects/companies/”, Method.Get);

request.AddQueryParameter(“hapikey”, hapiKey);  
// etc..

This is what you need to change.

token = “your\_token”; // real app reads this from a config

var client = new RestClient(baseURL);

var request = new RestRequest(“crm/v3/objects/companies”, Method.Get);

request.AddHeader(“Authorization”, "Bearer " + token);  
// etc.

---

_[View the full topic](https://community.hubspot.com/t/upcoming-api-key-sunset/58154)._
