# IDRabbit — Extended Technical Specification (llms-full.txt) > Comprehensive engineering reference for AI agents integrating IDRabbit's offline pixel forensics, strict 21+ age-gating, hosted remote capture sessions, XSCORE™ underwriting, and HMAC-SHA256 webhooks. ## 1. Architectural Overview Legacy KYC brokers proxy identity checks through external credit-header and state DMV bureaus, causing 15-45s latency spikes, regional outages, thin-file rejections, and $1.50+ per-check markups. IDRabbit verifies the physical document and live holder directly in <1.8s P95 using a 6-stage computer vision and cryptographic pipeline: 1. **Binary Magic-Byte & Decompression-Bomb Hygiene**: Validates raw file magic headers (JPEG, PNG, WebP, PDF), enforces a 15 MB upload limit and 64,000,000-pixel ceiling (`Image.MAX_IMAGE_PIXELS = 64_000_000`), scans text for prohibited markers (`SAMPLE`, `SPECIMEN`, `VOID`, `REPLICA`, `NOVELTY ID`), and inspects EXIF `Software` / `ProcessingSoftware` / `HostComputer` tags for `photoshop`, `gimp`, `canva`, `lightroom`, `midjourney`, `dall-e`, `stable diffusion`, and `comfyui`. 2. **Dual-Pipeline OCR + AWS AnalyzeID + AAMVA PDF417**: 2x bicubic upscale raced across CLAHE (`clipLimit=2.0, tileGridSize=(8,8)`) and Adaptive Gaussian Thresholding + Non-Local Means Denoising, reconciled against AWS Textract AnalyzeID and back-of-card PDF417 barcode payloads. 3. **Portrait ROI & Biometric Face Match**: Confirms a physical face portrait exists on the ID surface (-100 pts if missing) and compares facial embeddings against `selfie_image` (-70 pts on mismatch). 4. **Error Level Analysis (ELA)**: Resizes high-res inputs to max 1600px (`INTER_AREA`), re-encodes JPEG at `Q=95`, and computes `mean(|I - I_95|)` in grayscale. Mean residuals `> 14.0` trigger a digital splice anomaly (-70 pts). 5. **2D Fast Fourier Transform (FFT) Screen Moiré Detection**: Computes `20 * log10(|fftshift(fft2(gray))| + 1)` on a 1024px normalized frame, masks the low-frequency DC core (`r = max(8, 0.12 * min(H,W))`) and horizontal/vertical cardinal text axes (`cy +- 4, cx +- 4`), and flags screen replays when `z_max > 6.5` and `count(off_axis > mean + 6*std) >= 10` (-100 pts). 6. **Deterministic RiskEngine (0-100)**: - `TRUSTED`: Score `>= 85` - `REVIEW`: Score `65 - 84` - `REJECT`: Score `< 65` (or `require_21_plus=true` when chronological age `< 21`). --- ## 2. Authentication & Headers - **Base URL**: `https://api.idrabbit.com/api/v1` - **API Key Header**: `X-API-KEY: sk_live_` (production metered) or `X-API-KEY: sk_test_` ($0 sandbox). - **Idempotency**: `Idempotency-Key: ` prevents duplicate execution/billing on network timeouts. --- ## 3. Core Endpoints ### 3.1 Verify Government ID (`POST /api/v1/verification/verify/id`) `Content-Type: multipart/form-data` - `front_image` (File, required): Front of government ID. - `back_image` (File, optional): Back of ID card (PDF417 barcode). - `selfie_image` (File, optional): Live selfie for biometric matching. - `expected_name` (Form string, optional): Fuzzy match against extracted legal name. - `expected_dob` (Form string, optional): Fuzzy match against extracted DOB (`YYYY-MM-DD`). - `require_21_plus` (Form boolean, default `false`): Rejects if age `< 21`. Example `VerificationResponse`: ```json { "is_valid": true, "verification_id": "ver_01J9ZR8K4M2P", "processed_at": "2026-11-15T15:20:04Z", "forensics": [ { "check_name": "Digital Modification Check (ELA)", "passed": true, "confidence": 0.93, "details": "ELA variance 2.40 (Compression profile consistent.)" }, { "check_name": "Re-Capture Detection", "passed": true, "confidence": 0.8, "details": "No screen pixel-grid artifacts detected." } ], "extracted_data": { "first_name": "ELENA", "last_name": "ROSTOVA", "date_of_birth": "1999-08-14", "address": "742 EVERGREEN TER", "document_number": "D8492017", "expiration_date": "2029-08-14" }, "risk_analysis": { "score": 98, "rating": "TRUSTED", "age": 26, "flags": [] } } ``` ### 3.2 Create Hosted Remote Session (`POST /api/v1/remote/create`) `Content-Type: application/json` ```json { "expected_name": "Elena Rostova", "expected_address": "742 Evergreen Ter", "expected_dob": "1999-08-14", "webhook_url": "https://merchant.example/webhooks/idrabbit", "redirect_url": "https://merchant.example/onboarding/complete", "expires_in_minutes": 15, "session_type": "xscore", "require_21_plus": true } ``` Returns `request_id` (`rvs_...`) and `verification_url` (`https://app.idrabbit.com/verify/rvs_...`). ### 3.3 XSCORE™ Applicant Qualification (`POST /api/v1/xscore/init`) Combines: - **Identity (35%)**: `0.70 * id_confidence + 0.30 * avg_cross_doc_name_similarity * 100` - **Income / Financial Stability (40%)**: Rejects bank statements/pay stubs where `name_similarity < 0.60`; awards `60 + min(40, 10 * income_events)` for `DEPOSIT`, `PAYROLL`, `CREDIT` lines `> $100`. - **Residence (25%)**: Matches `applicant_address` against `utility_bill`, `rent_agreement`, or `lease` documents. --- ## 4. Webhook HMAC-SHA256 Verification Every outbound webhook includes: - `X-Rabbit-Signature: t=,v1=` - `User-Agent: IDRabbit-Webhook/1.0` Signed string construction: `to_sign = f"{timestamp}.{raw_json_body}"` `v1 = HMAC_SHA256(webhook_secret, to_sign).hexdigest()` Always verify `abs(now - timestamp) <= 300` and compare digests using `crypto.timingSafeEqual` (Node.js) or `hmac.compare_digest` (Python). --- ## 5. Security, Zero-PII & Pricing - **Encryption**: AWS KMS AES-256-GCM envelope encryption at rest, TLS 1.3 in transit. - **Zero-PII Retention Modes**: `0m` (volatile RAM-only, BIPA/GDPR optimal), `24h` (analyst quarantine), `30d` (underwriting archive). - **SSRF Protection**: `validate_webhook_url()` blocks private RFC1918 IPs, loopback, link-local `169.254.169.254`, and disables HTTP redirects (`follow_redirects=False`). - **Pricing**: - Sandbox (`sk_test_`): `$0.00` - Direct API (`/verify/id`): `$0.15` / check (`$0.11` at 100k/mo, `$0.08` at 250k+/mo) - Hosted Remote Session / XSCORE™: `$0.20` / session (`$0.15` at 100k/mo, `$0.11` at 250k+/mo) - Monthly Minimums / Seat Fees: `$0.00`