Skip to content

DaZheng OCR API Commercial Interface Documentation ​

Commercial EditionPOST ProtocolFormat: JSONAvg Latency: < 150msSLA: 99.9%

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 ​

ItemSpecificationDescription
ProtocolHTTP / HTTPSHTTPS recommended in production for encrypted transmission
HTTP MethodPOSTAll recognition endpoints accept POST requests
Image FormatPNG / JPG / JPEGSupports top 3 mainstream image formats
Max File SizeUp to 5 MBRequests exceeding 5MB will be rejected with HTTP 413
Rate Limit10,000 requests / 60 secondsHigh-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 NameHTTP MethodPathFormat (Content-Type)Best Use Case
Standard File EndpointPOST/ocr/file/:apikeymultipart/form-dataRecommended: Direct local image upload, standard mode
Standard Base64 EndpointPOST/ocr/base64/:apikeyapplication/jsonAutomated script in-memory Base64 transmission
Case-Sensitive File EndpointPOST/ocr/case-sensitive/file/:apikeymultipart/form-dataRecommended: Precise case-sensitive file upload
Case-Sensitive Base64 EndpointPOST/ocr/case-sensitive/base64/:apikeyapplication/jsonPrecise 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 ​

  1. Deduction Logic: Each successful API call returning a valid result automatically deducts 1 call from the Key's remaining quota.
  2. Real-Time Balance: The returned JSON includes the remaining_calls field, indicating the remaining available call count after deduction.
  3. Test API Keys List (Each includes 1,000 initial free call credits):
text
LGaKU8hyvLg6Ow-eLd1Fibeg0_Ga-GSRJ8-8Yu__anE=
text
rtBIwVnDFX-PaqUSti8tlKCEBy2QtT50cosziMNjLcY=
text
hPy9WVeABPXqqATIK24LkH8Xh33-322lyb0gtKkAZWw=
text
9amJ_GzpAmvNcgDWvxhehfYdTm86j3JyExr_LwVWi_A=
text
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 ​

PositionParameterTypeRequiredDescription
PathapikeyStringYesYour API Key
HeaderContent-TypeStringYesMust be multipart/form-data
Body (Form)fileFile BinaryYesImage binary file (PNG / JPG / JPEG only, ≤ 5MB)

Code Examples ​

bash
curl -X POST \
  -H "Content-Type: multipart/form-data" \
  -F "file=@/path/to/your/image.jpg" \
  https://api.makebang.win/ocr/file/YOUR_API_KEY
python
import 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())
javascript
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);
}
go
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))
}
java
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 ​

PositionParameterTypeRequiredDescription
PathapikeyStringYesYour API Key
HeaderContent-TypeStringYesMust be application/json
Body (JSON)image_base64StringYesBase64-encoded image string (supports with or without data:image/png;base64, prefix)

Code Examples ​

bash
BASE64_DATA="iVBORw0KGgoAAAANSUhEUgAA..."

curl -X POST \
  -H "Content-Type: application/json" \
  -d "{\"image_base64\": \"${BASE64_DATA}\"}" \
  https://api.makebang.win/ocr/base64/YOUR_API_KEY
python
import 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())
javascript
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);
go
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))
}
java
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 ​

bash
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_KEY

4. 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 ​

bash
curl -X POST \
  -H "Content-Type: application/json" \
  -d "{\"image_base64\": \"iVBORw0KGgoAAAANSUhEUgAA...\"}" \
  https://api.makebang.win/ocr/case-sensitive/base64/YOUR_API_KEY

5. Response Specifications & Error Codes ​

All endpoints use standard HTTP status codes and return responses in JSON format.

5.1 Success Response (HTTP 200 OK) ​

json
{
  "message": "ok",
  "text": "aB7K9X",
  "remaining_calls": 998
}

Response Field Dictionary ​

FieldTypeExampleDescription
messageString"ok"Request status description, returns "ok" on success
textString"aB7K9X"OCR Recognized Text Result. Preserves letters or digits
remaining_callsInteger998Remaining 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 CodeError TypeRoot Cause & Resolution GuideError JSON Response Payload
400 Bad RequestInvalid Key / Payload1. API Key does not exist or has typos
2. API Key quota is exhausted (0)
3. Missing file or image_base64 parameter
4. Uploaded unsupported file format (not PNG/JPG/JPEG)
5. Corrupted Base64 payload
{"detail": "Your API key is not valid."}
413 Payload Too LargeFile Exceeds LimitUploaded image or Base64 byte size exceeds 5MB (5,242,880 bytes){"error": "Request entity too large. Max size is 5242880 bytes."}
429 Too Many RequestsRate Limit TriggeredSingle IP request frequency exceeded rate limit (default 10,000 requests / 60s), please reduce concurrency{"error": "Too many requests. Please try again later."}
500 Internal ErrorServer ErrorTemporary 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:

python
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 None

2. 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-enjoy or scan the QR code.
  • 📄 Author Homepage: For details, visit Contact Author.

Commercial Grade OCR Service · High Accuracy · Speed < 150ms · Privacy First