Cipher SDK

Built to protect your data quality, right from your codebase.

The Cipher SDK lets you validate survey responses, detect fraud, and ensure data quality programmatically.

pnpm add @surbee/cipher

Developer quickstart

Make your first validation in minutes. Install the SDK, add your API key, and score a survey response.

typescript
import { Cipher } from '@surbee/cipher'
const cipher = new Cipher({ apiKey: process.env.CIPHER_API_KEY })
// Score your first survey response
const result = await cipher.validate({
responses: [
{ question: 'Would you recommend us?', answer: 'Yes' },
],
behavioralMetrics: tracker.getMetrics(),
})
console.log(result.score) // 0.94
console.log(result.recommendation) // 'keep'
Core API

Validate any response

Pass survey responses with behavioral metrics. Get instant quality scores, recommendations, and detailed check results.

validate.ts
const result = await cipher.validate({
responses: submission.responses,
behavioralMetrics: tracker.getMetrics(),
})
result.score // 0.94
result.recommendation // 'keep'
Configuration

Tune tiers & thresholds

Pick a validation tier from 1 to 5 and set your own score thresholds for auto-reject and review. Higher tiers add AI-content, VPN, and fraud-ring checks.

config.ts
const cipher = new Cipher({
apiKey: process.env.CIPHER_API_KEY,
tier: 4,
thresholds: { fail: 0.4, review: 0.7 },
})
Advanced

Batch & fraud-ring detection

Validate many responses in one call. Turn on cross-respondent analysis (tier 5) to surface coordinated fraud rings across the whole batch.

batch.ts
const batch = await cipher.validateBatch({
submissions,
crossAnalysis: true, // tier 5
})
batch.summary.avgScore
batch.fraudIndicators?.fraudRingScore
On-device

Run tiers 1–2 offline

No API key, no network. The behavioral, timing, device, and content checks run locally and synchronously. AI-powered checks (tiers 3+) stay server-side.

offline.ts
const cipher = new Cipher({ tier: 2, offline: true })
// synchronous, no await, no key
const result = cipher.validateSync({
responses: submission.responses,
deviceInfo: tracker.getDeviceInfo(),
})

Try the Cipher SDK

Add enterprise-grade fraud detection to your project in one line.

pnpm add @surbee/cipher
Building the standard for surveys you can actually trust.

Transparent, verifiable research, so your team can stand behind every figure.