I am getting an error - XMLRPC::FaultException: [InvalidKey]Invalid Key

  1. Can someone please help me resolving this issue XMLRPC::FaultException: [InvalidKey]Invalid Key, currently I’m using valid Legacy API Key.

    In KEAP documentation it is mentioned that we are currently allowing you to use our Legacy key on the XMLRPC API call. As per the documentation I have changed the request url to ‘https://api.infusionsoft.com/crm/xmlrpc’ and with every request I have pass the Legacy key in header as shown below -

    api_key = ########
    api_url = “https://api.infusionsoft.com
    server = XMLRPC::Client.new2(“#{api_url}:443/crm/xmlrpc”)
    server.http_header_extra = { “X-Keap-API-Key” => “#{api_key}” }

    The steps mentioned as per the below document - Legacy Key Deprecation - Keap Developer Portal

    To that effect, we are currently allowing you to continue using your Legacy Key on the XMLRPC API if you take two steps:

  2. How do I update below code, to get the contact created in last one day. I’m getting zero contacts.
    Do I need to create a XMLRPC::Client as mentioned in the above question?

    api_client = Infusionsoft::Api::Client.new({ api_key: YourLegacyKey, app_name: “myappname” })
    all_contacts = api_client.contact.all(‘DateCreated’ => “#{(Time.zone.now - 1.days).strftime(‘%Y-%m-%d’)}%”)

@Manny_Ju Did you replace the legacy API key with a new SAK (Service Account Key)?

@Marion_Dorsett2, currently I’m using Legacy API Key on the XMLRPC API call, I have not used OAuth.

The PAT and SAK keys aren’t used for OAuth they’re intended to replace the legacy API key. Since you’re replacing the legacy API key you’ll want to use a SAK to give it full access the app.

After you replace the legacy API key with the SAK, and pass it in the header like you configured… it should work.

Thank you I’ll try using SAK.

Regarding my second question, Is the api_client.contact.all not working any more, it return zero contact even if we manually add to create new contact.

api_client = Infusionsoft::Api::Client.new({ api_key: YourLegacyKey, app_name: “myappname” })
all_contacts = api_client.contact.all(‘DateCreated’ => “#{(Time.zone.now - 1.days).strftime(‘%Y-%m-%d’)}%”)

Are you getting a non-401 response code on your request? If so, your request is authenticated correctly, and the question lies with what query you are posing to the XMLRPC endpoint. If you would like to post your raw payload (captured from the outgoing request) I can attempt to determine why you would only be seeing limited results.

The syntax of your request seems to indicate that you are using a C++ library, but as we are a Java/Javascript development organization there is a limit to how much assistance we can render regarding that language.