New API Key: Unauthorzied Error

The below code should work. But I keep getting “Unauthorized” when calling findByEmail. I checked my key many times and it is correct. Why am I getting this error? When testing in Postman using xml, my key does work.

            string url = "https://api.infusionsoft.com/crm/xmlrpc/v1";
XmlRpcClientProtocol proxy = new XmlRpcClientProtocol();
proxy.Url = url;

string key = "KeapAK-7f19xxxxxxxxxxxxxx";
proxy.Headers["X-Keap-API-Key"] = key; // Ensure 'key' contains your actual API key

try
{

    string email = "itest9@h.com"; 

    iFace proxysignup = XmlRpcProxyGen.Create<iFace>();
    XmlRpcStruct[] contacts = proxysignup.findByEmail(key, email, new[] { "Id", "FirstName", "LastName" });

I am not sure what language this is, but it looks like you are configuring proxy with the correct stuff, but it is not used in the API call. It looks like you are creating a new proxy called proxysignup, which isn’t configured with the proper header. This is just a guess, but without more of the code or details it will be hard to diagnose.

@Doug_Carey did you figure this out yet?

Does Postman provide a code snippet for that language?

If it does, it may provide a clue on what you’re missing from your code.