<aside> ⚠️ Note: This documentation is for the first version of our API which is now deprecated. You should probably be looking at the docs for our new API instead, which you can find here.

</aside>

API Overview

The Less Annoying CRM API is a simple web service that allows programmers to connect third-party applications with Less Annoying CRM. It is particularly well suited for entering leads from web forms. If there's some functionality that you're unable to perform with the current API functions, please let us know, and we'll be happy to consider adding new functions to support your needs.

Accessing our API is as simple as sending an HTTP request to our server. In this help section, we'll go over everything you need to know to start using the API, and we have PHP code examples to help you get started.


Generating your API key

In order to access the API, you need two pieces of information. The first is a User Code which is a unique code that we use to identify your account. The other is an API key which acts as a password when you connect to the API. You can get both of those on the API page in your settings section. Just click on the "Generate a new API key" to display your User Code (a unique identifier for your account) and a new key. You'll need to remember both of those later when you start writing code.

Please note that anyone who knows your User Code and API key can access your account through the API. If you're ever concerned that there may be unauthorized access, you can go back to the the API page, deactivate your key, and then generate a new one.


Connecting to the API

Once you've generated your API key, connecting to the API is easy. All you need to do is send an HTTPS request to api.lessannoyingcrm.com. You can use POST, GET, or whatever else you want (it's all the same to us).

All of the API functions are called from the same URL, so all you need to do is pass the correct parameters to us and we'll take it from there. Each API call must include the following four parameters:

  1. UserCode - the unique code identifying who you are (you get this when you generate your API key)
  2. APIToken - the security credentials which will give you access to the API
  3. Function - the name of the function you want to call (like "CreateContact")
  4. Parameters - a JSON-encoded array of parameters to pass to the function

As you can see, the API returns a JSON encoded array. One of the items in that array is called "Success" and it will return true or false. If false, there will also be an "Error" so you can figure out what went wrong. If the API call was a success, there will normally be other data in the array such as the ID of the record you just created.

Here's a very simple example of a PHP function that calls the API and includes these four parameters in the URL:

<?php
  
function CallAPI($UserCode, $APIToken, $Function, $Parameters){
    $APIResult = file_get_contents("<https://api.lessannoyingcrm.com?UserCode=$UserCode&APIToken=>".
                "$APIToken&Function=$Function&Parameters=".urlencode(json_encode($Parameters)));
      
    //decode the result into an associative array
    $APIResult = json_decode($APIResult, true);
      
    //check to see if the API call worked
    if(@$APIResult['Success'] === true){
        echo "Success!";
    }
    else{
        echo "API call failed. Error:".@$APIResult['Error'];
        exit;
    }
    return $APIResult;
}