Skip to main content

Official Python SDK for the GTM Router API — email enrichment, phone finding, bulk operations, and more.

Project description

GTM Router Python SDK

Official Python client for the GTM Router API — email enrichment, phone finding, bulk operations, and more.

Installation

pip install gtm-router

Local development (from this repo):

pip install -e packages/python-sdk

Quick Start

from gtm_router import GTMRouter

client = GTMRouter()  # reads GTM_ROUTER_API_KEY from env

# Find a single email
result = client.email.find(
    first_name="John",
    last_name="Doe",
    domain="acme.com"
)
print(result)

# Bulk email enrichment (auto-polls until done, fetches all results)
job = client.bulk.email_find(
    records=[
        {"first_name": "John", "last_name": "Doe", "domain": "acme.com"},
        {"first_name": "Jane", "last_name": "Smith", "domain": "example.com"},
    ],
    mode="fastest"
)

print(f"Status: {job.status}")
print(f"Total: {job.total_records}, Found: {job.completed_records}")

for r in job.results:
    output = r.get("output") or {}
    if r["status"] == "success" and output.get("found"):
        print(f"  {output['email']}")

Configuration

client = GTMRouter(
    api_key="sk_live_xxx",              # or set GTM_ROUTER_API_KEY env var
    base_url="http://localhost:3000/api/v1",  # or set GTM_ROUTER_API_URL env var
    timeout=30,                         # request timeout in seconds
    max_retries=2,                      # retry count for 5xx / connection errors
    poll_interval=3.0,                  # seconds between poll requests
    poll_timeout=300.0,                 # max seconds to wait for job completion
)

Resources

client.email

  • find(first_name, last_name, domain, mode="fastest", verify=False)
  • verify(email, mode="fastest")

client.phone

  • find(email=None, linkedin_url=None, first_name=None, last_name=None, domain=None, mode="fastest")

client.bulk

  • email_find(records, mode="fastest") — returns BulkJob with .results
  • email_verify(records, mode="fastest") — returns BulkJob with .results
  • phone_find(records, mode="fastest") — returns BulkJob with .results
  • get(job_id) — get job status
  • get_results(job_id, limit=100, offset=0) — paginated results
  • cancel(job_id) — cancel a running job
  • list(status=None, limit=20, offset=0) — list all jobs

client.account

  • get() — account info and balance

Error Handling

from gtm_router import GTMRouter, GTMRouterError, RateLimitError, InsufficientBalanceError

client = GTMRouter()

try:
    job = client.bulk.email_find(records=records, mode="fastest")
except RateLimitError as e:
    print(f"Rate limited, retry after {e.retry_after}s")
except InsufficientBalanceError:
    print("Not enough credits")
except GTMRouterError as e:
    print(f"API error: {e.code}{e.message}")

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

gtm_router-1.0.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

gtm_router-1.0.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file gtm_router-1.0.0.tar.gz.

File metadata

  • Download URL: gtm_router-1.0.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for gtm_router-1.0.0.tar.gz
Algorithm Hash digest
SHA256 62a94f0f7e29eeae63f86c02a01ca27371e386af1256aa9b47ba5dba1efc0be4
MD5 f8ab19fcf1c0e0feda93a434cf34f955
BLAKE2b-256 d3d5dc39cab8284c1e8a64108ffe39c54e70eefbe3a3ab1b9023c718d239400e

See more details on using hashes here.

File details

Details for the file gtm_router-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: gtm_router-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for gtm_router-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6cd96e0c4d2842b4385e0f8c7cde6c16800318f2a4eb0369b2a109c5dbd213da
MD5 0ac8fa84577deebcad14ecc6f298be0d
BLAKE2b-256 bef7d01262067e66f107595a35cbb2cd988a69677f46efe12be6f69b713a8e05

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