ASP.NET Core 3.1 AddHttpClient call that includes a call to the database
No need to manually create the DbContext. Since you have already registered it with the service collection, resolve it as needed. 

AddHttpClient has an overload that provides access to the service provider.

services.AddHttpClient("VendorAPICall", (sp, c) =&gt; {
    c.BaseAddress = new Uri("https://api.vendorname.com/");
    c.Timeout = new TimeSpan(4, 0, 0);
    c.DefaultRequestHeaders.Accept.Clear();
    c.DefaultRequestHeaders.Add("Accept", "application/json");
    var ctx = sp.GetService&lt;DatabaseContext&gt;(); //&lt;-- resolve context
    Security security = ctx.Security.First();
    // Header must include the API Token for all requests, 
    // or the request will be rejected 
    c.DefaultRequestHeaders.Add("ApiToken", security.Apikey);

});


This will allow the framework to manage its lifetime instead of constantly having to dispose of it yourself in a using block