Enrichment API

API change history

Enrichment API contains methods for retrieving details about person (or company), based on email address (or domain).

EnrichProfile

This request retrieves information on a person based on submitted information (email address, email hash, name, phone number, and other details).

If webhook URL is provided as part of request, response is posted back to specified address.

Otherwise, if data is ready, it will be returned in response, or 202 status will be returned (and another API call is needed in retrieve to get the data).

Credits are spent only if 200 response is received.

Try it

Request

Request URL

Request headers

  • string

    The authorization token. The token will be in the format "Bearer API_KEY". For example: "Authorization: Bearer 123456789". Please include the space between "Bearer" and "API_KEY".

Request body

An EnrichProfile request is in JSON format. Any one of the Required fields must be submitted for a search to be performed. The optional field webhook may be included for the response to be posted to a specified address.

  1. email (string) The email address of the contact.
  2. emailHash (string) Either an MD5 or SHA-256 hash representation of the email address to query. Be certain to lowercase and trim the email address prior to hashing.
  3. twitter (string) Twitter handle of the contact. Acceptable formats include handle (with or without "@"), as well as the URL to the profile.
  4. phone (string) Phone number of the contact.
  5. webhookUrl (string) The webhook url to return the response to.

At least one piece of information from the list above (1 - 4) is required in order to make a query.

{
    "emailHash": "6e2b4687b823c97c5d90a9f669b5060a",
    "webhookUrl": "https://tbppe.requestcatcher.com"
}
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string"
    },
    "emailHash": {
      "type": "string"
    },
    "twitter": {
      "type": "string"
    },
    "phone": {
      "type": "string"
    }
  },
  "example": "{\n    \"emailHash\": \"6e2b4687b823c97c5d90a9f669b5060a\",\n    \"webhookUrl\": \"https://tbpt.requestcatcher.com\"\n}"
}

Responses

200 OK

The 200 response returns a person object with the following fields:

  • email (string) The email address of the contact.
  • emailHash (string) Either an MD5 or SHA-256 hash representation of the email address to query. Be certain to lowercase and trim the email address prior to hashing.
  • twitter (string) Twitter handle of the contact. Acceptable formats include handle (with or without "@"), as well as the URL to the profile.
  • phone (string) Phone number of the contact.
  • fullName (string) Full name of the contact.
  • ageRange (string) Age range of the contact.
  • gender (string) Gender of the contact.
  • location (string) Location of the contact. Depending on data quality, the exactness of this value may vary.
  • title (string) Current or most recent job title.
  • organization (string) Current or most recent place of work.
  • linkedin (string) URL of the contact's LinkedIn profile.
  • facebook (string) URL of the contact's Facebook profile.
  • bio (string) Biography of the contact.
  • avatar (string) URL of the contact's photo.
  • website (string) URL of the contact's website.
  • details (object) Additional profile data

Additional profile data can contain:

  • Demographics information,
  • Social platform information,
  • Affinity information,
  • Employment history and
  • Topics information

Each of these pieces of information, if present, will be returned as one or more property inside of 'details' response object property.

Demographics data can contain the range of information, including name, age and gender details as well as the list of locations associated with the person and previous education records. It includes the following properties:

  • name.given (string) The person's first name
  • name.family (string) The person's last name
  • name.middle (string) The person's middle name
  • name.prefix (string) The person's name prefix, if used (e.g. Mr, Mrs, Dr...)
  • name.suffix (string) The person's name suffix, if used (e.g. Jr.)
  • name.nickname (string) The person's nickname
  • age.range (string) Person age range (e.g. 18-24, 25-34, ..., 65+)
  • age.value (integer) Person age in years
  • age.birthday.year (integer) Person birth year
  • age.birthday.month (integer) Person birth month
  • age.birthday.day (integer) Person birth day
  • gender (string) Person gender
  • locations[k].label (string) An indication of how the location data was obtained
  • locations[k].city (string) City name
  • locations[k].region (string) Region name ( typically )a state or province)
  • locations[k].regionCode (string) Region code or abbreviation
  • locations[k].country (string) Country name
  • locations[k].countryCode (string) Country code or abbreviation
  • locations[k].formatted (string) The formatted address, based on location entry data
  • education[k].name (string) The name of the school/university attended
  • education[k].degree (string) The degree or focus of study
  • education[k].end.year (integer) The last year of attendancy

Social platform information can contain the list of social profiles associated with the person, as well as the list of profile pictures and list of URLs of associated websites. It contains the following properties:

  • profiles.(platform).username (string) Profile username
  • profiles.(platform).userid (string) Profile user ID
  • profiles.(platform).url (string) Profile URL
  • profiles.(platform).bio (string) Social platform profile bio
  • profiles.(platform).service (string) Social platform name
  • profiles.(platform).followers (string) Number of follows of the profile, if applicable
  • profiles.(platform).following (string) Number of profiles or topics the user is following, if applicable
  • photos[n].label (string) The type of photo
  • photos[n].value (string) The URL to the photo
  • urls[n].label (string) The type of URL/website
  • urls[n].value (string) The URL of the website

Affinity data contains the list of person's interests. Each record contains interest name, affinity level, category it belongs to as well as a reference to parent entries. That way the list of interest records actually represents one or more acyclic graphs (or forest, as named in graph theory). It contains the following properties:

  • interests[k].name (string) The name of the topic of interest
  • interests[k].id (string) The opic of interest ID value. This can be used to identify parent->child relationships in topics
  • interests[k].affinity (string) Affinity level (e.g. HIGH, MED, or LOW)
  • interests[k].parentIds (array) An array of strings representing any parent topics associated with this topic - each value is ID of another topic of interest
  • interests[k].category (string) The topic of interest category

The Employment History sata contains current and employment history records for a given person. It contains the following properties:

  • employment[k].name (string) Organization/place of employment name
  • employment[k].domain (string) Organization/place of employment deomain
  • employment[k].current (boolean) Indicator of whether or not this is the current place of employment
  • employment[k].title (string) Job or position title
  • employment[k].start (object) Object representing start date (separate properties for year, month and day)
  • employment[k].end (object) Object representing end date (separate properties for year, month and day)

The Topics data includes a list of topics or subjects that the person is associated with. This information is determined based off of several indicators of the person's online and social presence. It includes the following properties:

  • topics[n].name (string) The name of the topic

Representations

{
  "fullName": "Peter Parker",
  "ageRange": "34-44",
  "gender": "Male",
  "location": "Pretoria, Gauteng, South Africa",
  "title": "photographer",
  "organization": "freelancer",
  "twitter": "https://twitter.com/speter",
  "linkedin": "https://www.linkedin.com/in/peter-parker-928374675",
  "facebook": "https://www.facebook.com/peter.parker",
  "bio": "Freelancer photographer",
  "avatar": "https://api.touchbasepro.com/data/df927abe2890dd6d77d84cfe9f2b2946_349b55b91f35fa1d2a7d41cc8db8d29b0ff679d05fcb231ba22e476cdc264455",
  "website": "http://www.spiderman.co.za",
  "details": {
    "name": {
      "given": "Peter",
      "family": "Parker",
      "middle": "David",
      "prefix": "Mr",
      "suffix": "Jr",
      "nickname": "spiderman"
    },
    "age": {
      "range": "25-30"
    },
    "gender": "Male",
    "emails": [],
    "phones": [],
    "profiles": {
      "twitter": {
        "username": "speter",
        "userid": "12345678",
        "url": "https://twitter.com/speter",
        "bio": "Freelancer photographer",
        "service": "twitter",
        "followers": 50000,
        "following": 500
      },
      "facebook": {
        "username": "peter.parker",
        "url": "https://www.facebook.com/peter.parker",
        "service": "facebook"
      },
      "google": {
        "username": "PeterParker239847239",
        "userid": "928347923847928374200",
        "url": "https://plus.google.com/104147534947536887034",
        "bio": "Went to school at Grey College in Bloemfontein, studied at the University of the Free state and obtained my degrees there. Fellow of the College of Surgeons of South Africa. Married to Lizanne Barry, Annemey and Arina are my daughters.",
        "service": "google",
        "followers": 25
      },
      "linkedin": {
        "username": "peter-parker-928374675",
        "userid": "928374675",
        "url": "https://www.linkedin.com/in/peter-parker-928374675",
        "service": "linkedin",
        "followers": 178,
        "following": 178
      },
      "klout": {
        "username": "speter",
        "userid": "29384729384729389",
        "url": "http://klout.com/speter",
        "service": "klout",
        "score": 15
      }
    },
    "locations": [
      {
        "label": "deduced",
        "city": "Pretoria",
        "region": "Gauteng",
        "country": "South Africa",
        "countryCode": "ZA",
        "formatted": "Pretoria, Gauteng, South Africa"
      },
      {
        "label": "deduced",
        "city": "Johannesburg",
        "region": "Gauteng",
        "country": "South Africa",
        "countryCode": "ZA",
        "formatted": "Johannesburg, Gauteng, South Africa"
      },
      {
        "label": "deduced",
        "city": "Bloemfontein",
        "region": "Orange Free",
        "country": "South Africa",
        "countryCode": "ZA",
        "formatted": "Bloemfontein, Orange Free, South Africa"
      },
      {
        "label": "deduced",
        "country": "South Africa",
        "countryCode": "ZA",
        "formatted": "South Africa"
      }
    ],
    "employment": [
      {
        "name": "Marvel Studios",
        "current": true,
        "title": "Hero",
        "start": {
          "year": 1990,
          "month": 3
        },
        "end": null
      },
      {
        "name": "Global User Home Page Index",
        "current": false
      }
    ],
    "photos": [
      {
        "label": "facebook",
        "value": "https://api.touchbasepro.com/data/df927abe2890dd6d77d84cfe9f2b2946_349b55b91f35fa1d2a7d41cc8db8d29b0ff679d05fcb231ba22e476cdc264455"
      },
      {
        "label": "twitter",
        "value": "https://api.touchbasepro.com/data/df927abe2890dd6d77d84cfe9f2b2946_349b55b91f35fa1d2a7d41cc8db8d29b0ff679d05fcb231ba22e476cdc264455"
      },
      {
        "label": "google",
        "value": "https://api.touchbasepro.com/data/df927abe2890dd6d77d84cfe9f2b2946_349b55b91f35fa1d2a7d41cc8db8d29b0ff679d05fcb231ba22e476cdc264455"
      }
    ],
    "education": [
      {
        "name": "Marvel University",
        "degree": "Art",
        "end": {
          "year": 1970
        }
      }
    ],
    "urls": [
      {
        "label": "Other",
        "value": "http://www.spiderman.co.za"
      }
    ],
    "interests": [
      {
        "name": "Business news",
        "id": "5457c85ad4ac147c59c0ca4f",
        "affinity": "HIGH",
        "parentIds": [
          "55afc38492cffb786d83f7d0",
          "55afc38392cffb786d83f797"
        ],
        "category": "default"
      },
      {
        "name": "Business and careers",
        "id": "55afc38492cffb786d83f7d0",
        "affinity": "HIGH",
        "parentIds": [],
        "category": "default"
      },
      {
        "name": "News",
        "id": "55afc38392cffb786d83f797",
        "affinity": "HIGH",
        "parentIds": [],
        "category": "default"
      },
      {
        "name": "Education",
        "id": "5457c85ad4ac147c61096bf2",
        "affinity": "LOW",
        "parentIds": [],
        "category": "default"
      },
      {
        "name": "Live music",
        "id": "5457c85ad4ac147c6599dbb3",
        "affinity": "LOW",
        "parentIds": [
          "5457c85bd4ac147c8dd12710"
        ],
        "category": "default"
      },
      {
        "name": "Health",
        "id": "5457c85ad4ac147c758b96aa",
        "affinity": "HIGH",
        "parentIds": [],
        "category": "default"
      },
      {
        "name": "Photography",
        "id": "5457c85ad4ac147c798c5592",
        "affinity": "HIGH",
        "parentIds": [
          "55afc38792cffb786d83f900"
        ],
        "category": "default"
      },
      {
        "name": "Hobbies and interests",
        "id": "55afc38792cffb786d83f900",
        "affinity": "HIGH",
        "parentIds": [],
        "category": "default"
      },
      {
        "name": "Music",
        "id": "5457c85bd4ac147c8dd12710",
        "affinity": "HIGH",
        "parentIds": [],
        "category": "default"
      },
      {
        "name": "Science",
        "id": "5457c85bd4ac147c99d3f490",
        "affinity": "LOW",
        "parentIds": [],
        "category": "default"
      }
    ],
    "topics": [
      {
        "name": "3D Printing"
      },
      {
        "name": "Landscapes"
      },
      {
        "name": "Martial arts"
      }
    ]
  },
  "updated": "2018-09-11"
}
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string"
    },
    "emailHash": {
      "type": "string"
    },
    "twitter": {
      "type": "string"
    },
    "phone": {
      "type": "string"
    },
    "fullName": {
      "type": "string"
    },
    "ageRange": {
      "type": "string"
    },
    "gender": {
      "type": "string"
    },
    "location": {
      "type": "string"
    },
    "organization": {
      "type": "string"
    },
    "linkedin": {
      "type": "string"
    },
    "facebook": {
      "type": "string"
    },
    "bio": {
      "type": "string"
    },
    "avatar": {
      "type": "string"
    },
    "website": {
      "type": "string"
    }
  }
}

202 Accepted

202 Response can include the following options:

  • If a webhook was included in the request, the response indicates that actual data will be returned to the webhook URL.
  • If a webhook was not included, and the response is taking a longer time than expected, the 202 result indicates a successful submission was made, but can not be returned this time. You should re-submit the same request, or add webhook URL to request object, in order to receive results without having to resubmit.

Representations

{
  "status": 202,
  "message": "Queued for search. Try back in a few minutes, or better yet, try using our webhook option by providing a webhookUrl to send results to. Find more info about webhooks here: https://tbp.portal.azure-api.net/docs/services/profile-enrichment/operations/post-enrichprofile?"
}
{
  "type": "object",
  "properties": {
    "status": {
      "type": "number"
    },
    "message": {
      "type": "string"
    }
  }
}
<EnrichProfileResponse>
  <status>0</status>
  <message>string</message>
</EnrichProfileResponse>
{
  "type": "object",
  "properties": {
    "status": {
      "type": "number"
    },
    "message": {
      "type": "string"
    }
  }
}

400 Bad Request

The request was not properly formatted. Please verify the submission is in the correct format. For example: the email address is a properly formatted email address, strings are in quotes, etc.

Representations

{
  "status": 400,
  "message": "Please verify request."
}
{
  "type": "object",
  "properties": {
    "status": {
      "type": "number"
    },
    "message": {
      "type": "string"
    }
  }
}
<EnrichProfileResponse>
  <status>0</status>
  <message>string</message>
</EnrichProfileResponse>
{
  "type": "object",
  "properties": {
    "status": {
      "type": "number"
    },
    "message": {
      "type": "string"
    }
  }
}

401 Unauthorized

The API key is invalid. Please verify it is correct and try again.

Representations

{
  "status": 401,
  "message": "API key is invalid."
}

403 Forbidden

There is not enough credits on your account or your account has been suspended. Please check with your account representative for more information.

Representations

{
  "status": 403,
  "message": "Your account has been suspended! Please contact our support for more information."
}

404 Not Found

The profile match could not be found.

Representations

{
  "status": 404,
  "message": "Profile not found"
}
{
  "type": "object",
  "properties": {
    "status": {
      "type": "number"
    },
    "message": {
      "type": "string"
    }
  }
}
<EnrichProfileResponse>
  <status>0</status>
  <message>string</message>
</EnrichProfileResponse>
{
  "type": "object",
  "properties": {
    "status": {
      "type": "number"
    },
    "message": {
      "type": "string"
    }
  }
}

405 Method Not Allowed

There's not enough credits on your account

Representations

{
  "status": 405,
  "message": "There's not enough credits on your account!"
}

429 Too many requests

The number of API calls has been exceeded. The return will include the number of seconds (represented by (number of seconds) in the example) until the API call can be tried again.

Representations

{
  "status": 429,
  "message": "Rate limit is exceeded.  Try again in {number of seconds} seconds."
}

500 Internal Server Error

Some error occurred in the processing request. Please try it again at a later time.

Representations

{
  "status": 500,
  "message": "An internal error has occurred. We have been notified about it and\nwill restore service functionality as soon as possible."
}

Code samples

@ECHO OFF

curl -v -X POST "https://api.touchbasepro.com/enrich/EnrichProfile"
-H "Authorization: Bearer API_KEY"
-H "Content-Type: application/json"

--data-ascii "{body}" 
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;

namespace CSHttpClientSample
{
    static class Program
    {
        static void Main()
        {
            MakeRequest();
            Console.WriteLine("Hit ENTER to exit...");
            Console.ReadLine();
        }
        
        static async void MakeRequest()
        {
            var client = new HttpClient();
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            // Request headers
            client.DefaultRequestHeaders.Add("Authorization", "Bearer API_KEY");

            var uri = "https://api.touchbasepro.com/enrich/EnrichProfile?" + queryString;

            HttpResponseMessage response;

            // Request body
            byte[] byteData = Encoding.UTF8.GetBytes("{body}");

            using (var content = new ByteArrayContent(byteData))
            {
               content.Headers.ContentType = new MediaTypeHeaderValue("< your content type, i.e. application/json >");
               response = await client.PostAsync(uri, content);
            }

        }
    }
}	
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class JavaSample 
{
    public static void main(String[] args) 
    {
        HttpClient httpclient = HttpClients.createDefault();

        try
        {
            URIBuilder builder = new URIBuilder("https://api.touchbasepro.com/enrich/EnrichProfile");


            URI uri = builder.build();
            HttpPost request = new HttpPost(uri);
            request.setHeader("Authorization", "Bearer API_KEY");
            request.setHeader("Content-Type", "application/json");


            // Request body
            StringEntity reqEntity = new StringEntity("{body}");
            request.setEntity(reqEntity);

            HttpResponse response = httpclient.execute(request);
            HttpEntity entity = response.getEntity();

            if (entity != null) 
            {
                System.out.println(EntityUtils.toString(entity));
            }
        }
        catch (Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
}

<!DOCTYPE html>
<html>
<head>
    <title>JSSample</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>

<script type="text/javascript">
    $(function() {
        var params = {
            // Request parameters
        };
      
        $.ajax({
            url: "https://api.touchbasepro.com/enrich/EnrichProfile?" + $.param(params),
            beforeSend: function(xhrObj){
                // Request headers
                xhrObj.setRequestHeader("Authorization","Bearer API_KEY");
                xhrObj.setRequestHeader("Content-Type","application/json");
            },
            type: "POST",
            // Request body
            data: "{body}",
        })
        .done(function(data) {
            alert("success");
        })
        .fail(function() {
            alert("error");
        });
    });
</script>
</body>
</html>
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
    NSString* path = @"https://api.touchbasepro.com/enrich/EnrichProfile";
    NSArray* array = @[
                         // Request parameters
                         @"entities=true",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];

    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"POST"];
    // Request headers
    [_request setValue:@"Bearer API_KEY" forHTTPHeaderField:@"Authorization"];
    [_request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    // Request body
    [_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]];
    
    NSURLResponse *response = nil;
    NSError *error = nil;
    NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];

    if (nil != error)
    {
        NSLog(@"Error: %@", error);
    }
    else
    {
        NSError* error = nil;
        NSMutableDictionary* json = nil;
        NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
        NSLog(@"%@", dataString);
        
        if (nil != _connectionData)
        {
            json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
        }
        
        if (error || !json)
        {
            NSLog(@"Could not parse loaded json with error:%@", error);
        }
        
        NSLog(@"%@", json);
        _connectionData = nil;
    }
    
    [pool drain];

    return 0;
}
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';

$request = new Http_Request2('https://api.touchbasepro.com/enrich/EnrichProfile');
$url = $request->getUrl();

$headers = array(
    // Request headers
    'Authorization' => 'Bearer API_KEY',
    'Content-Type' => 'application/json',
);

$request->setHeader($headers);

$parameters = array(
    // Request parameters
);

$url->setQueryVariables($parameters);

$request->setMethod(HTTP_Request2::METHOD_POST);

// Request body
$request->setBody("{body}");

try
{
    $response = $request->send();
    echo $response->getBody();
}
catch (HttpException $ex)
{
    echo $ex;
}

?>
########### Python 2.7 #############
import httplib, urllib, base64

headers = {
    # Request headers
    'Authorization': 'Bearer API_KEY',
    'Content-Type': 'application/json',
}

params = urllib.urlencode({
})

try:
    conn = httplib.HTTPSConnection('api.touchbasepro.com')
    conn.request("POST", "/enrich/EnrichProfile?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64

headers = {
    # Request headers
    'Authorization': 'Bearer API_KEY',
    'Content-Type': 'application/json',
}

params = urllib.parse.urlencode({
})

try:
    conn = http.client.HTTPSConnection('api.touchbasepro.com')
    conn.request("POST", "/enrich/EnrichProfile?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################
require 'net/http'

uri = URI('https://api.touchbasepro.com/enrich/EnrichProfile')


request = Net::HTTP::Post.new(uri.request_uri)
# Request headers
request['Authorization'] = 'Bearer API_KEY'
# Request headers
request['Content-Type'] = 'application/json'
# Request body
request.body = "{body}"

response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request(request)
end

puts response.body