Authentication
1. Login to Get API Key
Endpoint: POST /api/auth/login
Request Body:
{
"email": "[email protected]",
"password": "your-password"
}
Response:
{
"success": true,
"user": {
"id": 1,
"email": "[email protected]",
"balance": 50000
},
"api_key": "nro_abc123..."
}
Solve Captcha
Endpoint: POST /api/solve
Cost: 7₫ per captcha
Headers:
X-API-KEY: your_api_key_here
Request (multipart/form-data):
image: [binary file]
Response:
{
"success": true,
"result": "ABCD1234",
"confidence": 0.95,
"processing_time": 0.5
}
C# Integration Guide
1. Install NuGet Packages
Install-Package Newtonsoft.Json
Install-Package RestSharp
2. Create API Client Class
using System;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Newtonsoft.Json;
public class NROCaptchaSolver
{
private readonly string _baseUrl;
private readonly string _apiKey;
private readonly HttpClient _httpClient;
public NROCaptchaSolver(string baseUrl, string apiKey)
{
_baseUrl = baseUrl.TrimEnd('/');
_apiKey = apiKey;
_httpClient = new HttpClient();
_httpClient.DefaultRequestHeaders.Add("X-API-KEY", _apiKey);
}
// Login and get API key
public static async Task<string> LoginAsync(
string baseUrl, string email, string password)
{
using var client = new HttpClient();
var loginData = new
{
email = email,
password = password
};
var content = new StringContent(
JsonConvert.SerializeObject(loginData),
System.Text.Encoding.UTF8,
"application/json"
);
var response = await client.PostAsync(
$"{baseUrl}/api/auth/login", content);
var result = await response.Content.ReadAsStringAsync();
var data = JsonConvert.DeserializeObject<dynamic>(result);
return data.api_key;
}
// Solve captcha from file path
public async Task<CaptchaResult> SolveCaptchaAsync(string imagePath)
{
if (!File.Exists(imagePath))
throw new FileNotFoundException("Image not found", imagePath);
using var form = new MultipartFormDataContent();
using var fileStream = File.OpenRead(imagePath);
using var fileContent = new StreamContent(fileStream);
fileContent.Headers.ContentType =
MediaTypeHeaderValue.Parse("image/png");
form.Add(fileContent, "image", Path.GetFileName(imagePath));
var response = await _httpClient.PostAsync(
$"{_baseUrl}/api/solve", form);
var json = await response.Content.ReadAsStringAsync();
return JsonConvert
.DeserializeObject<CaptchaResult>(json);
}
// Solve captcha from byte array
public async Task<CaptchaResult> SolveCaptchaAsync(
byte[] imageBytes, string filename = "captcha.png")
{
using var form = new MultipartFormDataContent();
using var content = new ByteArrayContent(imageBytes);
content.Headers.ContentType =
MediaTypeHeaderValue.Parse("image/png");
form.Add(content, "image", filename);
var response = await _httpClient.PostAsync(
$"{_baseUrl}/api/solve", form);
var json = await response.Content.ReadAsStringAsync();
return JsonConvert
.DeserializeObject<CaptchaResult>(json);
}
}
public class CaptchaResult
{
[JsonProperty("success")]
public bool Success { get; set; }
[JsonProperty("result")]
public string Result { get; set; }
[JsonProperty("confidence")]
public double Confidence { get; set; }
[JsonProperty("processing_time")]
public double ProcessingTime { get; set; }
[JsonProperty("error")]
public string Error { get; set; }
}
3. Usage Example
class Program
{
static async Task Main(string[] args)
{
string baseUrl = "http://api.miu2k3.com";
string email = "[email protected]";
string password = "your-password";
// Step 1: Login to get API key
string apiKey = await NROCaptchaSolver.LoginAsync(
baseUrl, email, password);
Console.WriteLine($"API Key: {apiKey}");
// Step 2: Create solver instance
var solver = new NROCaptchaSolver(baseUrl, apiKey);
// Step 3: Solve captcha
var result = await solver.SolveCaptchaAsync(
"path/to/captcha.png");
if (result.Success)
{
Console.WriteLine($"Result: {result.Result}");
Console.WriteLine($"Confidence: {result.Confidence:P}");
}
else
{
Console.WriteLine($"Error: {result.Error}");
}
}
}
4. Advanced: With Retry Logic
public async Task<CaptchaResult> SolveCaptchaWithRetryAsync(
string imagePath, int maxRetries = 3)
{
for (int i = 0; i < maxRetries; i++)
{
try
{
var result = await SolveCaptchaAsync(imagePath);
if (result.Success && result.Confidence >= 0.8)
return result;
if (i < maxRetries - 1)
{
Console.WriteLine(
$"Low confidence ({result.Confidence:P}), " +
$"retrying... ({i + 1}/{maxRetries})");
await Task.Delay(500); // Wait 500ms
}
}
catch (Exception ex)
{
if (i == maxRetries - 1)
throw;
Console.WriteLine($"Error: {ex.Message}, retrying...");
await Task.Delay(1000);
}
}
throw new Exception("Failed after " + maxRetries + " retries");
}