StopBounceAI

Code Examples

Copy-paste integration examples for every endpoint across common languages and environments.

Discover with AI
REST over HTTP
All examples use the REST API directly - standard JSON over HTTPS. No SDK required. Pick the language that fits your stack.

Bulk Email Verification

Submit a list of emails for async verification. Poll the job status endpoint or use a webhook to get results.

cURL

bash
curl -X POST "https://api.stopbounceai.com/v1/bulk" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"emails":["alex@example.com","test@example.org"]}'

Node.js (fetch)

javascript
const res = await fetch("https://api.stopbounceai.com/v1/bulk", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ emails: ["alex@example.com", "test@example.org"] }),
});
const { job_id } = await res.json();
// Poll GET /v1/bulk/:job_id/status until status === "completed"

Python (requests)

python
import requests

r = requests.post(
    "https://api.stopbounceai.com/v1/bulk",
    json={"emails": ["alex@example.com", "test@example.org"]},
    headers={"Authorization": "Bearer YOUR_API_KEY"},
)
job_id = r.json()["job_id"]
# Poll GET /v1/bulk/{job_id}/status until status == "completed"

PHP (cURL)

bash
<?php
$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL            => "https://api.stopbounceai.com/v1/bulk",
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        "Authorization: Bearer YOUR_API_KEY",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode(["emails" => ["alex@example.com"]]),
]);
$response = json_decode(curl_exec($ch), true);
echo $response["job_id"];

Go

bash
body, _ := json.Marshal(map[string]interface{}{
    "emails": []string{"alex@example.com"},
})
req, _ := http.NewRequest("POST",
    "https://api.stopbounceai.com/v1/bulk", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")

resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()

var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result["job_id"])

Email Finder

Find a professional's email address using their name and company domain.

cURL

bash
curl -X GET "https://api.stopbounceai.com/v1/find?name=Alex+Chen&domain=example.com" \
  -H "Authorization: Bearer YOUR_API_KEY"

Node.js (fetch)

javascript
const params = new URLSearchParams({ name: "Alex Chen", domain: "example.com" });
const res = await fetch(
  `https://api.stopbounceai.com/v1/find?${params}`,
  { headers: { Authorization: "Bearer YOUR_API_KEY" } }
);
const { email, score } = await res.json();
// email      → "alex.chen@example.com"
// score      → 91 (0–100)
console.log(email, score);

Python

python
import requests

r = requests.get(
    "https://api.stopbounceai.com/v1/find",
    params={"name": "Alex Chen", "domain": "example.com"},
    headers={"Authorization": "Bearer YOUR_API_KEY"},
)
data = r.json()
print(data["email"])       # alex.chen@example.com
print(data["score"])    # 91

Bulk Verification

Submit a list of emails for asynchronous verification. Poll the job endpoint or use webhooks to be notified when done.

Step 1 - Create a job

bash
curl -X POST "https://api.stopbounceai.com/v1/bulk" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Q4 Campaign","emails":["alex@example.com","jane@example.com"]}'

Step 2 - Poll for completion

javascript
async function waitForJob(jobId) {
  while (true) {
    const res = await fetch(`https://api.stopbounceai.com/v1/bulk/${jobId}`, {
      headers: { Authorization: "Bearer YOUR_API_KEY" },
    });
    const job = await res.json();
    if (job.status === "completed") return job;
    if (job.status === "failed")    throw new Error("Job failed");
    await new Promise((r) => setTimeout(r, 30000)); // poll every 30s
  }
}

const job = await waitForJob("job_abc123");
console.log(job.valid, job.invalid, job.unknown);

Response schema

javascript
{
  "job_id": "J1717000000000",
  "status": "completed",
  "stats": {
    "total": 1000,
    "VALID": 870,
    "INVALID": 90,
    "CATCH_ALL": 25,
    "UNKNOWN": 7,
    "DO_NOT_MAIL": 5,
    "SPAMTRAP": 2,
    "ABUSE": 1,
    "duplicate": 4,
    "score": 87
  },
  "pagination": {
    "page": 0,
    "limit": 1000,
    "total": 1000,
    "total_pages": 1,
    "has_more": false
  },
  "results": [
    {
      "Email": "alex@example.com",
      "SB_Status": "VALID",
      "SB_Sub-Status": "valid",
      "SB_Deliverability": "High",
      "SB_Score": 98,
      "SB_Account": "alex",
      "SB_Domain": "example.com",
      "SB_Catch-All_Domain": "FALSE",
      "SB_First_Name": "Alex",
      "SB_Last_Name": "",
      "SB_Free_Email": "FALSE",
      "SB_Role_Based": "FALSE",
      "SB_MX_Found": "TRUE",
      "SB_MX_Record": "mail.example.com",
      "SB_SMTP_Provider": "mail.example.com"
    }
  ]
}
Webhook alternative
Instead of polling, configure a webhook URL in your dashboard. We'll POST the completed job payload to your endpoint the moment processing finishes. See Webhooks for setup details.