Skip to main content

Python bindings for the Encrata email intelligence API

Project description

Encrata Python Library

PyPI version Python License: MIT

The Encrata Python library provides convenient access to the Encrata API from applications written in Python. Look up any person by their email address — get their name, company, job title, social profiles, breach history, and more.

API Documentation

See the Encrata API docs.

Installation

pip install encrata

Requirements

  • Python 3.9+
  • No external dependencies (uses urllib from the standard library)

Usage

The library needs to be configured with your account's API key, available in your Encrata Dashboard.

from encrata import Encrata

client = Encrata("enc_live_...")

Look up a person by email

person = client.lookup("elon@tesla.com")

print(person.name)        # "Elon Musk"
print(person.company)     # "Tesla"
print(person.role)        # "CEO"
print(person.location)    # "Austin, Texas"
print(person.validity)    # "valid"

Each lookup costs 1 credit. Cached results within 24 hours are served from cache.

Select specific fields

Only return the fields you need to minimize response size:

person = client.lookup("satya@microsoft.com", fields=["name", "company", "role", "socials"])

print(person.name)             # "Satya Nadella"
print(person.socials.linkedin) # "https://linkedin.com/in/satyanadella"

Available fields: name, email, company, role, industry, location, bio, age, gender, education, phone, photo, validity, socials, breaches, registered_services, news, publications.

Validate an email address (free)

Check if an email is deliverable without using any credits:

result = client.validate("test@example.com")

print(result.validity)  # "valid", "invalid", "disposable", or "unknown"
print(result.message)   # "Email is deliverable and valid."

Check data breaches (free)

See if an email has been exposed in known data breaches:

report = client.breaches("user@example.com")

print(report.count)         # 3
print(report.services)      # ["Adobe", "LinkedIn", "Dropbox"]
print(report.exposed_data)  # ["email", "password", "username"]

Monitoring

Set up monitors to track changes in email intelligence over time. When a person changes jobs, gets a new title, or appears in a breach — you'll know.

Create a monitor

monitor = client.create_monitor(
    "Sales Leads",
    emails=["ceo@company.com", "cto@startup.io"],
    frequency="weekly",
)

print(monitor.id)           # "mon_abc123..."
print(monitor.email_count)  # 2

List monitors

monitors = client.list_monitors()
for m in monitors:
    print(f"{m.name}: {m.email_count} emails, {m.status}")

Trigger a run

result = client.trigger_run(monitor.id)
print(result["run_id"])   # "run_xyz789..."
print(result["status"])   # "running"

Get run results

runs, total = client.list_runs(monitor.id)
for run in runs:
    print(f"Run {run.id}: {run.changes_detected} changes")

# Get detailed results for a run
snapshots, total = client.get_run_results(monitor.id, runs[0].id, changes_only=True)
for snap in snapshots:
    print(f"{snap.email}: changes={snap.changes}")

List all runs across monitors

all_runs, total = client.list_all_runs(limit=10)
all_results, total = client.list_all_results(changes_only=True)

Contact Lists

Manage reusable email lists that can be used as data sources for monitors.

Create a contact list

contact_list = client.create_contact_list(
    "Engineering Team",
    emails=["alice@company.com", "bob@company.com"],
)
print(contact_list.id)

Manage list emails

# List all contact lists
lists = client.list_contact_lists()

# Add emails
client.add_contact_list_emails(contact_list.id, ["charlie@company.com"])

# List emails in a list
emails = client.list_contact_list_emails(contact_list.id)

# Remove emails
client.delete_contact_list_emails(contact_list.id, ["bob@company.com"])

# Delete the list
client.delete_contact_list(contact_list.id)

Use a list as a monitor source

monitor = client.create_monitor("Team Monitor", list_id=contact_list.id)

Handling exceptions

from encrata import Encrata, AuthenticationError, InsufficientCreditsError

client = Encrata("enc_live_...")

try:
    person = client.lookup("someone@example.com")
except AuthenticationError:
    print("Invalid API key")
except InsufficientCreditsError:
    print("No credits remaining — top up at encrata.com/settings/billing")
Exception Cause
AuthenticationError Invalid or missing API key
InsufficientCreditsError Account has 0 credits remaining
InvalidRequestError Malformed request (e.g. invalid email)
RateLimitError Too many requests
APIConnectionError Network connectivity issue
APIError Unexpected server error

Configuration options

client = Encrata(
    "enc_live_...",
    base_url="https://api.encrata.com",  # default
    timeout=30,                           # request timeout in seconds
)

Force fresh lookup

Bypass the 24-hour cache to get the latest data:

person = client.lookup("elon@tesla.com", nocache=True)

MCP (Model Context Protocol)

Encrata also provides an MCP server for AI agent frameworks like Claude, Cursor, and Windsurf. Add this to your MCP configuration:

{
  "mcpServers": {
    "encrata": {
      "url": "https://api.encrata.com/mcp",
      "headers": {
        "Authorization": "Bearer enc_live_..."
      }
    }
  }
}

Support

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

encrata-0.2.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

encrata-0.2.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file encrata-0.2.0.tar.gz.

File metadata

  • Download URL: encrata-0.2.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for encrata-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3403b11fb7562ca4709b0135fc43deeca63ea344cec9dcea1ace1073e5af5f80
MD5 52025a0539a03dd9d2998ce3e186fa72
BLAKE2b-256 b238f5e6c3225f66bf8efa9a799df8b1ad84a8e758a0d024e0f6975733c3ecdc

See more details on using hashes here.

File details

Details for the file encrata-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: encrata-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for encrata-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 071f2989e5aa996364d5141d161b12cd36453441980abc12d7cf93ef971d510d
MD5 16fac2b366bedf41d22ea8cf1aefa5e3
BLAKE2b-256 7986405d7c2542933463ceef573ae4475d605c8f48dd41d89b3f007e6d3b66bc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page