aNinja API Documentation

Welcome to the aNinja REST API specification

Authentication

HTTP Basic authentication. The API key acts as the username.

aNinja uses an API Key to authenticate access to the API.

Obtain your API in your Account Settings.

aNinja expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization:

Make sure to replace with your assigned API key.

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://acquisition.ninja/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>

Fields

The following are standard fields you can map to, in addition to any custom fields created in your application that you can see under Settings -> Custom fields

Category    Field   Aliases
Contact Contact.name    contact_name | your-name
Contact Contact.firstname   your-fname
Contact Contact.lastname    your-lname
Contact Contact.email1  your-email
Contact Contact.phone1  your-phone | your-phone1
Lead    Lead.note1  your-comments
Lead.Company    Lead.Company.name   your-company
Lead.Company    Lead.Company.url
Lead.Company    Lead.Company.description

Activitycalls

Add Activitycall
POST   /activitycalls/log

API endpoint to "add" an activitycall

A successful call will return a response with status "success" with the data Should add the following field to the body in "form-data":

  • contactitem_id
  • lead_id
  • contact_id

Update Activitycalls
PUT   /activitycalls/log/1

API endpoint to "update" an activitycall

A successful call will return a response with status "success" with the data Should add the following field to the body in "form-data":

  • contactitem_id

Delete Activitycall
DELETE   /activitycalls/30

API endpoint to "delete" an Activitycall.

Activitylogs

Delete Activitylog
DELETE   /activitylogs/30

API endpoint to "delete" an activitylog

Add Call Log
POST   /activitylogs/call-log

API endpoint to "add" an activitylog

A successful call will return a response with status "success" with the data Should add the following field to the body in "form-data":

  • contactitem_id
  • lead_id

Update Call Log
PUT   /activitylogs/call-log/1949

API endpoint to "update" an activitycall

A successful call will return a response with status "success" with the data Should add the following field to the body in "form-data":

  • contactitem_id
  • minutes
  • note

Activitynotes

Add Activitynote
POST   /activitynotes
Update Activitynote
PUT   /activitynotes/2986
Delete Activitynote
DELETE   /activitynotes/3

Addresses

Add address
POST   /addresses
Update address
PUT   /addresses/19
Get Lead Address
GET   /addresses/lead?lead_id=1
Delete Address
DELETE   /addresses/22

Chat conversation

Show Chatconversation
GET   /chatconversations/1965
Get Latest Message
GET   /chatconversations/1965/latest-message
Status Toggle
PUT   /chatconversations/status-toggle

Chatmessages

Show Chatmessage
GET   /chatmessages/6978

Contactitems

Delete Contactitem
DELETE   /contactitems/2

Contacts

Add contact
POST   /contacts
updateContact
PUT   /contacts/86
Delete contact
DELETE   /contacts/86

Customfields

Get All Customfields
GET   /customfields

Customfieldsleads

Add lead customfieldslead
POST   /customfieldsleads/
Get All Customfieldslead
GET   /customfieldsleads/
Get Lead Customfieldslead
GET   /customfieldsleads/lead?lead_id=1
Show Customfieldslead by id
GET   /customfieldsleads/3
Update lead customfieldslead
PUT   /customfieldsleads/22
Delete lead customfieldslead
DELETE   /customfieldsleads/26

Emailsequences

Get Emailsequences Options
GET   /emailsequences/options

Emailtemplates

Get Emailtemplates Options
GET   /emailtemplates/options
Get Parsed Emailtemplate
GET   /emailtemplates/parsed?emailtemplate_id=1&lead_id=1&user_id=1

Inboxitems

Get All Inboxitems
GET   /inboxitems/
CountI nboxitems
GET   /inboxitems/count
Show Inboxitem
GET   /inboxitems/1
Not Done Inboxitem
GET   /inboxitems/not-done
Done Inboxitem
GET   /inboxitems/done
Future Inboxitem
GET   /inboxitems/future
Refresh Inboxitem
GET   /inboxitems/1
Mark As Done Inboxitems
POST   /inboxitems/mark-as-done/1
Notice (8): Undefined index: formdata [APP/views/elements/docs/post_test_form.ctp, line 12]
Warning (2): Invalid argument supplied for foreach() [APP/views/elements/docs/post_test_form.ctp, line 12]
Bulk Mark As Done Inboxitems
POST   /inboxitems/bulk-mark-as-done
Bulk Mark As Not Done Inboxitems
POST   /inboxitems/bulk-mark-as-not-done

Notetemplates

Get All Templates
GET   /notetemplates?user_id=1

Opportunities

Update opportunity
PUT   /opportunities/1
Add opportunity
POST   /opportunities
Get Lead Opportunities
GET   /opportunities/lead?lead_id=1
Delete opportunity
DELETE   /opportunities/7

Smssequences

Get Smssequences Options
GET   /smssequences/options

Smstemplates

Get Smstemplates Options
GET   /smstemplates/options?user_id=1
Get Parsed Smstemplates
GET   /smstemplates/parsed?smstemplate_id=1&lead_id=1&user_id=1

Tasks

Fetch auth tasks
GET   /tasks/auth
Fetch lead tasks
GET   /tasks/lead/?lead_id=1
Add lead task
POST   /tasks
Update task
PUT   /tasks/20
Delete task
DELETE   /tasks/19

Teams

Get All Teams
GET   /teams/

Workflows

Update Workflow
PUT   /workflows/1
Add Workflow
POST   /workflows