ashtonav / opencaptcha

Open source, free, public API that generates CAPTCHA images from text. Try it out at api.opencaptcha.io.

Home Page:https://opencaptcha.io

Repository from Github https://github.comashtonav/opencaptchaRepository from Github https://github.comashtonav/opencaptcha

OpenCaptcha

banner

codecov Maintainability Rating .NET license

OpenCaptcha is an open source, free, public API that generates CAPTCHA images from text.

OpenCaptcha provides:

Usage

Example 1: Generated CAPTCHA images are randomly distorted.

banner

Try it out

curl -X 'POST' \
  'https://api.opencaptcha.io/captcha' \
  -H 'Content-Type: application/json' \
  -d '{ "text": "captcha" }'

Example 2: Generated CAPTCHA images can contain text in many languages.

banner

Try it out

curl -X 'POST' \
  'https://api.opencaptcha.io/captcha' \
  -H 'Content-Type: application/json' \
  -d '{ "text": "普通" }'

Example 3: Generated CAPTCHA images can be in a different colors

banner

Try it out

curl -X 'POST' \
  'https://api.opencaptcha.io/captcha' \
  -H 'Content-Type: application/json' \
  -d '{
    "text": "hello world",
    "theme": {
      "primaryColor": "#ADD8E6",
      "secondaryColor": "#FFFFFF"
    }
  }'

Installation

Option 1: Using Docker (recommended for self-hosting)

Requirements

  • Docker

How to Run

  1. From the root folder of the project, run the following commands:
    docker build -t opencaptcha -f ./src/Captcha.WebApi/Dockerfile .
    docker run -it -p 5280:8080 opencaptcha
  2. The API can be accessed at http://localhost:5280.

Option 2: Using Visual Studio (recommended for development purposes)

Requirements

  • Visual Studio 2022
    • With ASP.NET and web development installed from the Visual Studio Installer
  • .NET 9 SDK

How to Run

  1. Open the solution in Visual Studio 2022.
  2. Build and launch the Captcha.WebApi project.
  3. The API can be accessed at https://localhost:5280.

How to Test

  1. Open the solution in Visual Studio 2022.
  2. Run the tests in Test Explorer.

Acknowledgments

A significant portion of this project, especially the CAPTCHA generation code, is inspired by work originally published on February 9, 2004, by BrainJar.

Contributing

Pull requests are accepted.

License

MIT

About

Open source, free, public API that generates CAPTCHA images from text. Try it out at api.opencaptcha.io.

https://opencaptcha.io

License:MIT License


Languages

Language:C# 88.6%Language:Gherkin 9.0%Language:Dockerfile 2.4%