Skip to main content

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.

Serverless Identity Verification: Integrating Didit

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.

ID Verification

The product this post is about, taken from its topic. Run it free in the sandbox.

$0.15 per checkStart free

Author

Alejandro Rosas

Co-founder and CTO

Alejandro Rosas

Alejandro Rosas

Co-founder and CTO

About Didit

Questions

Blog questions

Who writes the Didit blog?
The Didit team. Guides reviewed by Alberto Rosas, co-founder and CEO, carry his byline. The rest are published as Didit.
Which topics does the blog cover?
Eight topics: ID verification, business verification (KYB), AML, sanctions and compliance, fraud prevention, transaction monitoring and crypto, country guides, agents and developers, and product updates.
Is the blog available in my language?
Yes, in 15 languages: English, Spanish, French, German, Brazilian and European Portuguese, Catalan, Russian, Arabic, Chinese, Japanese, Hindi, Indonesian, Korean and Swahili. Not every post is translated, so each language shows the posts it has.
Where do I find product updates?
In the changelog at /changelog/ and under the Product updates topic.
Are these posts legal advice?
No. Regulation posts explain rules; your legal team decides how they apply.
How do I find posts on one topic?
Open one of the eight topics, or search the blog.
Are posts dated?
Yes. Every post shows when it was published and when it was last updated.
Do posts link to the docs?
Developer posts link to the matching page on docs.didit.me and to the API reference.
Is the blog the same as the docs?
No. The blog explains rules, markets and product changes for a general reader, while docs.didit.me holds the integration guides and the API reference. Developer posts link the matching docs page and the API reference they describe.

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.

Compliance assistant

Your obligations · 3 regions

EU · AMLRCustomer due diligence, human reviewCovered
Illinois, Texas, ColoradoExplicit biometric consentCovered
Germany · Youth protectionVerified adults only (JMStV)Covered
Workflow checked. Every obligation is met
  • 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.

Add to ClaudeChatGPT
Didit Academy · Lesson 04 · Use Didit with MCP
  • 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.

Verify your first user today.

Start free

Free sandbox. Credit applies to work-email sign-ups.