Select Page

The Infusionsoft API uses the XML-RPC protocol to encode XML calls over HTTP. For .Net development, I recommend using Charles Cook’s XML-RPC.Net Library.

All of the examples in this series will reference this library.

Infusionsoft Application Setup

In order to successfully use the Infusionsoft API, your Infusionsoft application must be setup to allow the communication.

Default Infusionsoft Application without API Key

Configuring your Infusionsoft application is done from the Application tab on the Admin Settings page. If your application has never been set up with an encrypted key (see “Default Infusionsoft Application without API Key”) then you will need to add an API Passphrase.

Properly Set Up Encrypted Key

Your API Passphrase can be anything and after you click Save it will create your Encrypted Key (see image on right). The Encrypted key value that the Infusionsoft application has created is your brand-spanking new API Key that you can now use within the Infusionsoft API service method calls.

Connecting to an Infusionsoft API Service

Infusionsoft provides a number of API Services that allow developers to interact with Infusionsoft data. The documentation is occasionally updated as issues are found and when new API Services are added.

The services we cover in this Getting Started series are:

  • Contact Service – used to manage contacts
  • Data Service – used to manipulate data directly from the database
  • Email Service – used to manage email templates, send email, and attach email to contact records
  • Search Service – used to retrieve results from saved searches

To enable the XML-RPC.Net library to create the API proxy, you must first create your own interface specifying the methods of the Infusionsoft API you would like to utilize.

For this example, we will create an Infusionsoft Contact Service proxy that includes the Add method.

[sourcecode language=”c”]

public interface IContactService : IXmlRpcProxy
int Add(string key, XmlRpcStruct dataFields);


You will notice that two attributes from the XML-RPC.Net library have been applied to this interface:

  • XmlRpcUrl – (Optional) This attribute is applied to the interface and specifies the location of the API service. In this example, the Infusionsoft application called “theApp” has been specified. You will want to change the “theApp” to your actual Infusionsoft application name. This attribute is optional, as the Url can be specified at run-time. Personally, I set the Api Url at runtime, since my SDK library is reused for many applications and the Infusionsoft Application Name is not known at compile-time.
  • XmlRpcMethod – (Required) This attribute is applied to each method and specifies the Infusionsoft API Service and method name. Since our example is using the Contact Service’s Add method, we have specified ContactService.add.

Our next step is to create the XML-RPC.Net proxy object and make our method call.

[sourcecode language=”c”]

public class Contact
public void Add()
IContactService contactService = XmlRpcProxyGen.Create<IContactService>();
contactService.Url =
"https://" + Api.AppName + "";

XmlRpcStruct contactData = new XmlRpcStruct
{ "Email" , "" },
{ "FirstName", "Barney" },
{ "LastName", "Fife" }

int contactId = contactService.Add(Api.Key, contactData);



We can see on line 5 that XmlRpcProxyGen.Create() will create a new instance of our proxy which allows us to make method calls against the Infusionsoft API.

As was mentioned in the description of the XmlRpcUrl attribute, we can see in Line 6 shows how the Url property of the proxy to specify the location of the Infusionsoft API. In this case I have read the Infusionsoft Application Name from my application configuration file and dynamically created the Infusionsoft API Url.

Now, we have both configured our Infusionsoft application to allow API access and built our Infusionsoft API Proxy to connect to Infusionsoft.

Next we will discuss how to find an existing contact and either update the record or add a new contact using the API.