Solverify API Class
Python Examples•Updated 12/25/2025
import requests
class SolverifyAPI:
BASE_URL = "https://solver.solverify.net/"
def __init__(self, api_key: str):
self.api_key = api_key
def get_balance(self) -> float:
response = requests.post(f"{self.BASE_URL}getBalance", json={
"clientKey": self.api_key})
response.raise_for_status()
data = response.json()
if data.get("errorId") != 0:
raise Exception(f"Error fetching balance: {data.get('errorDescription')}")
return round(data.get("balance"), 4)
def get_task_result(self, task_id: str) -> dict:
response = requests.post(f"{self.BASE_URL}getTaskResult", json={
"clientKey": self.api_key,
"taskId": task_id
})
response.raise_for_status()
data = response.json()
if data.get("errorId") != 0:
raise Exception(f"Error fetching task result: {data.get('errorDescription')}")
return data
def solve_turnstile(self, site_url: str, site_key: str, action: str, cdata: str) -> str:
payload = {
"clientKey": self.api_key,
"task": {
"type": "turnstile",
"websiteURL": site_url,
"websiteKey": site_key
}
}
if action:
payload["task"]["action"] = action
if cdata:
payload["task"]["cdata"] = cdata
response = requests.post(f"{self.BASE_URL}createTask", json=payload)
response.raise_for_status()
data = response.json()
if data.get("errorId") != 0:
raise Exception(f"Error creating task: {data.get('errorDescription')}")
task_id = data.get("taskId")
return task_id
def solve_interstitial(self, site_url: str, user_agent: str, proxy_type: str, proxy_address: str, proxy_port: str, proxy_login: str = None, proxy_password: str = None) -> str:
payload = {
"clientKey": self.api_key,
"task": {
"type": "interstitial",
"websiteURL": site_url,
"useragent": user_agent,
"proxyType": proxy_type,
"proxyAddress": proxy_address,
"proxyPort": proxy_port
}
}
if proxy_login:
payload["task"]["proxyLogin"] = proxy_login
if proxy_password:
payload["task"]["proxyPassword"] = proxy_password
response = requests.post(f"{self.BASE_URL}createTask", json=payload)
response.raise_for_status()
data = response.json()
if data.get("errorId") != 0:
raise Exception(f"Error creating task: {data.get('errorDescription')}")
task_id = data.get("taskId")
return task_id
def solve_perimeterx(self, site_url: str, website_key: str, proxy_type: str, proxy_address: str, proxy_port: str, proxy_login: str = None, proxy_password: str = None) -> str:
payload = {
"clientKey": self.api_key,
"task": {
"type": "perimeterx",
"websiteURL": site_url,
"websiteKey": website_key,
"proxyType": proxy_type,
"proxyAddress": proxy_address,
"proxyPort": proxy_port
}
}
if proxy_login:
payload["task"]["proxyLogin"] = proxy_login
if proxy_password:
payload["task"]["proxyPassword"] = proxy_password
response = requests.post(f"{self.BASE_URL}createTask", json=payload)
response.raise_for_status()
data = response.json()
if data.get("errorId") != 0:
raise Exception(f"Error creating task: {data.get('errorDescription')}")
task_id = data.get("taskId")
return task_id
def solve_ocr(self, image_base64: str) -> str:
payload = {
"clientKey": self.api_key,
"task": {
"type": "ocr",
"base64": image_base64
}
}
response = requests.post(f"{self.BASE_URL}createTask", json=payload)
response.raise_for_status()
data = response.json()
if data.get("errorId") != 0:
raise Exception(f"Error creating task: {data.get('errorDescription')}")
task_id = data.get("taskId")
return task_id