All samples read the API key from the ITMS_API_KEY environment variable — never hard-code keys, and use a sandbox key (itms_test_…) while developing. Runnable copies live in the repo under docs/api-samples/.
cURL
curl -X POST https://prophit.ai/api/v1/tax/calculate \
-H "Authorization: Bearer itms_test_YOUR_SANDBOX_KEY" \
-H "Content-Type: application/json" \
-d '{
"transaction_date": "2026-07-15",
"nexus_mode": "reference",
"ship_to": {
"line1": "350 5th Ave",
"city": "New York",
"state": "NY",
"zip_code": "10118"
},
"lines": [
{ "number": 1, "amount": "100.00", "quantity": 1, "tax_code": "TAXABLE", "description": "Tangible personal property test item" }
]
}'JavaScript (fetch)
const response = await fetch("https://prophit.ai/api/v1/tax/calculate", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.ITMS_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
transaction_date: "2026-07-15",
nexus_mode: "reference",
ship_to: { line1: "350 5th Ave", city: "New York", state: "NY", zip_code: "10118" },
lines: [{ number: 1, amount: "100.00", quantity: 1, tax_code: "TAXABLE", description: "Tangible personal property test item" }],
}),
});
const result = await response.json();
console.log(result.total_tax, result.lines[0].jurisdiction);Python (requests)
import os, requests
response = requests.post(
"https://prophit.ai/api/v1/tax/calculate",
headers={"Authorization": f"Bearer {os.environ['ITMS_API_KEY']}"},
json={
"transaction_date": "2026-07-15",
"nexus_mode": "reference",
"ship_to": {"line1": "350 5th Ave", "city": "New York", "state": "NY", "zip_code": "10118"},
"lines": [{"number": 1, "amount": "100.00", "quantity": 1, "tax_code": "TAXABLE", "description": "Tangible personal property test item"}],
},
timeout=10,
)
response.raise_for_status()
result = response.json()
print(result["total_tax"], result["lines"][0]["jurisdiction"])Node client helper
A minimal helper covering calculate, create, void, and refund — copy and adapt; not a published SDK:
// Minimal ITMS API client helper (Node 18+). Not a published SDK — copy and adapt.
export class ItmsClient {
constructor({ apiKey = process.env.ITMS_API_KEY, baseUrl = "https://prophit.ai" } = {}) {
if (!apiKey) throw new Error("ITMS API key required");
this.apiKey = apiKey;
this.baseUrl = baseUrl;
}
async #req(method, path, body) {
const res = await fetch(`${this.baseUrl}${path}`, {
method,
headers: { Authorization: `Bearer ${this.apiKey}`, "Content-Type": "application/json" },
body: body === undefined ? undefined : JSON.stringify(body),
});
const payload = await res.json();
if (!res.ok) throw Object.assign(new Error(payload.error?.message), { code: payload.error?.code });
return payload;
}
calculate(body) { return this.#req("POST", "/api/v1/tax/calculate", body); }
createTransaction(body) { return this.#req("POST", "/api/v1/transactions", body); }
voidTransaction(code, reason) { return this.#req("POST", `/api/v1/transactions/${code}/void`, reason ? { reason } : {}); }
refundTransaction(code, body) { return this.#req("POST", `/api/v1/transactions/${code}/refund`, body); }
}Webhook verification
# Verify an ITMS webhook signature (X-ITMS-Signature: t=<ts>,v1=<hmac>)
import hashlib, hmac, time
def verify(secret: str, body: bytes, header: str, tolerance=300) -> bool:
parts = dict(item.split("=", 1) for item in header.split(","))
ts = int(parts["t"])
expected = hmac.new(secret.encode(), f"{ts}.".encode() + body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts["v1"]) and abs(time.time() - ts) <= toleranceService-provider samples
The service-provider portfolio guide includes complete cURL examples for canonical client onboarding, client-scoped calculations, and 5,000-item return jobs. Import the service-provider Postman collection for an executable workflow that captures and reuses the correct client context automatically.
