Getting NotFound error while generating access token

I have created Server-to-Server-oauth app in marketplace. I’m able to get the token through postman. Trying to get the token through C# code but it is giving ““Request failed with status code NotFound””

var client = new RestClient(“{accountId}”);
var request = new RestRequest(Method.Post.ToString());

        request.AddHeader("authorization", "Basic  {clientId:clientSecret}");
        request.AddHeader("content-type", "application/x-www-form-urlencoded");
         RestSharp.RestResponse response = client.Execute(request);

I have used the www.base64encode to generate the string as well. I’m using ASP.NET Core Web API. Can you please let me know what is missing here.