Extracta.ai
DashboardJoin Discord
  • extracta.ai
    • Introduction
    • Overview
  • API Reference
    • 🔓Authentication
    • 📁Supported File Types
  • Data Extraction - API
    • 💻API Endpoints - Data Extraction
      • 1. Create extraction
      • 2. View extraction
      • 3. Update extraction
      • 4. Delete extraction
      • 5. Upload Files
      • 6. Get results
    • Extraction Details
      • 🌎Supported Languages
      • ⚙️Options
      • 📋Fields
    • Receiving Batch Results
      • Polling vs Webhook
      • How to use the Webhook
    • 🕹️Postman Integration
  • Document Classification - API
    • 💻API Endpoints - Document Classification
      • 1. Create classification
      • 2. View classification
      • 3. Update classification
      • 4. Delete data
        • 4.1 Delete classification
        • 4.2 Delete batch
        • 4.3 Delete files
      • 5. Upload Files
      • 6. Get results
    • Classification Details
      • 📄Document Types
  • Documents
    • Custom Document
    • Resume / CV
    • Contract
    • Business Card
    • Email
    • Invoice
    • Receipt
    • Bank Statement
  • Support
    • 💁Tutorials
    • 🟢API Status
  • Contact
    • 📧Contact Us
    • ❓FAQ
Powered by GitBook
On this page
  • Why Extracta.ai for Email Parsing?
  • Getting Started
  • Body Example for Email
  • How to Implement
  • Code Example
  • Maximize Your Data Potential

Was this helpful?

  1. Documents

Email

PreviousBusiness CardNextInvoice

Last updated 1 year ago

Was this helpful?

Extracta.ai revolutionizes the way businesses handle email data through our Email Parsing API. By automating the extraction of text, attachments, and other relevant information from emails, we empower businesses to streamline their workflows, improve data management, and enhance business intelligence. This guide provides you with the essentials for integrating email parsing into your applications using our API.

Why Extracta.ai for Email Parsing?

  • Comprehensive Data Extraction: From body text to attachments, capture every piece of valuable information.

  • High Precision: Benefit from Extracta.ai’s advanced OCR and text processing technologies for accurate data extraction.

  • Custom Workflows: Easily integrate extracted data into your CRM, database, or custom workflow for immediate use.

Getting Started

Integrating email parsing into your system starts with a simple POST request to our /createExtraction endpoint, utilizing a request body designed for email data. Below, we provide a JSON template tailored for email parsing, highlighting the key information segments typically extracted from emails.

Body Example for Email

JSON Body
{
    "extractionDetails": {
        "name": "Email Data Extraction",
        "language": "English",
        "fields": [
            {
                "key": "email_info",
                "type": "object",
                "properties": [
                    {
                        "key": "Subject Line",
                        "description": "The subject of the email"
                    },
                    {
                        "key": "Email Date",
                        "description": "The date the email was sent",
                        "example": "February 20, 2024"
                    }
                ]
            },
            {
                "key": "sender_info",
                "type": "object",
                "properties": [
                    {
                        "key": "Sender Name",
                        "description": "The name of the person who sent the email"
                    },
                    {
                        "key": "Sender Email",
                        "description": "The email address of the sender"
                    },
                    {
                        "key": "Sender's Position",
                        "description": "The job title of the sender",
                        "example": "Project Manager"
                    },
                    {
                        "key": "Sender's Contact Number",
                        "description": "The phone number of the sender"
                    }
                ]
            },
            {
                "key": "recipient",
                "type": "object",
                "properties": [
                    {
                        "key": "Recipient Name",
                        "description": "The name of the email's recipient"
                    },
                    {
                        "key": "Recipient Email",
                        "description": "The email address of the recipient"
                    }
                ]
            },
            {
                "key": "cc",
                "description": "Carbon copy recipients of the email",
                "type": "array",
                "items": {
                    "type": "string",
                    "example": "test@gmail.com"
                }
            },
            {
                "key": "bcc",
                "description": "Blind carbon copy recipients of the email",
                "type": "array",
                "items": {
                    "type": "string",
                    "example": "test@gmail.com"
                }
            },
            {
                "key": "meeting_info",
                "description": "Information about the meeting",
                "type": "object",
                "properties": [
                    {
                        "key": "Meeting Date",
                        "example": "February 25, 2024"
                    },
                    {
                        "key": "Meeting Time",
                        "example": "10:00 AM"
                    },
                    {
                        "key": "Meeting Location",
                        "example": "Bucharest, Romania"
                    }
                ]
            },
            {
                "key": "project_name",
                "description": "The name of the project being discussed"
            },
            {
                "key": "proposal_equirements",
                "description": "Specific requirements or topics requested in the proposal",
                "type": "array",
                "items": {
                    "type": "string",
                    "example": "Integration of AI technologies"
                }
            }
        ]
    }
}

How to Implement

  1. API Key Generation: First, sign up at and create an API key on the /api page.

  2. API Request: Use the JSON template in a POST request to /createExtraction, including your API key in the header for authentication.

  3. Data Integration: The API's response will contain structured data extracted from the email, ready for integration into your system.

Code Example

const axios = require('axios');

/**
 * Initiates a new document extraction process with the provided details.
 * 
 * @param {string} token - The authorization token for API access.
 * @param {Object} extractionDetails - The details of the extraction to be created.
 * @returns {Promise<Object>} The promise that resolves to the API response with the new extraction ID.
 */
async function createExtraction(token, extractionDetails) {
    const url = "https://api.extracta.ai/api/v1/createExtraction";

    try {
        const response = await axios.post(url, {
            extractionDetails
        }, {
            headers: {
                'Content-Type': 'application/json',
                'Authorization': `Bearer ${token}`
            }
        });

        // Handling response
        return response.data; // Directly return the parsed JSON response
    } catch (error) {
        // Handling errors
        throw error.response ? error.response.data : new Error('An unknown error occurred');
    }
}

async function main() {
    const token = 'apiKey';
    const extractionDetails = {}; // the json body from the example

    try {
        const response = await createExtraction(token, extractionDetails);
        console.log("New Extraction Created:", response);
    } catch (error) {
        console.error("Failed to create new extraction:", error);
    }
}

main();
import requests


def create_extraction(token, extraction_details):
    url = "https://api.extracta.ai/api/v1/createExtraction"
    headers = {"Content-Type": "application/json", "Authorization": f"Bearer {token}"}

    try:
        response = requests.post(url, json=extraction_details, headers=headers)
        response.raise_for_status()  # Raises an HTTPError if the response status code is 4XX/5XX
        return response.json()  # Returns the parsed JSON response
    except requests.RequestException as e:
        # Handles any requests-related errors
        print(e)
        return None


# Example usage
if __name__ == "__main__":
    token = "apiKey"
    extraction_details = {} # the json body from the example

    response = create_extraction(token, extraction_details)
    print("New Extraction Created:", response)

Maximize Your Data Potential

With Extracta.ai, transforming unstructured email data into actionable insights has never been easier. Our Email Parsing API is a powerful tool for businesses looking to automate data extraction from emails for CRM updates, database enrichment, batch processing, or business intelligence analysis.

Explore further details on our API’s capabilities by visiting our API Endpoints - Data Extraction and our 1. Create extraction pages.

https://app.extracta.ai