Serverless Identity Verification: Integrating Didit
Learn how to seamlessly integrate Didit's identity verification platform with serverless functions like AWS Lambda for scalable and cost-effective identity solutions.

Contents
In this guide
Jump to the part you need.
Serverless Identity Verification: Integrating Didit
In today’s rapidly evolving digital landscape, robust and scalable identity verification is crucial. Combining this need with the benefits of serverless architecture – cost efficiency, automatic scaling, and reduced operational overhead – is a powerful combination. This guide outlines how to integrate Didit’s all-in-one identity platform with serverless functions, specifically AWS Lambda, to build a highly scalable and secure identity verification system.
Key Takeaway 1: Serverless functions like AWS Lambda are ideal for integrating with identity verification services due to their pay-per-use model and automatic scaling.
Key Takeaway 2: Didit's API-first approach makes integration with serverless architectures straightforward and efficient.
Key Takeaway 3: Careful consideration of API rate limits and error handling is essential for a resilient serverless identity verification implementation.
Key Takeaway 4: Utilizing environment variables for API keys and configurations enhances security within your serverless environment.
Why Serverless for Identity Verification?
Traditional identity verification systems often involve maintaining dedicated servers, managing infrastructure, and handling scaling manually. This can be resource-intensive and expensive. Serverless computing, exemplified by AWS Lambda, offers a compelling alternative. With serverless, you only pay for the compute time you consume. This pay-per-use model is particularly well-suited for identity verification, where usage can be sporadic and unpredictable. Furthermore, serverless functions automatically scale to handle fluctuating demand, ensuring a seamless user experience even during peak periods. This is especially important for applications experiencing significant growth or seasonal traffic.
Architecture Overview
A typical serverless identity verification architecture using Didit involves the following components:
- Client Application: Initiates the identity verification process (e.g., a web or mobile app).
- API Gateway: Receives requests from the client application and routes them to the appropriate Lambda function.
- AWS Lambda Function: Executes the identity verification logic by calling the Didit API.
- Didit API: Provides access to Didit’s identity verification services (ID verification, liveness detection, AML screening, etc.).
- Database (Optional): Stores verification results and user data (e.g., DynamoDB).
The client application sends a request to the API Gateway, which triggers the Lambda function. The Lambda function then calls the Didit API to perform the desired identity verification checks. The results are either returned directly to the client application or stored in a database for future reference.
Integrating Didit with AWS Lambda: A Code Example
Here’s a simplified example of a Python Lambda function that integrates with the Didit API for ID verification:
import json
import os
import requests
# Retrieve Didit API key from environment variable
DIDIT_API_KEY = os.environ.get('DIDIT_API_KEY')
def lambda_handler(event, context):
try:
# Extract data from the event
document_image = event['document_image']
document_type = event['document_type']
country_code = event['country_code']
# Construct the Didit API request
url = 'https://api.didit.me/v1/id-verification'
headers = {
'Authorization': f'Bearer {DIDIT_API_KEY}',
'Content-Type': 'application/json'
}
data = {
'document_image': document_image,
'document_type': document_type,
'country_code': country_code
}
# Make the API request
response = requests.post(url, headers=headers, json=data)
response.raise_for_status() # Raise HTTPError for bad responses (4xx or 5xx)
# Parse the response
result = response.json()
return {
'statusCode': 200,
'body': json.dumps(result)
}
except requests.exceptions.RequestException as e:
print(f'Error making API request: {e}')
return {
'statusCode': 500,
'body': json.dumps({'error': 'Failed to verify identity'})
}
except Exception as e:
print(f'An unexpected error occurred: {e}')
return {
'statusCode': 500,
'body': json.dumps({'error': 'Internal server error'})
}
Important Considerations:
- API Key Management: Store your Didit API key securely using environment variables. Never hardcode API keys directly into your code.
- Error Handling: Implement robust error handling to gracefully handle API errors and unexpected exceptions.
- Rate Limiting: Be mindful of Didit’s API rate limits and implement appropriate retry mechanisms.
- Data Validation: Validate input data to prevent errors and security vulnerabilities.
Scalability and Performance Optimization
Serverless architectures are inherently scalable, but there are still steps you can take to optimize performance:
- Concurrency: Configure the appropriate concurrency settings for your Lambda function to handle peak loads.
- Code Optimization: Write efficient code and minimize dependencies to reduce execution time.
- Caching: Cache frequently accessed data to reduce API calls to Didit.
- Asynchronous Processing: Use asynchronous processing for tasks that don't require immediate responses.
How Didit Helps
Didit simplifies serverless identity verification through:
- API-First Design: A comprehensive and well-documented REST API for seamless integration.
- Modular Architecture: Choose only the verification modules you need (ID verification, liveness detection, AML screening, etc.).
- Global Coverage: Support for 14,000+ document types across 220+ countries.
- Scalability: Designed to handle high volumes of verification requests.
- Security: SOC 2 Type II and ISO 27001 certified, GDPR compliant.
Ready to Get Started?
Integrating Didit with serverless functions like AWS Lambda is a powerful way to build scalable, secure, and cost-effective identity verification systems.
Resources:
Try it
Try this in the sandbox
Run the check this guide describes, free.
The product this post is about, taken from its topic. Run it free in the sandbox.
Author
Alejandro Rosas
Co-founder and CTO

Questions
Blog questions
Who writes the Didit blog?
Which topics does the blog cover?
Is the blog available in my language?
Where do I find product updates?
Are these posts legal advice?
How do I find posts on one topic?
Are posts dated?
Do posts link to the docs?
Is the blog the same as the docs?
Compliance built in
Audited, certified and attested.
We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center
- Regulation encoded into your flows
Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.
- Ready for AMLR
Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.
- Tested in Spain's Treasury sandbox
Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.
- Audited, not self-declared
iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.
Your obligations · 3 regions
SOC 2 Type 2
ISO 27001
iBeta Level 1 and Level 2
EU regulator attestation
FSM youth protection
GDPR
EBA remote onboarding
MiCA compatible
FIDO Alliance member
- AMLREU AML Regulation ready
Integration · Didit MCP
Run Didit from your own AI agent
Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.
- Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
- Run investigationsAsk why a session was declined, review cases, search people and companies.
- Change rulesCreate payment rules, test them on past data and switch them on.
- Pull reportsAsk for numbers, exports or the audit log.
Didit Academy


