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

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="https://gtmrouter.io/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.2.tar.gz (7.2 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.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gtm_router-1.0.2.tar.gz
  • Upload date:
  • Size: 7.2 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.2.tar.gz
Algorithm Hash digest
SHA256 e1e4d2bcb0f2fff4c4d07d5da2f5e1bb9257f6a1add8d3021fe952f3feb30fd3
MD5 15daf7fb92a13a55719bc1dfcf33d211
BLAKE2b-256 36353fe65c9500777a5ee31f485a21e9c1f5008c4e9bf174a754dcf8d0cf0128

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gtm_router-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 282b40f94d25bdf4e91ea4739d267487614d50786ecc070dad860c7e1eaa0436
MD5 d50dfcea75ada917cd86a9d71500df80
BLAKE2b-256 913611d7dae2361fb5d14d62e6a4fa9a05b71d14a5d48fd1a4e85bd90c2b6244

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