BLS Ocr
Create Task
POST https://api.captchasonic.com/createTaskHost: api.captchasonic.comContent-Type: application/json
Request Example
Payload
{ "apiKey": "YOUR_API_KEY", "task": { "type": "OcrImage", "screenshot": true, "queries": [ "image1_base64", "image2_base64" ], "numeric": true, "module": "bls", "case": false, "maxLength": 3 }}
Response
{ "errorId": 0, "solution": { "imageSize": [ 400, 500 ], "objects": [ true, false, true, false ] }, "status": "ready", "target": "Default target text"}
API Testing Example Scripts
async function fetchOcrResult() { const url = "https://api.captchasonic.com/createTask"; // Replace with the actual API endpoint const data = { apiKey: "sonic_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx", task: { type: "OcrImage", screenshot: true, queries: [], numeric: true, module: "", case: true, maxLength: 0 } };
try { const response = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(data) });
if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); }
const result = await response.json(); console.log("Response:", result); return result; } catch (error) { console.error("Error fetching OCR result:", error); return null; }}
// Example usage:fetchOcrResult();
import requests
def fetch_ocr_result(): url = "https://api.captchasonic.com/createTask" # Replace with the actual API endpoint headers = {"Content-Type": "application/json"}
data = { "apiKey": "sonic_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "task": { "type": "OcrImage", "screenshot": True, "queries": [], "numeric": True, "module": "", "case": True, "maxLength": 0 } }
try: response = requests.post(url, json=data, headers=headers) response.raise_for_status() # Raise an error for HTTP error responses return response.json() # Return JSON response except requests.exceptions.RequestException as e: print(f"Error fetching OCR result: {e}") return None
# Example usage:result = fetch_ocr_result()if result: print("Response:", result)