DaZheng OCR API Commercial Interface Documentation
1. Overview & Service Commitments
DaZheng OCR API is a high-performance character recognition service designed specifically for automated scripts, crawler systems, RPA workflows, and commercial integrations. The service rapidly extracts English letters and digits from images, providing Standard Recognition and Case-Sensitive dual engines to cover various complex captcha and text scenarios.
Core Features & Advantages
- High-Accuracy Engine: Trained and optimized on massive captcha datasets, featuring strong anti-interference capabilities against distortion, noise, and character rotation.
- Dual Recognition Modes:
- Standard Mode: Ignores character case, focusing on pure text/digit extraction with high fault tolerance.
- Case-Sensitive Mode: Accurately distinguishes uppercase (
A-Z) and lowercase (a-z) letters, designed for strict captchas.
- In-Memory Security & Privacy Protection: All image data is processed directly in memory binary streams and immediately destroyed upon calculation without landing on disk, strictly guaranteeing data security and privacy for commercial users.
- Ultra-Fast Response: Built on a high-concurrency architecture and microsecond inference engine, with an average response time of less than 150ms.
Basic Limitations & Specifications
| Item | Specification | Description |
|---|---|---|
| Protocol | HTTP / HTTPS | HTTPS recommended in production for encrypted transmission |
| HTTP Method | POST | All recognition endpoints accept POST requests |
| Image Format | PNG / JPG / JPEG | Supports top 3 mainstream image formats |
| Max File Size | Up to 5 MB | Requests exceeding 5MB will be rejected with HTTP 413 |
| Rate Limit | 10,000 requests / 60 seconds | High-concurrency default limit per IP for enterprise demand |
2. API Selection Guide
Based on your system architecture and image data pipeline, select the appropriate endpoint from the table below:
| Endpoint Name | HTTP Method | Path | Format (Content-Type) | Best Use Case |
|---|---|---|---|---|
| Standard File Endpoint | POST | /ocr/file/:apikey | multipart/form-data | Recommended: Direct local image upload, standard mode |
| Standard Base64 Endpoint | POST | /ocr/base64/:apikey | application/json | Automated script in-memory Base64 transmission |
| Case-Sensitive File Endpoint | POST | /ocr/case-sensitive/file/:apikey | multipart/form-data | Recommended: Precise case-sensitive file upload |
| Case-Sensitive Base64 Endpoint | POST | /ocr/case-sensitive/base64/:apikey | application/json | Precise case-sensitive mode via JSON / Base64 |
3. Authorization & API Keys
All API requests must include a valid :apikey parameter in the URL path. Unauthorized or invalid requests will be rejected.
Billing & Quota Deduction
- Deduction Logic: Each successful API call returning a valid result automatically deducts 1 call from the Key's remaining quota.
- Real-Time Balance: The returned JSON includes the
remaining_callsfield, indicating the remaining available call count after deduction. - Test API Keys List (Each includes 1,000 initial free call credits):
LGaKU8hyvLg6Ow-eLd1Fibeg0_Ga-GSRJ8-8Yu__anE=rtBIwVnDFX-PaqUSti8tlKCEBy2QtT50cosziMNjLcY=hPy9WVeABPXqqATIK24LkH8Xh33-322lyb0gtKkAZWw=9amJ_GzpAmvNcgDWvxhehfYdTm86j3JyExr_LwVWi_A=w8Ce0ytQ0ZNrTrPrZzokRfVrGQnmpand8XYNjG1m66o=🔑 Commercial License & Custom Model Purchase
To purchase additional quota, high-concurrency enterprise keys, or custom captcha models, contact the author via WeChat: somenzz-enjoy or visit Contact Author.
4. API Reference
1. Standard File Recognition Endpoint
Upload image binary files via multipart/form-data for standard OCR recognition (case-insensitive, high fault tolerance).
- Request URL:
https://api.makebang.win/ocr/file/{apikey} - HTTP Method: POST
Request Parameters Specification
| Position | Parameter | Type | Required | Description |
|---|---|---|---|---|
| Path | apikey | String | Yes | Your API Key |
| Header | Content-Type | String | Yes | Must be multipart/form-data |
| Body (Form) | file | File Binary | Yes | Image binary file (PNG / JPG / JPEG only, ≤ 5MB) |
Code Examples
curl -X POST \
-H "Content-Type: multipart/form-data" \
-F "file=@/path/to/your/image.jpg" \
https://api.makebang.win/ocr/file/YOUR_API_KEYimport requests
API_KEY = "YOUR_API_KEY"
url = f"https://api.makebang.win/ocr/file/{API_KEY}"
files = {
'file': ('image.jpg', open('/path/to/your/image.jpg', 'rb'), 'image/jpeg')
}
response = requests.post(url, files=files)
print(response.json())import axios from 'axios';
import FormData from 'form-data';
import fs from 'fs';
const API_KEY = 'YOUR_API_KEY';
const url = `https://api.makebang.win/ocr/file/${API_KEY}`;
const form = new FormData();
form.append('file', fs.createReadStream('/path/to/your/image.jpg'));
try {
const response = await axios.post(url, form, {
headers: form.getHeaders()
});
console.log('Result:', response.data);
} catch (error) {
console.error('Request failed:', error.response?.data || error.message);
}package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"
"path/filepath"
)
func main() {
apiKey := "YOUR_API_KEY"
targetURL := fmt.Sprintf("https://api.makebang.win/ocr/file/%s", apiKey)
filePath := "/path/to/your/image.jpg"
body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
fileWriter, err := writer.CreateFormFile("file", filepath.Base(filePath))
if err != nil {
log.Fatalf("Failed to create form file field: %v", err)
}
file, err := os.Open(filePath)
if err != nil {
log.Fatalf("Failed to open file: %v", err)
}
defer file.Close()
if _, err = io.Copy(fileWriter, file); err != nil {
log.Fatalf("Failed to copy file data: %v", err)
}
writer.Close()
req, err := http.NewRequest("POST", targetURL, body)
if err != nil {
log.Fatalf("Failed to create request: %v", err)
}
req.Header.Set("Content-Type", writer.FormDataContentType())
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
log.Fatalf("Failed to send request: %v", err)
}
defer resp.Body.Close()
respBody, _ := io.ReadAll(resp.Body)
fmt.Printf("Response: %s\n", string(respBody))
}import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.UUID;
public class OcrClient {
public static void main(String[] args) throws Exception {
String apiKey = "YOUR_API_KEY";
String url = "https://api.makebang.win/ocr/file/" + apiKey;
Path filePath = Path.of("/path/to/your/image.jpg");
String boundary = "---Boundary" + UUID.randomUUID().toString();
byte[] fileBytes = Files.readAllBytes(filePath);
StringBuilder mimeHeader = new StringBuilder();
mimeHeader.append("--").append(boundary).append("\r\n");
mimeHeader.append("Content-Disposition: form-data; name=\"file\"; filename=\"").append(filePath.getFileName()).append("\"\r\n");
mimeHeader.append("Content-Type: image/jpeg\r\n\r\n");
byte[] headerBytes = mimeHeader.toString().getBytes();
byte[] footerBytes = ("\r\n--" + boundary + "--\r\n").getBytes();
byte[] requestBody = new byte[headerBytes.length + fileBytes.length + footerBytes.length];
System.arraycopy(headerBytes, 0, requestBody, 0, headerBytes.length);
System.arraycopy(fileBytes, 0, requestBody, headerBytes.length, fileBytes.length);
System.arraycopy(footerBytes, 0, requestBody, headerBytes.length + fileBytes.length, footerBytes.length);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "multipart/form-data; boundary=" + boundary)
.POST(HttpRequest.BodyPublishers.ofByteArray(requestBody))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Status code: " + response.statusCode());
System.out.println("Response body: " + response.body());
}
}2. Standard Base64 Data Recognition Endpoint
Send Base64-encoded image string via application/json for standard OCR recognition.
- Request URL:
https://api.makebang.win/ocr/base64/{apikey} - HTTP Method: POST
Request Parameters Specification
| Position | Parameter | Type | Required | Description |
|---|---|---|---|---|
| Path | apikey | String | Yes | Your API Key |
| Header | Content-Type | String | Yes | Must be application/json |
| Body (JSON) | image_base64 | String | Yes | Base64-encoded image string (supports with or without data:image/png;base64, prefix) |
Code Examples
BASE64_DATA="iVBORw0KGgoAAAANSUhEUgAA..."
curl -X POST \
-H "Content-Type: application/json" \
-d "{\"image_base64\": \"${BASE64_DATA}\"}" \
https://api.makebang.win/ocr/base64/YOUR_API_KEYimport requests
import base64
API_KEY = "YOUR_API_KEY"
url = f"https://api.makebang.win/ocr/base64/{API_KEY}"
def image_to_base64(image_path):
with open(image_path, "rb") as f:
return base64.b64encode(f.read()).decode('utf-8')
payload = {
"image_base64": image_to_base64("/path/to/your/image.jpg")
}
response = requests.post(url, json=payload)
print(response.json())import axios from 'axios';
import fs from 'fs';
const API_KEY = 'YOUR_API_KEY';
const url = `https://api.makebang.win/ocr/base64/${API_KEY}`;
const imageBuffer = fs.readFileSync('/path/to/your/image.jpg');
const base64Data = imageBuffer.toString('base64');
const response = await axios.post(url, {
image_base64: base64Data
}, {
headers: { 'Content-Type': 'application/json' }
});
console.log(response.data);package main
import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
)
type RequestPayload struct {
ImageBase64 string `json:"image_base64"`
}
func main() {
apiKey := "YOUR_API_KEY"
url := fmt.Sprintf("https://api.makebang.win/ocr/base64/%s", apiKey)
imgBytes, _ := os.ReadFile("/path/to/your/image.jpg")
encoded := base64.StdEncoding.EncodeToString(imgBytes)
payload := RequestPayload{ImageBase64: encoded}
jsonBytes, _ := json.Marshal(payload)
resp, err := http.Post(url, "application/json", bytes.NewBuffer(jsonBytes))
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Base64;
public class OcrBase64Client {
public static void main(String[] args) throws Exception {
String apiKey = "YOUR_API_KEY";
String url = "https://api.makebang.win/ocr/base64/" + apiKey;
byte[] bytes = Files.readAllBytes(Path.of("/path/to/your/image.jpg"));
String base64Image = Base64.getEncoder().encodeToString(bytes);
String jsonPayload = String.format("{\"image_base64\":\"%s\"}", base64Image);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}3. Case-Sensitive File Recognition Endpoint
Upload image binary files via multipart/form-data using case-sensitive calculation models (precisely preserving original character casing).
- Request URL:
https://api.makebang.win/ocr/case-sensitive/file/{apikey} - HTTP Method: POST
Request Parameters Specification
Same as Standard File Endpoint: upload binary image file under file parameter with Content-Type: multipart/form-data.
cURL Example
curl -X POST \
-H "Content-Type: multipart/form-data" \
-F "file=@/path/to/your/image.jpg" \
https://api.makebang.win/ocr/case-sensitive/file/YOUR_API_KEY4. Case-Sensitive Base64 Recognition Endpoint
Send Base64 string via application/json using case-sensitive recognition models.
- Request URL:
https://api.makebang.win/ocr/case-sensitive/base64/{apikey} - HTTP Method: POST
Request Parameters Specification
Same as Standard Base64 Endpoint: include image_base64 in JSON body with Content-Type: application/json.
cURL Example
curl -X POST \
-H "Content-Type: application/json" \
-d "{\"image_base64\": \"iVBORw0KGgoAAAANSUhEUgAA...\"}" \
https://api.makebang.win/ocr/case-sensitive/base64/YOUR_API_KEY5. Response Specifications & Error Codes
All endpoints use standard HTTP status codes and return responses in JSON format.
5.1 Success Response (HTTP 200 OK)
{
"message": "ok",
"text": "aB7K9X",
"remaining_calls": 998
}Response Field Dictionary
| Field | Type | Example | Description |
|---|---|---|---|
message | String | "ok" | Request status description, returns "ok" on success |
text | String | "aB7K9X" | OCR Recognized Text Result. Preserves letters or digits |
remaining_calls | Integer | 998 | Remaining available call count after deducting current call |
5.2 Error Response & Status Code Dictionary
If a request fails, the server responds with a corresponding HTTP status code and error details payload.
| HTTP Code | Error Type | Root Cause & Resolution Guide | Error JSON Response Payload |
|---|---|---|---|
400 Bad Request | Invalid Key / Payload | 1. API Key does not exist or has typos 2. API Key quota is exhausted ( 0) 3. Missing file or image_base64 parameter4. Uploaded unsupported file format (not PNG/JPG/JPEG) 5. Corrupted Base64 payload | {"detail": "Your API key is not valid."} |
413 Payload Too Large | File Exceeds Limit | Uploaded image or Base64 byte size exceeds 5MB (5,242,880 bytes) | {"error": "Request entity too large. Max size is 5242880 bytes."} |
429 Too Many Requests | Rate Limit Triggered | Single IP request frequency exceeded rate limit (default 10,000 requests / 60s), please reduce concurrency | {"error": "Too many requests. Please try again later."} |
500 Internal Error | Server Error | Temporary inference server exception, please retry or contact support | {"detail": "Internal server error occurred."} |
6. Production Best Practices
To ensure high availability and stability in automated commercial workflows, we recommend the following best practices:
1. Exponential Backoff Retry Mechanism
When encountering temporary network glitches or 429 Too Many Requests, avoid immediate retry bursts. Implement exponential backoff retry algorithms with random jitter:
import time
import random
import requests
def call_ocr_api_with_retry(url, files, max_retries=3):
base_delay = 0.5 # Initial delay 500ms
for attempt in range(max_retries):
try:
response = requests.post(url, files=files, timeout=(3, 10))
if response.status_code == 200:
return response.json()
elif response.status_code == 429:
# Rate limited, wait and retry
sleep_time = base_delay * (2 ** attempt) + random.uniform(0, 0.2)
time.sleep(sleep_time)
else:
print(f"Request failed [{response.status_code}]: {response.text}")
break
except requests.RequestException as e:
print(f"Network exception, retrying attempt {attempt + 1}...")
time.sleep(base_delay * (2 ** attempt))
return None2. Payload Transport Comparison
- File Upload (
multipart/form-data): Transmits native binary stream with no encoding overhead, ideal for large images or direct local file calls. - Base64 Payload (
application/json): Base64 encoding increases data volume by roughly 33%, but simplifies in-memory JSON communication between microservices.
3. Timeout Configuration Recommendations
Due to fast server inference, configure efficient timeouts on client callers:
- Connection Timeout:
3.0 seconds - Read / Response Timeout:
10.0 seconds
7. Frequently Asked Questions (FAQ)
Q1: Why does my request return 400 error "Your API key is not valid."?
Answer: Please verify the following 3 points: 1. Ensure the Key string in the URL has no extra spaces or newline characters; 2. Verify if the Key call quota has been exhausted; 3. If it is a newly purchased Key, double check for typos.
Q2: How should I choose between Case-Sensitive and Standard mode?
Answer: If the target captcha is case-insensitive (e.g. entering either uppercase or lowercase works on the target website), use Standard Mode for higher fault tolerance. If case matters (e.g. distinguishing `o` vs `O`, `p` vs `P`), use Case-Sensitive Mode.
Q3: Are uploaded images saved on your server?
Answer: Never. DaZheng OCR uses an all-memory streaming architecture. Image bytes are processed in memory and immediately garbage-collected upon computation completion. No images are ever saved to disk or database.
Q4: How to improve recognition accuracy if minor errors occur?
Answer: Try the following optimizations: 1. Crop out irrelevant margins or background borders around the captcha; 2. Ensure original image width is at least 80px; 3. Avoid excessive stretching or distortion.
8. Technical Support
If you encounter integration issues, need to recharge API Key credits, or require customized captcha models, contact the author anytime:
- 💬 WeChat Contact: Search WeChat ID
somenzz-enjoyor scan the QR code. - 📄 Author Homepage: For details, visit Contact Author.