SigParser for Developers

Email Parsing Made Easy

SigParser’s email parsing API is how every developer should be parsing emails.

The SigParser’s tools can:

  • Split reply chains (emails)
  • Find email addresses in the email body and reply chains (contacts)
  • Find contact details (phone, title…) in the email signatures and reply chains (contacts)
  • Find inline phone numbers where someone says “My phone number is…”
  • Categorize the type of email or sender. Real sender detection (isSpammyLookingSender, isSpammyLookingEmailMessage, isSpam)
  • Provide a cleaned email body without signatures or reply chains (cleanedemailbody_plain)

Common use cases are:

You can try our API without writing in code.

API Documentation

We provide a detailed Swagger documentation page. You can see exactly what you need to call and the structure of the response.

Secure & Stateless

Our parse email API is secure. It uses HTTPS and doesn't store any of the email contents. It processes the request and returns the results.

Get Your API Key

Try the SigParser API. Signup and get an API key with 1,500 free emails per month. Upgrade or downgrade at any time. Our API is entirely serverless and stateless.
Get Your API Key Now!

API Request and Response Example

POST an email to our API

{
  "subject": "string",
  "from_address": "string",
  "from_name": "string",
  "htmlbody": "string",
  "plainbody": "string",
  "date": "string",
  "options": {
    "outputCleanedEmailHtmlDepth": 1
  }
}

We’ll responde with a structure like

{
    "error": "string",
    "contacts": [
      {
        "firstName": "string",
        "lastName": "string",
        "emailAddress": "string",
        "emailAddressDomain": "string",
        "emailAddressDomainWithoutTLD": "string",
        "phoneNumber": "string",
        "mobilePhone": "string",
        "voipPhone": "string",
        "officePhone": "string",
        "fax": "string",
        "address": "string",
        "title": "string",
        "twitterUrl": "string",
        "twitterHandle": "string",
        "linkedInUrl": "string",
        "linkedInHandle": "string",
        "companyName": "string",
        "website": "string"
      }
    ],
    "isSpammyLookingEmailMessage": true,
    "isSpammyLookingSender": true,
    "isSpam": true,
    "from_LastName": "string",
    "from_FirstName": "string",
    "from_Fax": "string",
    "from_Phone": "string",
    "from_Address": "string",
    "from_Title": "string",
    "from_MobilePhone": "string",
    "from_OfficePhone": "string",
    "from_LinkedInUrl": "string",
    "from_TwitterUrl": "string",
    "from_TwitterHandle": "string",
    "from_EmailAddress": "string",
    "emails": [
      {
        "from_EmailAddress": "string",
        "from_Name": "string",
        "textBody": "string",
        "htmlLines": [
          "string"
        ],
        "date": "2019-05-05T22:27:56.124Z",
        "didParseCorrectly": true,
        "to": [
          {
            "name": "string",
            "emailAddress": "string"
          }
        ],
        "cc": [
          {
            "name": "string",
            "emailAddress": "string"
          }
        ],
        "htmlBody": "string",
        "spammyLookingEmail": true,
        "subject": "string",
        "cleanedBodyHtml": "string",
        "cleanedBodyPlain": "string"
      }
    ],
    "from_LinkedInHandle": "string",
    "duration": 0,
    "cleanedemailbody": "string",
    "cleanedemailbody_ishtml": true,
    "cleanedemailbody_plain": "string",
    "from_CompanyName": "string",
    "from_Website": "string",
    "from_EmailAddressDomain": "string",
    "from_EmailAddressDomainWithoutTLD": "string"
  }

View JSON Output Model Spec

Copy and paste an email into our API tester page to see how it works.

Get Your API Key

Try the SigParser API. Signup and get an API key with 1,500 free emails per month. Upgrade or downgrade at any time. Our API is entirely serverless and stateless.
Get Your API Key Now!

Programming Language Resources

We’ve tried to provide examples of how to parse emails with the most common languages of our users.

You’ll notice you only need to provide from_name, from_address which is the email address and plainbody although you should also provide htmlbody which will yield better parse results.

Curl

curl -k -i -H "Content-Type: application/json" -H "x-api-key: <ApiKey>" -X POST -d '{"from_address":"jsmith@example.com", "from_name":"John Smith","plainbody":"Here is the email body."}' 'https://api.sigparser.com/api/Email'

C# and .NET

Article: Use C# to parse Gmail emails with SigParser

nuget: SigParser

var client = new SigParser.Client(ApiKey);
            var result = client.Parse(new SigParser.EmailParseRequest
            {
                plainbody = @"
Hi John,

Lets get coffee tomorrow.

Thanks
Steve Johnson
888-333-3323 Mobile
San Diego, CA
",
                from_name = "Steve Johnson",
                from_address = "sjohnson@example.com"
            }).Result;

Python

import requests
import json

url = "https://api.sigparser.com/api/Email"

payload = json.dumps( {"from_address": "jsmith@example.com","from_name": "John Smith", "plainbody": "This is an email.", "htmlbody": null } )
headers = {
    'content-type': "application/json",
    'x-api-key': "212121212121212",
    'cache-control': "no-cache"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)

JavaScript

var request = require("request");

var options = { 
    method: 'POST',
    url: 'https://api.sigparser.com/api/Email',
    headers: 
    {   'cache-control': 'no-cache',
        'x-api-key': '232323232323',
        'content-type': 'application/json' },
    body: { from_address: 'jsmith@example.com', from_name: 'John Smith', plainbody: "This is the body of the email." },
    json: true 
};

request(options, function (error, response, body) {
    if (error) throw new Error(error);
    console.log(body);
});

R Statistics Package

library(httr)
library(jsonlite)

# Set API URL.
url <- 'https://api.sigparser.com/api/Email';

# Set payload.
# It is also possible to assign a raw JSON string to body
# without the use of toJSON().
body <- toJSON(list("from_address" = "jsmith@example.com",
                    "from_name" = "John Smith",
                    "plainbody" = "This is an email.",
                    "htmlbody" = NA),
               auto_unbox = TRUE)

# Set header.
# Attention: This is not a list, but a function for POST().
# The API_KEY is the Email Parsing API Key obtained from
# https://app.sigparser.com/Account/App#/api
header <- add_headers("content-type" = "application/json",
                      "x-api-key" = "API_KEY",
                      "cache-control" = "no-cache")

# Response from POST with parsed metadata.
response_raw <- POST(url = url, body = body, header)

# Print status code.
print(response_raw$status_code)

# Fully parsed JSON response.
response_parsed <- parse_json(response_raw)

# Print emails.
response_parsed$emails

Objective C

View the Objective C Email Parsing Guide for the complete code sample and model definitions.

NSDictionary *parameters = @{@"subject" : @"mr.John",
                                 @"from_address": @"jsmith@example.com",
                                 @"from_name": @"John Smith",
                                 @"htmlbody": @"description",
                                 @"plainbody": @"This is the body of the email",
                                 @"date": @"Current date"};
    
    NSData *postBodyData = [NSJSONSerialization dataWithJSONObject:parameters options:NSJSONWritingPrettyPrinted error:nil];


    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
    [request setURL:[NSURL URLWithString:@"https://api.sigparser.com/api/Email"]];
    [request setHTTPMethod:@"POST"];
    [request addValue:@"p1rrIkuP6v6famS623AGs1hA8MpBJ13b6VeMNkmz" forHTTPHeaderField:@"x-api-key"];
    [request addValue:@"no-cache" forHTTPHeaderField:@"cache-control"];
    [request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    [request setHTTPBody:postBodyData];
    
    NSURLSession *session = [NSURLSession sharedSession];
    
    NSURLSessionDataTask *task = [session dataTaskWithRequest:request
                                            completionHandler:^(NSData * _Nullable data,
                                                                NSURLResponse * _Nullable response,
                                                                NSError * _Nullable error) {
                                                
                                                NSHTTPURLResponse *asHTTPResponse = (NSHTTPURLResponse *) response;
                                                NSLog(@"The response is: %@", asHTTPResponse);
                                                
                                                Model *model = [self createModel:data]; // got object model, here you can use it
                                            }];
    [task resume];

Swift

View the Swift Email Parsing Guide for the full example and model definitions.

guard let url = URL(string: "https://api.sigparser.com/api/Email") else { return }
    
    let parameters = ["subject" : "mr.John",
                        "from_address" : "jsmith@example.com",
                        "from_name" : "John Smith",
                        "htmlbody" : "description",
                        "plainbody" : "This is the body of the email",
                        "date" : "Current date"] as [String : String]
    
    var urlRequest = URLRequest(url: url)
    urlRequest.httpMethod = "POST"
    
    urlRequest.setValue("no-cache", forHTTPHeaderField:"cache-control")
    urlRequest.addValue("p1rrIkuP6v6famS623AGs1hA8MpBJ13b6VeMNkmz", forHTTPHeaderField: "x-api-key")
    urlRequest.addValue("application/json", forHTTPHeaderField:"Content-Type")

    guard let httpBody = try? JSONSerialization.data(withJSONObject: parameters, options: []) else { return }
    urlRequest.httpBody = httpBody
    
    let session  = URLSession.shared
    session.dataTask(with: urlRequest) { (data, response, error) in
        if let response = response {
            print(response)
        }
        
        guard let data = data,
            let model = self.getModelMap(data: data) else { return } // got object model, here you can use it
        }.resume()

Get Your API Key

Try the SigParser API. Signup and get an API key with 1,500 free emails per month. Upgrade or downgrade at any time. Our API is entirely serverless and stateless.
Get Your API Key Now!