Examples

Copy-paste-ready snippets for common languages and tools.

cURL

cURL
curl https://crossstax.dev/api/v1/leads/recovery \
  -H "Authorization: Bearer $CROSSSTAX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "industry": "roofing",
    "status": "estimate_sent",
    "lead_age_days": 28,
    "estimate_value": 12000,
    "explicit_rejection": false
  }'

Node.js

node.js
// Node 18+ (global fetch)
const res = await fetch("https://crossstax.dev/api/v1/leads/recovery", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.CROSSSTAX_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    industry: "roofing",
    status: "estimate_sent",
    lead_age_days: 28,
    estimate_value: 12000,
  }),
})

if (!res.ok) {
  const { error } = await res.json()
  throw new Error(`${error.code}: ${error.message}`)
}

const result = await res.json()
console.log(result.recovery_score, result.priority)

Python

python
import os, requests

resp = requests.post(
    "https://crossstax.dev/api/v1/leads/recovery",
    headers={"Authorization": f"Bearer {os.environ['CROSSSTAX_API_KEY']}"},
    json={
        "industry": "roofing",
        "status": "estimate_sent",
        "lead_age_days": 28,
        "estimate_value": 12000,
    },
    timeout=15,
)
resp.raise_for_status()
data = resp.json()
print(data["recovery_score"], data["priority"])

TypeScript SDK

The lightweight SDK wraps the same endpoints with typed helpers.

typescript
import { CrossStax } from "@crossstax/sdk"

const crossstax = new CrossStax({ apiKey: process.env.CROSSSTAX_API_KEY })

const result = await crossstax.leads.recovery({
  industry: "roofing",
  status: "estimate_sent",
  estimateValue: 12000,
  leadAgeDays: 28,
})

console.log(result.recovery_score, result.priority)

Batch

cURL
curl https://crossstax.dev/api/v1/leads/recovery/batch \
  -H "Authorization: Bearer $CROSSSTAX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "leads": [
      { "industry": "hvac", "status": "no_response", "lead_age_days": 190 },
      { "industry": "roofing", "status": "estimate_sent", "lead_age_days": 28, "estimate_value": 12000 }
    ]
  }'