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.1.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.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gtm_router-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 f5d5a5da7ffe461a3fe019688527a34d762fc2d18157edc9c4ff3ae8570a957c
MD5 6f36ea230bd830318562ca8958ee2ba3
BLAKE2b-256 59f5798e1c627fcda3fb28972f875e68dfc21165cbdd9d668786ccdcbca7af78

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gtm_router-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3e515f900013f9f3213e0d7ef0c8fcc720a7ec9ba4fa4b034b64ce3e4a1f27dd
MD5 c33ae73c4a449b8edabfa76e82c0de8f
BLAKE2b-256 cbbc0fb1b966f3094686c9db91c0b51669f930ad06201adc9a836137f999b789

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