{"id":20050161,"url":"https://github.com/2captcha/2captcha-cpp","last_synced_at":"2025-05-05T11:31:05.241Z","repository":{"id":82155050,"uuid":"289911634","full_name":"2captcha/2captcha-cpp","owner":"2captcha","description":"C++ library for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, funcaptcha, geetest and solve any other captchas.","archived":false,"fork":false,"pushed_at":"2024-12-04T10:44:03.000Z","size":91,"stargazers_count":21,"open_issues_count":2,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-08T21:51:44.042Z","etag":null,"topics":["2captcha","anti-captcha","anticaptcha","bypass-invisible-recaptcha","bypass-on-captcha-recaptcha","bypass-recaptcha-v2","bypasscaptcha","captcha-breaking","captcha-bypass","captcha-recognition","captcha-services-for-recaptcha-v2","captcha-solver","captcha-solving","deathbycaptcha","google-recaptcha-solver","recaptcha-bypass-script","recaptcha-solver","recaptcha-solver-cpp","recaptcha-v2-captcha-solver"],"latest_commit_sha":null,"homepage":"http://2captcha.com/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2captcha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-24T11:41:30.000Z","updated_at":"2025-04-07T13:35:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"ca05b670-1238-492e-8fd9-5cf5cf321216","html_url":"https://github.com/2captcha/2captcha-cpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2captcha%2F2captcha-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2captcha%2F2captcha-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2captcha%2F2captcha-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2captcha%2F2captcha-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2captcha","download_url":"https://codeload.github.com/2captcha/2captcha-cpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252488966,"owners_count":21756242,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2captcha","anti-captcha","anticaptcha","bypass-invisible-recaptcha","bypass-on-captcha-recaptcha","bypass-recaptcha-v2","bypasscaptcha","captcha-breaking","captcha-bypass","captcha-recognition","captcha-services-for-recaptcha-v2","captcha-solver","captcha-solving","deathbycaptcha","google-recaptcha-solver","recaptcha-bypass-script","recaptcha-solver","recaptcha-solver-cpp","recaptcha-v2-captcha-solver"],"created_at":"2024-11-13T11:54:38.568Z","updated_at":"2025-05-05T11:31:05.234Z","avatar_url":"https://github.com/2captcha.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://github.com/2captcha/2captcha-python\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/37e1d860-033b-4cf3-a158-468fc6b4debc\" width=\"82\" height=\"30\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/2captcha/2captcha-javascript\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/4d3b4541-34b2-4ed2-a687-d694ce67e5a6\" width=\"36\" height=\"30\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/2captcha/2captcha-go\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/ab22182e-6cb2-41fa-91f4-d5e89c6d7c6f\" width=\"63\" height=\"30\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/2captcha/2captcha-ruby\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/0270d56f-79b0-4c95-9b09-4de89579914b\" width=\"75\" height=\"30\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/2captcha/2captcha-cpp\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/5f09dc72-cefc-4036-b896-132ccd9aa465\" width=\"45\" height=\"30\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/2captcha/2captcha-php\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/e8797843-3f61-4fa9-a155-ab0b21fb3858\" width=\"52\" height=\"30\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/2captcha/2captcha-java\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/a3d923f6-4fec-4c07-ac50-e20da6370911\" width=\"50\" height=\"30\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/2captcha/2captcha-csharp\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/f4d449de-780b-49ed-bb0a-b70c82ec4b32\" width=\"38\" height=\"30\"\u003e\u003c/a\u003e\n\n# C++ Module for 2Captcha API (captcha solver)\nThe easiest way to quickly integrate [2Captcha] into your code to automate solving of any type of captcha.\nExamples of API requests for different captcha types are available on the [C++ captcha solver](https://github.com/2captcha/2captcha-cpp/tree/master/examples) examples directory.\n\n- [C++ Module for 2Captcha API (captcha solver)](#c-module-for-2captcha-api-captcha-solver)\n  - [Installation](#installation)\n  - [Configuration](#configuration)\n  - [Solve captcha](#solve-captcha)\n    - [Normal Captcha](#normal-captcha)\n    - [Text](#text-captcha)\n    - [ReCaptcha v2](#recaptcha-v2)\n    - [ReCaptcha v3](#recaptcha-v3)\n    - [FunCaptcha](#funcaptcha)\n    - [GeeTest](#geetest)\n    - [KeyCaptcha](#keycaptcha)\n    - [Capy](#capy)\n    - [Grid (ReCaptcha V2 Old Method)](#grid)\n    - [Canvas](#canvas)\n    - [ClickCaptcha](#clickcaptcha)\n    - [Rotate](#rotate)\n    - [Lemin](#lemin)\n  - [Other methods](#other-methods)\n    - [send / getResult](#send--get_result)\n    - [balance](#balance)\n    - [report](#report)\n  - [Proxies](#proxies)\n  - [Error handling](#error-handling)\n- [Get in touch](#get-in-touch)\n- [Join the team 👪](#join-the-team-)\n- [License](#license)\n  - [Graphics and Trademarks](#graphics-and-trademarks)\n\n\n## Installation\nThe api code is a single header file api2captcha.hpp, just copy it to your project and include where needed. You need to provide a HTTP-client implementation, as there is no standard one in C++. A sample HTTP-client based on libcurl is in curl_http.hpp (libcurl v. 7.62 or higher required), include it if you are using libcurl.\n\n## Configuration\n`Client` instance can be created like this:\n```c++\napi2captcha::client_t client (\"YOUR_API_KEY\");\n```\nThere are few options that can be configured:\n```c++\nclient.set_soft_id (123);\nclient.set_callback (\"https://your.site/result-receiver\");\nclient.set_default_timeout (120);\nclient.set_recaptcha_timeout (600);\nclient.set_polling_interval (10);\n```\n\n### Client instance options\n\n|Option|Default value|Description|\n|---|---|---|\n|soft_id|-|your software ID obtained after publishing in [2captcha software catalog]|\n|callback|-|URL of your web-sever that receives the captcha recognition result. The URl should be first registered in [pingback settings] of your account|\n|default_timeout|120|Timeout in seconds for all captcha types except ReCaptcha. Defines how long the module tries to get the answer from `res.php` API endpoint|\n|recaptcha_timeout|600|Timeout for ReCaptcha in seconds. Defines how long the module tries to get the answer from `res.php` API endpoint|\n|polling_interval|10|Interval in seconds between requests to `res.php` API endpoint, setting values less than 5 seconds is not recommended|\n\n\u003e  **IMPORTANT:** once *callback URL* is defined for `client` instance with `set_callback`, all methods return only the captcha ID and DO NOT poll the API to get the result. The result will be sent to the callback URL.\nTo get the answer manually use [get_result method](#send--getresult)\n\n## Solve captcha\nWhen you submit any image-based captcha use can provide additional options to help 2captcha workers to solve it properly.\n\n### Captcha options\n|Option|Default Value|Description|\n|---|---|---|\n|numeric|0|Defines if captcha contains numeric or other symbols [see more info in the API docs][post options]|\n|min_len|0|minimal answer length|\n|max_len|0|maximum answer length|\n|phrase|0|defines if the answer contains multiple words or not|\n|case_sensitive|0|defines if the answer is case sensitive|\n|calc|0|defines captcha requires calculation|\n|lang|-|defines the captcha language, see the [list of supported languages] |\n|hint_img|-|an image with hint shown to workers with the captcha|\n|hint_text|-|hint or task text shown to workers with the captcha|\n\nBelow you can find basic examples for every captcha type. Check out [examples directory] to find more examples with all available options. You can build examples using 'make API_KEY=YOUR_API_KEY'. You can get example captchas from [2captcha demos](https://2captcha.com/demo).\n\n### Basic example\nExample below shows a basic solver call example with error handling.\n\n```c++\napi2captcha::normal_t captcha;\ncaptcha.set_file (\"path/to/captcha.jpg\");\ncaptcha.set_min_len (4);\ncaptcha.set_max_len (20);\ncaptcha.set_case_sensitive (true);\ncaptcha.set_lang (\"en\");\n\ntry\n{\n    client.solve (captcha);\n    printf (\"Captcha solved: '%s'\\n\", captcha.code ().c_str ());\n}\ncatch (std::exception \u0026 e)\n{\n    fprintf (stderr, \"Error occurred: %s\\n\" + e.what ());\n}\n```\n\n### Normal Captcha\nTo bypass a normal captcha (distorted text on image) use the following method. This method also can be used to recognize any text on the image.\n\n```c++\napi2captcha::normal_t captcha;\ncaptcha.set_file (\"path/to/captcha.jpg\");\ncaptcha.set_numeric (4);\ncaptcha.set_min_len (4);\ncaptcha.set_max_len (20);\ncaptcha.set_phrase (true);\ncaptcha.set_case_sensitive (true);\ncaptcha.set_calc (false);\ncaptcha.set_lang (\"en\");\ncaptcha.set_hint_img_file (\"path/to/hint.jpg\");\ncaptcha.set_hint_text (\"Type red symbols only\");\n```\n\n### Text Captcha\nThis method can be used to bypass a captcha that requires to answer a question provided in clear text.\n\n```c++\napi2captcha::text_t captcha;\ncaptcha.set_text (\"If tomorrow is Saturday, what day is today?\");\ncaptcha.set_lang (\"en\");\n```\n\n### ReCaptcha v2\nUse this method to solve ReCaptcha V2 and obtain a token to bypass the protection.\n\n```c++\napi2captcha::recaptcha_t captcha;\ncaptcha.set_site_key (\"6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-\");\ncaptcha.set_url (\"https://mysite.com/page/with/recaptcha\");\ncaptcha.set_invisible (true);\ncaptcha.set_action (\"verify\");\ncaptcha.set_proxy (\"HTTPS\", \"login:password@IP_address:PORT\");\n```\n### ReCaptcha v3\nThis method provides ReCaptcha V3 solver and returns a token.\n\n```c++\napi2captcha::recaptcha_t captcha;\ncaptcha.set_site_key(\"6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-\");\ncaptcha.set_url (\"https://mysite.com/page/with/recaptcha\");\ncaptcha.set_version (\"v3\");\ncaptcha.set_action (\"verify\");\ncaptcha.set_score (0.3);\ncaptcha.set_proxy (\"HTTPS\", \"login:password@IP_address:PORT\");\n```\n\n### FunCaptcha\nFunCaptcha (Arkoselabs) solving method. Returns a token.\n\n```c++\napi2captcha::funcaptcha_t captcha;\ncaptcha.set_site_key (\"69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC\");\ncaptcha.set_url (\"https://mysite.com/page/with/funcaptcha\");\ncaptcha.set_surl (\"https://client-api.arkoselabs.com\");\ncaptcha.set_user_agent (\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36\");\ncaptcha.set_data (\"anyKey\", \"anyValue\");\ncaptcha.set_proxy (\"HTTPS\", \"login:password@IP_address:PORT\");\n```\n\n### GeeTest\nMethod to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.\n\n```c++\napi2captcha::geetest_t captcha;\ncaptcha.set_gt (\"f2ae6cadcf7886856696502e1d55e00c\");\ncaptcha.set_api_server (\"api-na.geetest.com\");\ncaptcha.set_challenge (\"12345678abc90123d45678ef90123a456b\");\ncaptcha.set_url (\"https://mysite.com/captcha.html\");\ncaptcha.set_proxy (\"HTTPS\", \"login:password@IP_address:PORT\");\n```\n\n### KeyCaptcha\nToken-based method to solve KeyCaptcha.\n\n```c++\napi2captcha::keycaptcha_t captcha;\ncaptcha.set_user_id (10);\ncaptcha.set_session_id (\"493e52c37c10c2bcdf4a00cbc9ccd1e8\");\ncaptcha.set_web_server_sign (\"9006dc725760858e4c0715b835472f22\");\ncaptcha.set_web_server_sign2 (\"2ca3abe86d90c6142d5571db98af6714\");\ncaptcha.set_url (\"https://www.keycaptcha.ru/demo-magnetic/\");\ncaptcha.set_proxy (\"HTTPS\", \"login:password@IP_address:PORT\");\n```\n\n### Capy\nToken-based method to bypass Capy puzzle captcha.\n\n```c++\napi2captcha::capy_t captcha;\ncaptcha.set_site_key (\"PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v\");\ncaptcha.set_url (\"https://www.mysite.com/captcha/\");\ncaptcha.set_proxy (\"HTTPS\", \"login:password@IP_address:PORT\");\n```\n\n### Grid\nGrid method is originally called Old ReCaptcha V2 method. The method can be used to bypass any type of captcha where you can apply a grid on image and need to click specific grid boxes. Returns numbers of boxes.\n\n```c++\napi2captcha::grid_t captcha;\ncaptcha.set_file (\"path/to/captcha.jpg\");\ncaptcha.set_rows (3);\ncaptcha.set_cols (3);\ncaptcha.set_previous_id (0);\ncaptcha.set_can_skip (false);\ncaptcha.set_lang (\"en\");\ncaptcha.set_hint_img_file (\"path/to/hint.jpg\");\ncaptcha.set_hint_text (\"Select all images with an Orange\");\n```\n\n### Canvas\nCanvas method can be used when you need to draw a line around an object on image. Returns a set of points' coordinates to draw a polygon.\n\n```c++\napi2captcha::canvas_t captcha;\ncaptcha.set_file (\"path/to/captcha.jpg\");\ncaptcha.set_previous_id (0);\ncaptcha.set_can_skip (false);\ncaptcha.set_lang (\"en\");\ncaptcha.set_hint_img_file (\"path/to/hint.jpg\");\ncaptcha.set_hint_text (\"Draw around apple\");\n```\n\n### ClickCaptcha\nClickCaptcha method returns coordinates of points on captcha image. Can be used if you need to click on particular points on the image.\n\n```c++\napi2captcha::coordinates_t captcha;\ncaptcha.set_file (\"path/to/captcha.jpg\");\ncaptcha.set_lang (\"en\");\ncaptcha.set_hint_img_file (\"path/to/hint.jpg\");\ncaptcha.set_hint_text (\"Select all images with an Orange\");\n```\n\n### Rotate\nThis method can be used to solve a captcha that asks to rotate an object. Mostly used to bypass FunCaptcha. Returns the rotation angle.\n\n```c++\napi2captcha::rotate_t captcha;\ncaptcha.set_file (\"path/to/captcha.jpg\");\ncaptcha.set_angle (40);\ncaptcha.set_lang (\"en\");\ncaptcha.set_hint_img_file (\"path/to/hint.jpg\");\ncaptcha.set_hint_text (\"Put the images in the correct way up\");\n```\n### Lemin\nUse this method to solve Lemin and obtain a token to bypass the protection.\n\n```c++\napi2captcha::lemin lemin;\nlemin.setCaptchaid (\"CROPPED_5a29582_ca114c2f3314482c84cd32fc7d2feb63\");\nlemin.setUrl (\"https://2captcha.com/demo/lemin\");\nlemin.setApiServer(\"api.leminnow.com\");\n```\n\n## Other methods\n\n### send / get_result\nThese methods can be used for manual captcha submission and answer polling.\n\n```c++\nstd::string captcha_id = solver.send (captcha);\n\nstd::this_thread::sleep_for (std::chrono::seconds (10));\n\nstd::string code = solver.get_result (captcha_id);\n```\n### balance\nUse this method to get your account's balance\n\n```c++\ndouble balance = solver.get_balance ();\n```\n### report\nUse this method to report good or bad captcha answer.\n\n```c++\nsolver.report (captcha.id (), true); // captcha solved correctly\nsolver.report (captcha.id (), false); // captcha solved incorrectly\n```\n\n## Proxies\nYou can pass your proxy as an additional argument for methods: recaptcha, funcaptcha, geetest, keycaptcha, capy puzzle, and etc. The proxy will be forwarded to the API to solve the captcha.\n\nWe have our own proxies that we can offer you. [Buy residential proxies] for avoid restrictions and blocks. [Quick start].\n\n## Error handling\nIf case of an error captcha solver throws an exception. It's important to properly handle these cases. We recommend to use `try catch` to handle exceptions.\n\n```c++\ntry\n{\n    solver.solve (captcha);\n}\ncatch (api2captcha::network_exception_t \u0026 e)\n{\n    // network error occurred\n}\ncatch (api2captcha::api_exception_t \u0026 e)\n{\n    // api respond with error\n}\ncatch (api2captcha::timeout_exception_t \u0026 e)\n{\n    // captcha is not solved so far\n}\n```\n\n## Get in touch\n\n\u003ca href=\"mailto:support@2captcha.com\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/539df209-7c85-4fa5-84b4-fc22ab93fac7\" width=\"80\" height=\"30\"\u003e\u003c/a\u003e\n\u003ca href=\"https://2captcha.com/support/tickets/new\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/be044db5-2e67-46c6-8c81-04b78bd99650\" width=\"81\" height=\"30\"\u003e\u003c/a\u003e\n\n## Join the team 👪\n\nThere are many ways to contribute, of which development is only one! Find your next job. Open positions: AI experts, scrapers, developers, technical support, and much more! 😍\n\n\u003ca href=\"mailto:job@2captcha.com\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/36d23ef5-7866-4841-8e17-261cc8a4e033\" width=\"80\" height=\"30\"\u003e\u003c/a\u003e\n\n\n## License\n\nThe code in this repository is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details.\n\n### Graphics and Trademarks\n\nThe graphics and trademarks included in this repository are not covered by the MIT License. Please contact \u003ca href=\"mailto:support@2captcha.com\"\u003esupport\u003c/a\u003e for permissions regarding the use of these materials.\n\n\u003c!-- Shared links --\u003e\n[examples directory]: /examples/\n[2Captcha]: https://2captcha.com/\n[2captcha software catalog]: https://2captcha.com/software\n[pingback settings]: https://2captcha.com/setting/pingback\n[post options]: https://2captcha.com/2captcha-api#normal_post\n[list of supported languages]: https://2captcha.com/2captcha-api#language\n[Buy residential proxies]: https://2captcha.com/proxy/residential-proxies\n[Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2captcha%2F2captcha-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2captcha%2F2captcha-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2captcha%2F2captcha-cpp/lists"}