Setup
Before you start
- .NET 8 SDK or newer
- No NuGet packages:
HttpClientandSystem.Text.Jsonship with .NET - A bypass.so API key (create one) with a positive balance
Install
dotnet new console -o BypassDemo
cd BypassDemoStore your key
The examples read your key from the BYPASS_API_KEY environment variable, so it never lands in source control.
export BYPASS_API_KEY="your-api-key"Check that the key works: curl -H "Authorization: Bearer $BYPASS_API_KEY" https://bypass.so/balance returns your balance.
Step 1
Add the helper
Save this file next to your code. It wraps the whole task lifecycle in one call, SolveAsync(type, parameters), so the rest of your project never deals with polling.
- createTask: sends your key, the task type and its fields as one flat JSON object.
- Fast path: if the answer is already ready, it returns at once.
- Polling: otherwise it checks
/getTaskResult/{taskId}every two seconds until the result is ready or the timeout runs out. - Errors: any reply with a non-zero
errorId, including afailedtask, becomes an error carrying theerrorCode, so you can branch on it. - taskId: kept with the solution, so you can report a wrong answer later.
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;
using System.Text.Json.Nodes;
namespace BypassSo;
/// <summary>Any API reply with errorId != 0.</summary>
public sealed class BypassException(string code, string description, string? taskId = null)
: Exception($"{code}: {description}")
{
public string Code { get; } = code;
public string? TaskId { get; } = taskId;
}
public sealed class Solution
{
public string? Text { get; init; }
public string? Token { get; init; }
public string? GRecaptchaResponse { get; init; }
public string? TokenField { get; init; }
public double? TokenLifetime { get; init; }
public string TaskId { get; set; } = "";
/// <summary>The token for widget types, or the text for recognition types.</summary>
public string? Answer => GRecaptchaResponse ?? Token ?? Text;
}
public sealed record Balance(long Credits, decimal BalanceUsd);
public sealed record ReportResult(string TaskId, long Refunded, decimal BalanceUsd);
public sealed class BypassClient
{
private const string ApiUrl = "https://bypass.so";
private static readonly JsonSerializerOptions JsonOptions = new(JsonSerializerDefaults.Web);
private readonly HttpClient _http;
private readonly string _key;
public BypassClient(HttpClient? http = null, string? apiKey = null)
{
_http = http ?? new HttpClient { Timeout = TimeSpan.FromSeconds(30) };
_key = apiKey ?? Environment.GetEnvironmentVariable("BYPASS_API_KEY") ?? "";
}
/// <summary>Creates a task and polls every 2 seconds until it is ready (default timeout 120 s).</summary>
public async Task<Solution> SolveAsync(
string type,
IReadOnlyDictionary<string, object?> parameters,
TimeSpan? timeout = null,
CancellationToken cancellationToken = default)
{
if (_key == "")
{
throw new BypassException("ERROR_KEY_INVALID", "set the BYPASS_API_KEY environment variable");
}
var limit = timeout ?? TimeSpan.FromSeconds(120);
using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
cts.CancelAfter(limit);
var body = new Dictionary<string, object?>(parameters) { ["clientKey"] = _key, ["type"] = type };
var data = await SendAsync(HttpMethod.Post, "/createTask", JsonContent.Create(body), false, cts.Token);
var taskId = (string?)data["taskId"] ?? "";
var poll = $"/getTaskResult/{Uri.EscapeDataString(taskId)}?clientKey={Uri.EscapeDataString(_key)}";
try
{
while ((string?)data["status"] != "ready")
{
if ((string?)data["status"] == "failed")
{
throw new BypassException("ERROR_CAPTCHA_UNSOLVABLE", "task failed", taskId);
}
await Task.Delay(TimeSpan.FromSeconds(2), cts.Token);
data = await SendAsync(HttpMethod.Get, poll, null, false, cts.Token);
}
}
catch (OperationCanceledException) when (!cancellationToken.IsCancellationRequested)
{
throw new BypassException("CLIENT_TIMEOUT", $"task {taskId} was not ready after {limit.TotalSeconds}s", taskId);
}
var solution = data["solution"]?.Deserialize<Solution>(JsonOptions) ?? new Solution();
solution.TaskId = taskId;
return solution;
}
public async Task<Balance> GetBalanceAsync(CancellationToken cancellationToken = default)
{
var data = await SendAsync(HttpMethod.Get, "/balance", null, true, cancellationToken);
return data.Deserialize<Balance>(JsonOptions)!;
}
/// <summary>Flags a wrong answer. The price is refunded once and the task is closed.</summary>
public async Task<ReportResult> ReportBadAsync(string taskId, CancellationToken cancellationToken = default)
{
var data = await SendAsync(HttpMethod.Post, $"/reportBad?task_id={Uri.EscapeDataString(taskId)}", null, true, cancellationToken);
return data.Deserialize<ReportResult>(JsonOptions)!;
}
private async Task<JsonObject> SendAsync(HttpMethod method, string path, HttpContent? content, bool bearer, CancellationToken cancellationToken)
{
using var request = new HttpRequestMessage(method, ApiUrl + path) { Content = content };
if (bearer)
{
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", _key);
}
HttpResponseMessage response;
try
{
response = await _http.SendAsync(request, cancellationToken);
}
catch (HttpRequestException e)
{
throw new BypassException("HTTP_ERROR", e.Message);
}
using (response)
{
var raw = await response.Content.ReadAsStringAsync(cancellationToken);
JsonObject? data;
try
{
data = JsonNode.Parse(raw) as JsonObject;
}
catch (JsonException)
{
data = null;
}
if (data is null)
{
throw new BypassException("HTTP_ERROR", $"HTTP {(int)response.StatusCode} without a JSON body");
}
if (data["errorId"]?.GetValue<int>() is int errorId && errorId != 0)
{
throw new BypassException(
(string?)data["errorCode"] ?? "ERROR_UNKNOWN",
(string?)data["errorDescription"] ?? "",
(string?)data["taskId"]);
}
return data;
}
}
}Good to know
BypassClient and reuse it. In ASP.NET Core, register it as a singleton or pass in an HttpClient from IHttpClientFactory through the constructor.Project layout used below:
BypassDemo/ BypassDemo.csproj Bypass.cs the helper (step 1) Program.cs your program (step 2)
Step 2
Solve any supported type
Every task type uses the same call. Only the type name and its fields change. Pick a tab to see a complete, runnable file, then run it with dotnet run. Tabs marked soon are ready for launch day, but those types are not live yet.
using BypassSo;
var bypass = new BypassClient();
var solution = await bypass.SolveAsync("MathCaptchaTask", new Dictionary<string, object?>
{
["captchaText"] = "12 + 30 = ?",
});
Console.WriteLine(solution.Text);dotnet runreCAPTCHA v3 and hCaptcha are coming soon
RecaptchaV3Task and HCaptchaTask are not live yet. Until launch, createTask returns ERROR_TASK_NOT_SUPPORTED and nothing is charged. Get notified when they ship.Token types and your form
g-recaptcha-response, h-captcha-response or cf-turnstile-response. Send the exact URL of the page that shows the widget as websiteURL.Step 3
Handle errors and retries
Some failures are worth a second try and some are not. A missing balance or a wrong key will fail again, so stop and fix it. An unsolvable task, a timeout or a network hiccup is worth one or two more attempts with a short pause. An exception filter (catch … when) retries only the codes worth retrying. A timeout inside the helper becomes CLIENT_TIMEOUT, and your own cancellation token still stops everything at once.
using BypassSo;
var retryable = new HashSet<string> { "ERROR_CAPTCHA_UNSOLVABLE", "ERROR_INTERNAL", "HTTP_ERROR", "CLIENT_TIMEOUT" };
var bypass = new BypassClient();
async Task<Solution> SolveWithRetryAsync(string type, Dictionary<string, object?> parameters, int attempts = 3)
{
for (var attempt = 1; ; attempt++)
{
try
{
return await bypass.SolveAsync(type, parameters);
}
catch (BypassException e) when (retryable.Contains(e.Code) && attempt < attempts)
{
Console.Error.WriteLine($"attempt {attempt}: {e.Code}, retrying");
await Task.Delay(TimeSpan.FromSeconds(2 * attempt));
}
}
}
var solution = await SolveWithRetryAsync("MathCaptchaTask", new() { ["captchaText"] = "12 + 30 = ?" });
Console.WriteLine(solution.Text);Failed tasks cost nothing
Step 4
Check your balance and flag wrong answers
GET /balance and POST /reportBad use your key as a Bearer token. Report a task only when the target site actually rejected its answer. The refund is applied once per task, and the task is closed afterwards.
using BypassSo;
var bypass = new BypassClient();
if (args.Length > 0)
{
// dotnet run -- <taskId> reports that task's answer as wrong
var result = await bypass.ReportBadAsync(args[0]);
Console.WriteLine($"refunded units: {result.Refunded} balance now: {result.BalanceUsd}");
}
var balance = await bypass.GetBalanceAsync();
Console.WriteLine($"balance: ${balance.BalanceUsd:F2}");Scale
Solve many tasks in parallel
Each task is independent, so throughput grows with concurrency. Task.WhenAll starts every task, and a SemaphoreSlim keeps at most eight in flight. One BypassClient is shared by all of them. Start with a limit of 8 and adjust while you watch error rates and spend.
using BypassSo;
var bypass = new BypassClient();
using var gate = new SemaphoreSlim(8); // at most 8 tasks in flight
var jobs = Directory.GetFiles("captchas", "*.png").Select(async path =>
{
await gate.WaitAsync();
try
{
var imageBase64 = Convert.ToBase64String(await File.ReadAllBytesAsync(path));
var solution = await bypass.SolveAsync("ImageToTextTask", new Dictionary<string, object?>
{
["imageBase64"] = imageBase64,
});
return $"{Path.GetFileName(path)}: {solution.Text}";
}
catch (BypassException e)
{
return $"{Path.GetFileName(path)} failed: {e.Code}";
}
finally
{
gate.Release();
}
});
foreach (var line in await Task.WhenAll(jobs))
{
Console.WriteLine(line);
}Reference
Task type reference
What each type expects and returns. Prices are per 1,000 solved tasks; larger top-ups add bonus credit (see pricing).
| Task type | You send | You get | Price / 1k |
|---|---|---|---|
Task typeMathCaptchaTask | You sendcaptchaText | You gettext | Price / 1k$0.35 |
Task typeImageToTextTask | You sendimageBase64 | You gettext | Price / 1k$0.28 |
Task typeAudioCaptchaTask | You sendaudioBase64 | You gettext | Price / 1k$0.35 |
Task typeRecaptchaV2Task | You sendwebsiteURLwebsiteKey | You getgRecaptchaResponse and token, plus tokenField | Price / 1k$0.56 |
Task typeTurnstileTask | You sendwebsiteURLwebsiteKey | You gettoken, plus tokenField | Price / 1k$0.84 |
Task typeRecaptchaV3TaskComing soon | You sendwebsiteURLwebsiteKeyaction | You getgRecaptchaResponse and token, plus tokenField | Price / 1kAt launch |
Task typeHCaptchaTaskComing soon | You sendwebsiteURLwebsiteKey | You gettoken, plus tokenField | Price / 1kAt launch |
Errors
Troubleshooting
| Error | Source | What it means | How to fix it |
|---|---|---|---|
ErrorERROR_KEY_INVALID | SourceHTTP 403 | What it meansThe key is missing, mistyped or revoked. | How to fix itCheck that BYPASS_API_KEY is set in the same shell that runs your code, with no quotes or spaces around it. |
ErrorERROR_INSUFFICIENT_CREDITS | SourceHTTP 402 | What it meansYour balance cannot cover the task price. | How to fix itTop up from the dashboard. Nothing was charged for this request. |
ErrorERROR_TASK_NOT_SUPPORTED | SourceHTTP 200 | What it meansThe type string is unknown, or the type is still coming soon (reCAPTCHA v3, hCaptcha). | How to fix itCopy the exact name, for example TurnstileTask. Names are case-sensitive. Nothing is charged. |
ErrorERROR_BAD_REQUEST | SourceHTTP 400 | What it meansThe body is not valid JSON, or a field has the wrong type. | How to fix itSend Content-Type: application/json and string values for clientKey, type and the task fields. |
ErrorERROR_CAPTCHA_UNSOLVABLE | SourceHTTP 200 | What it meansThis task could not be completed. | How to fix itYou are not charged. Check the image, sitekey and page URL, then submit a new task. |
ErrorERROR_NOT_FOUND | SourceHTTP 404 | What it meansThe taskId is unknown or belongs to another key. | How to fix itPoll with the taskId returned by your own createTask call, using the same key. |
ErrorERROR_INTERNAL | SourceHTTP 500 | What it meansSomething went wrong on our side. | How to fix itRetry after a short pause. The helper’s retry wrapper does this for you. |
| ErrorHelper timeout | Sourceyour code | What it meansNo result inside your timeout. | How to fix itToken types usually need several seconds. Keep at least 60–120 s and retry with a new task. |
ErrorHTTP_ERROR | Sourceyour code | What it meansA proxy or network layer answered without JSON. | How to fix itRetry with backoff. If it persists, check that your code calls https://bypass.so. |
Every error body has the same shape: {"errorId":1,"errorCode":"…","errorDescription":"…"}. Full list in the API reference.
Production
Best practices
Keep the key out of code
Read it from an environment variable or your secret store. Never commit it or ship it to a web page.
Solve right before submit
Tokens are short-lived. Fill the form first, then request the token and submit at once.
Cap your concurrency
Start with 5–10 parallel tasks and raise it while you watch error rates and spend.
Log every taskId
It is the only thing you need to debug a result or report a wrong answer.
Match the page exactly
Send the URL where the widget renders and the sitekey from that page, not from a different form.
Report wrong answers
If a site rejects a solved result, call reportBad with its taskId. The price returns to your balance once.
FAQ
Questions
"status": "ready" and a solution, so the helper returns without polling. Token types always come back as processing first.reportBad with its taskId and the price returns to your balance once. A reported task is closed, so submit a new one to try again.CancellationToken as the last argument of SolveAsync. Cancelling it stops the polling loop at once; a timeout of your own choosing goes in the timeout argument.Policy
Responsible use
Use it where you are allowed to
Automate pages you own, test environments you run, or sites whose terms permit automated access. Do not use bypass.so for fraud, account takeover, spam, scalping, evading bans or collecting personal data without a lawful basis. Keep request rates reasonable and stop when a site asks you to. Our acceptable use policy applies to every key, and keys used for abuse are closed.
Keep going
Next steps
- API referenceEvery endpoint, field and error code
- PricingPer-task prices and top-up bonuses
- Python guideScripts, backends and data jobs
- Node.js guideServices, CLIs and serverless functions
- Go guideServices and workers on the standard library
- PHP guideWeb apps, cron jobs and CLI scripts
- Java guideJVM backends on Java 17+, no libraries
- Ruby guideScripts, Rails apps and background jobs
- Selenium guideQA suites and WebDriver flows
- Playwright guideEnd-to-end tests in Node.js or Python
- Puppeteer guideChrome automation scripts
- Scrapy guideCrawls that run into captcha pages