Skip to content

Basic Usage

This example demonstrates how to interact with the FindMyClient API using Python.

It covers the full asynchronous workflow:

  • Create a search job
  • Poll for completion
  • Retrieve final results

Info

This approach is ideal for automation scripts, backend systems, and AI agent integrations.


Python Example

import time
import requests

BASE_URL = "https://findmyclient.org/api"
API_TOKEN = "YOUR-API-TOKEN"


def search(query: str):
    # Start search job
    response = requests.post(
        f"{BASE_URL}/search",
        params={"query": query, "token": API_TOKEN},
        timeout=30
    )

    response.raise_for_status()
    data = response.json()

    job_id = data["job_id"]
    print(f"Job started: {job_id}")

    # Poll for results
    while True:
        result = requests.get(
            f"{BASE_URL}/result/{job_id}",
            timeout=30
        )

        result.raise_for_status()
        payload = result.json()
        status = payload["status"]

        if status == "completed":
            if payload.get("error"):
                raise Exception(payload["error"])

            return payload["result"]

        print("Still processing...")
        time.sleep(60)


if __name__ == "__main__":
    output = search("singapore cafe")
    print("\nFinal Result:\n")
    print(output)


Start a Search Job

Start a new search job by sending a query to the API. The request is processed asynchronously and returns a job_id that can be used to retrieve results later.

curl -X POST "https://findmyclient.org/api/search" \
  -H "token: YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "singapore cafe"
  }'
import requests

response = requests.post(
    "https://findmyclient.org/api/search",
    headers={"token": "YOUR_API_TOKEN"},
    json={"query": "singapore cafe"}
)

response.json()
Invoke-RestMethod -Method POST `
  -Uri "https://findmyclient.org/api/search" `
  -Headers @{token="YOUR_API_TOKEN"} `
  -Body (@{query="singapore cafe"} | ConvertTo-Json)


Get Results

Retrieve the status and results of a previously submitted search job using its job_id. Once processing is complete, the API returns structured company and contact data in a machine-readable JSON format.

curl -X GET "https://findmyclient.org/api/result/YOUR_JOB_ID"
import requests

response = requests.get(
    "https://findmyclient.org/api/result/YOUR_JOB_ID",
)

response.json()
Invoke-RestMethod -Method GET `
  -Uri "https://findmyclient.org/api/result/YOUR_JOB_ID"


Get Leads

Retrieve enriched lead results for a completed scraping job using its job_id.
This endpoint returns structured lead data including business details, verified emails, confidence scores, and metadata from the enrichment pipeline.

curl -X GET "https://findmyclient.org/api/result/leads/654e0e93-1a14-44d3-97e1-d7fabaf782fd"
import requests

job_id = "654e0e93-1a14-44d3-97e1-d7fabaf782fd"

response = requests.get(
    f"https://findmyclient.org/api/result/leads/{job_id}",
)

print(response.json())
Invoke-RestMethod -Method GET `
  -Uri "https://findmyclient.org/api/result/leads/654e0e93-1a14-44d3-97e1-d7fabaf782fd"



Tips

Search jobs are processed asynchronously. Save the returned job_id and poll the result endpoint until the status becomes completed.