How Can We Help?

Developer Documentation

You are here:
< All Topics

API access

There are 2 steps to get going with using the aNinja API:

  1. Obtain your API key See https://help.aninja.com/knowledge-base/find-aninja-api-key/
  2. View API documentation https://documenter.getpostman.com/view/5113976/2s7YYva2RC

    WordPress Integration

    We recommend using the “forms-3rdparty-integration” WordPress plugin in order to integrate your WordPress Contact forms submissions into aNinja. Here are the steps:

    Get your API key in your User Settings when logged into ANinja. Install & activate WP plugin in your WordPress installation: forms-3rdparty-integration Once the plugin is installed, access the plugins’ setting to configure it as following:

    Add a new 3rd-party service, e.g. name it “ANinja” Select the forms you want to attach the service to

    Add Endpoint URL (replace with main user API key)

    https://aninja.com/api/v1/contactform/?apikey=YOUR_API_KEY_HERE

    Map Form fields (without CF7 brackets – see what field names are defined and map to Aninja API fields)

    Javascript applications

    The following example is of an API request in Javascript. You can customize off of the following examples to suit your actual code / use case.

    Example use cases: Squarespace, Shopify

    ajax({ type: ‘POST’, url: “https://aninja.com/api/v1/contactform/?apikey=YOUR_API_KEY_HERE”, data:$.param({contact_name : contact_name}) + “&”+ $.param({contact_email1 : contact_email1}) + “&”+ $.param({contact_phone1 : contact_phone1})+ “&”+ $.param({company_name : company_name}), success: function (data) { alert(‘success’); } });

     

    The following is more specific to Squarespace (add in the “Page section settings -> Advanced tab -> Page header code injection text area” section for the page where you have the form you want to forward into aNinja)

    // SQUARESPACE – example 1 // Add in javascript advanced: <script src=“https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js”></script> <script> $(document).ready(function() { $(‘form’).submit(function(e) { var contact_name = $(“input[name=’fname’]”).val(); var contact_email1 = $( “input[name=’email’]”).val(); var phone_areacode = $(‘*[data-title=”Areacode”]’).val(); var phone_prefix= $(‘*[data-title=”Prefix”]’).val(); var phone_line = $(‘*[data-title=”Line”]’).val(); var contact_phone1 = phone_areacode+phone_prefix+phone_line; var subject = $($(‘select’)[0]).val(); var pref_contact_method = $($(‘select’)[1]).val(); var message = $(‘textarea#textarea-yui_3_17_2_1_1442700176413_134868-field’).val(); $.ajax({ type: ‘post’, url: “https://aninja.com/api/v1/contactform/?apikey=YOUR_API_KEY_HERE”, data: { ‘contact_name’: contact_name, ‘contact_email1’: contact_email1, ‘contact_phone1’: contact_phone1, ‘your-comments’: ‘message: ‘+message+‘ subject:’+subject+‘ pref_contact_method: ‘+pref_contact_method }, success: function (data) { // alert(‘success’); } }); }); }); </script>

     

    // Squarespace – Example 2 <script src=“https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js”></script> <script> $(document).ready(function() { $(‘form’).submit(function(e) { var contact_name = $(“input[name=’fname’]”).val() + ‘ ‘+ $(“input[name=’lname’]”).val(); var contact_email1 = $( “input[name=’email’]”).val(); var subject = $(‘#text-yui_3_17_2_1_1525202684663_15908-field’).val(); var message = $(‘textarea’).val(); $.ajax({ type: ‘POST’, url: “https://aninja.com/api/v1/contactform/?apikey=YOUR_API_KEY_HERE”, data: { ‘contact_name’: contact_name, ‘contact_email1’: contact_email1, ‘your-comments’: ‘Subject: ‘+subject+‘ Message:’+message }, success: function (data) { alert(‘We have received your request, thank you’); } }); }); }); </script>

    Required fields, Custom fields and Mapping fields

    Standard fields for adding a lead

    The primary required field is:

    contact_name

    Additional fields include:

    • contact_email1
    • contact_email2
    • contact_phone1
    • contact_phone2
    • company_name
    • company_description
    • user_id
    • address_street1
    • address_street2
    • address_city
    • address_state
    • address_postalzip
    • address_country
    • date_created
    • notes

    Custom fields

    Custom fields can be specified, e.g.

    • Custom.Source
    • Custom.Campaign
Table of Contents