Node.js / TypeScript
Recommended for Next.js, serverless functions, and edge workers. Wrap fetch to /api/gateway/event with your org secret and asset IDs.
import { submitGatewayEvent } from "@intertrace/node-sdk"; // coming soon
// Today: direct fetch
await fetch(process.env.INTERTRACE_BASE_URL + "/api/gateway/event", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer " + process.env.INTERTRACE_API_KEY,
},
body: JSON.stringify({
assetId: "...",
prompt: { text: "..." },
metadata: { source: "app-server" },
}),
});Python
Ideal for data pipelines, LangChain-style agents, and batch scanners. Use httpx or requests with the same JSON payloads as the dashboard examples.
import os, httpx
r = httpx.post(
f"{os.environ['INTERTRACE_BASE_URL']}/api/gateway/event",
headers={
"Authorization": f"Bearer {os.environ['INTERTRACE_API_KEY']}",
},
json={"assetId": "...", "prompt": {"text": "..."}},
timeout=10.0,
)
r.raise_for_status()Environment variables
INTERTRACE_BASE_URL— Origin of your deployment (no trailing slash).INTERTRACE_API_KEY— Key from the dashboard; rotate regularly.INTERTRACE_ASSET_ID— Default asset UUID for quick integrations.
cURL
Every endpoint in the API reference can be exercised with curl for debugging and CI smoke tests.
curl -sS -X POST "$INTERTRACE_BASE_URL/api/gateway/event" \
-H "Authorization: Bearer $INTERTRACE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"assetId":"...","prompt":{"text":"hello"}}'Published npm/PyPI packages will ship with retries, batching, and type-safe payloads. Until then, the patterns above match what the dashboard and API reference expect.