Skip to main content

Credit Card OCR API 🔍

Credit Card Information Extraction API

Version Status New

Extract credit card information (number, name, expiry date, security code) from images with high accuracy using advanced LLM models. Optimized for performance and precision.

Try Demo!

Example Images (Click to try)

Example 1

Demo key is limited to 10 requests per day per IP
Click here to get your API key

🚀 Features

  • High Accuracy - 96.43% overall extraction accuracy
  • Fast Processing - Average response time under 0.8 seconds
  • Multiple Image Formats - JPG, JPEG, PNG, BMP, TIFF, WebP, HEIC
  • Complete Card Data - Extracts card number, name, expiry date, and security code

📈 Performance Benchmark

API Response Time (10 requests):

  • Success Rate: 100.0%
  • Min Time: 0.794s
  • Max Time: 0.804s
  • Avg Time: 0.795s

🎯 Accuracy (21 test images)

  • Overall: 96.43% accuracy, 2.62% CER (Character Error Rate)
FieldAccuracyCER
Card Number95.24%0.95%
Name100%0.0%
Expiry Date100%0.0%
Security Code90.48%9.52%

📡 API Endpoints

🔹 Credit Card Information Extraction

POST /extract/credit-card
Content-Type: multipart/form-data

Params:

  • card_image: Image file containing credit card (JPG, PNG, etc.)

Example:

curl -X POST "https://api.iapp.co.th/v1/image/extract/credit-card" \
-H "apikey: YOUR_API_KEY" \
-F "card_image=@/path/to/credit-card.jpg"

Response:

{
"card_number": "4111 1111 1111 1111",
"name": "JOHN DOE",
"expiry_date": "12/25",
"security_code": "123"
}

🔹 Health Check

GET /health

Example:

curl -X GET "https://api.iapp.co.th/v1/image/health" \
-H "apikey: YOUR_API_KEY"

Response:

{
"status": "healthy",
"model_loaded": true,
"version": "1.0"
}

🐍 Python Code Example

import requests

def extract_credit_card_info(image_path, api_key, api_url="https://api.iapp.co.th/v1/image"):
"""
Extract credit card information from an image

Args:
image_path (str): Path to the credit card image
api_key (str): Your API key
api_url (str): Base URL of the API

Returns:
dict: Extracted credit card information
"""
headers = {
"apikey": api_key
}

files = {
"card_image": open(image_path, "rb")
}

response = requests.post(
f"{api_url}/extract/credit-card",
headers=headers,
files=files
)

response.raise_for_status() # Raise exception for HTTP errors
return response.json()

# Example usage:
# result = extract_credit_card_info("card.jpg", api_key="YOUR_API_KEY")
# print(f"Card Number: {result['card_number']}")
# print(f"Name: {result['name']}")
# print(f"Expiry Date: {result['expiry_date']}")
# print(f"Security Code: {result['security_code']}")

⚠️ Errors

CodeDescription
400Invalid request (image format not supported or corrupted)
401Missing or invalid API key
415Unsupported media type
422Unable to extract information (poor image quality)
429Rate limit exceeded
500Internal server error

✅ Summary

  • 🔍 Accurate credit card data extraction
  • 🚀 Fast processing in under 0.8 seconds
  • 🎯 High field-level accuracy (96.43% overall)
  • 📸 Supports multiple image formats
  • 🔒 Secure API with authentication