惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
L
LangChain Blog
爱范儿
爱范儿
博客园_首页
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 三生石上(FineUI控件)
大猫的无限游戏
大猫的无限游戏
宝玉的分享
宝玉的分享
GbyAI
GbyAI
H
Help Net Security
A
About on SuperTechFans
Recent Announcements
Recent Announcements
Hugging Face - Blog
Hugging Face - Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
雷峰网
雷峰网
D
Docker
博客园 - Franky
有赞技术团队
有赞技术团队
G
Google Developers Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
How I Built and Launched a KYC Selfie Verification API in...
hajar balirh · 2026-05-12 · via DEV Community

hajar balirh

I've always wanted to build a product I could sell online.
Last week I did it — a full AI-powered KYC API, live in production,
listed on RapidAPI, with a registration system and usage dashboard.
Here's exactly how I built it.

What is KYC?

KYC (Know Your Customer) is the process of verifying a user's identity.
Every fintech, bank, marketplace, and crypto platform needs it.
Most solutions cost thousands of dollars per month. I built one for free.

What the API does

  • ✅ Face detection and centering check
  • ✅ Liveness detection (real person vs photo of photo)
  • ✅ Age estimation (18+/21+ flags)
  • ✅ Glasses and mask detection
  • ✅ Emotion detection
  • ✅ Background quality check
  • ✅ ID document data extraction (name, DOB, document number)
  • ✅ Selfie vs ID document face matching
  • ✅ Confidence score 0-100

The tech stack

  • FastAPI — Python REST API
  • Gemini Vision via OpenRouter — AI image analysis (free tier)
  • SQLite + SQLAlchemy — database for storing verifications
  • Railway — deployment (free tier)

The API in action

Get a free API key at:
https://kyc-selfie-api-production.up.railway.app/register

Then verify a selfie in Python:

import requests

response = requests.post(
    "https://kyc-selfie-api-production.up.railway.app/v1/verify/selfie",
    headers={"x-api-key": "your-api-key"},
    files={"selfie": open("photo.jpg", "rb")}
)

result = response.json()
print(result)

Response:

{
  "approved": true,
  "confidence": 92,
  "face_detected": true,
  "face_centered": true,
  "eyes_open": true,
  "liveness_score": 95,
  "age_estimate": 26,
  "appears_18_plus": true,
  "glasses_detected": false,
  "mask_detected": false,
  "emotion": "neutral",
  "background_quality": "clean",
  "lighting_quality": "good",
  "issues": []
}

Extract data from an ID document

response = requests.post(
    "https://kyc-selfie-api-production.up.railway.app/v1/verify/document",
    headers={"x-api-key": "your-api-key"},
    files={"document": open("id_card.jpg", "rb")}
)

doc = response.json()
print(f"Name: {doc['full_name']}")
print(f"DOB: {doc['date_of_birth']}")
print(f"Number: {doc['document_number']}")

Full KYC — match selfie against ID

with open("selfie.jpg", "rb") as s, open("id.jpg", "rb") as d:
    response = requests.post(
        "https://kyc-selfie-api-production.up.railway.app/v1/verify/kyc",
        headers={"x-api-key": "your-api-key"},
        files={"selfie": s, "document": d}
    )

result = response.json()
print(f"Match approved: {result['approved']}")
print(f"Confidence: {result['confidence']}%")

Available endpoints

Endpoint Description
POST /v1/verify/selfie Selfie analysis
POST /v1/verify/kyc Selfie + ID matching
POST /v1/verify/document Extract ID data
POST /v1/verify/age Age estimation
GET /v1/status/{id} Check past result
GET /v1/usage Usage stats

Pricing

Plan Price Calls/month
Basic Free 100
Pro $49/mo 10,000
Ultra $99/mo 50,000

What I learned

Building this in one day taught me a few things:

1. AI APIs make everything easier. Instead of training a custom face
detection model, I used Gemini Vision via a simple API call. The prompt
engineering took 10 minutes.

2. FastAPI is incredible. Auto-generated docs at /docs,
type validation, async support — everything just works.

3. Distribution is harder than building. The API took one day.
Getting people to use it is the real challenge.

What's next

  • Arabic and Moroccan CIN support (huge untapped niche)
  • Email notifications when verification completes
  • React SDK for easy frontend integration
  • Video liveness detection

Try it free

🔗 Register: https://kyc-selfie-api-production.up.railway.app/register
🔗 Live demo: https://kyc-selfie-api-production.up.railway.app
🔗 API docs: https://kyc-selfie-api-production.up.railway.app/docs
🔗 RapidAPI: https://rapidapi.com/balirh12/api/kyc-selfie-verification

Free plan — 100 verifications/month, no credit card required.


Built with ❤️ using FastAPI, Gemini Vision, and Railway.
Questions? Drop them in the comments!