TypeScript SDK
The SignalStack TypeScript SDK provides a fully typed, promise-based client for all verification endpoints. Supports both ESM and CommonJS, runs on Node.js 18+, Bun, and Deno.
Installation
Code
npm install @signalstack/sdk
# yarn
yarn add @signalstack/sdk
# pnpm
pnpm add @signalstack/sdk
# bun
bun add @signalstack/sdkClient initialization
Code
import { SignalStack } from "@signalstack/sdk"
// Using environment variable
const client = new SignalStack()
{`// Explicit API key
const client = new SignalStack({
apiKey: process.env.SIGNALSTACK_API_KEY!,
timeout: 30_000,
maxRetries: 3,
baseUrl: "https://signal-stack-ten.vercel.app/v1",
})`}Verify a business
Code
const result = await client.verify.business({
companyName: "Acme Corp",
jurisdiction: "us_de",
officers: true,
filings: true,
})
console.log(result.status) // "active"
console.log(result.trustScore) // 0.94
console.log(result.officers)
// [{ name: "John Doe", role: "CEO", appointedOn: "2015-03-12" }]Analyze a document
Code
import { DocumentSource } from "@signalstack/sdk"
const result = await client.verify.document({
source: DocumentSource.URL,
content: "https://example.com/report.pdf",
checkDeepfakes: true,
})
console.log(result.aiGeneratedProbability) // 0.87
console.log(result.manipulationFlags)
// ["ai_generated_text", "metadata_stripped"]Verify media provenance
Code
const result = await client.verify.media({
url: "https://example.com/photo.jpg",
checkDeepfakes: true,
})
console.log(result.authenticity) // "manipulated"
console.log(result.deepfakeScore) // 0.94
console.log(result.provenanceSource) // "https://original-source.com/photo.jpg"Verify a claim
Code
const result = await client.verify.claim({
claim: "Water boils at 100°C at sea level",
sources: ["web", "wikipedia", "semantic_scholar"],
})
console.log(result.verdict) // "true"
console.log(result.trustScore) // 0.97
for (const evidence of result.evidence) {
console.log(`[${evidence.source}] ${evidence.snippet}`)
}Error handling
Code
import {
SignalStack,
RateLimitError,
AuthenticationError,
ValidationError,
ServerError,
} from "@signalstack/sdk"
try {
const result = await client.verify.claim({ claim: "..." })
} catch (err) {
if (err instanceof RateLimitError) {
console.log(`Retry after ${err.retryAfter}s`)
} else if (err instanceof AuthenticationError) {
console.log("Check API key")
} else if (err instanceof ValidationError) {
console.log(`Validation: ${err.details}`)
} else if (err instanceof ServerError) {
console.log(`Server error: ${err.status}`)
}
}Configuration
| Option | Default | Description |
|---|---|---|
apiKey | SIGNALSTACK_API_KEY env var | Your API key |
timeout | 30000 | Request timeout in milliseconds |
maxRetries | 3 | Max retries for 429/5xx responses |
baseUrl | https://signal-stack-ten.vercel.app/v1 | API base URL |
Type exports
Code
import type {
SignalStackConfig,
VerifyBusinessOptions,
VerifyBusinessResponse,
VerifyDocumentOptions,
VerifyDocumentResponse,
VerifyMediaOptions,
VerifyMediaResponse,
VerifyClaimOptions,
VerifyClaimResponse,
EvidenceItem,
TrustDimensions,
Verdict,
Authenticity,
DocumentSource,
ManipulationFlag,
} from "@signalstack/sdk"