Skip to main content

Getting Started

This page will guide you through generating your first CAPTCHA image.

OpenCaptcha uses a single endpoint:

POST https://api.opencaptcha.io/captcha

By sending a POST request with some basic parameters, you can receive a custom CAPTCHA image in response.


Step 1: Make a Basic Request

Below is a minimal example of how to call OpenCaptcha to generate a CAPTCHA.

Randomly distorted CAPTCHA

Try it out

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

Step 2: Explore Multilingual CAPTCHAs

OpenCaptcha supports various languages so you can use Chinese, Arabic and many other languages.

Multilingual CAPTCHA examples

Try it out

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

Step 3: Adjust Your Parameters

OpenCaptcha supports four main parameters: text, width, height, and difficulty. Here's how they work:

FieldTypeRequiredDescription
textstringYesThe text to display in the CAPTCHA image.
widthintegerNoThe width of the generated image in pixels (default: 400).
heightintegerNoThe height of the generated image in pixels (default: 100).
difficultyintegerNoThe difficulty level of CAPTCHA distortion.

Possible values: 0, 1, 2, 3 (default: 1).
  • text (Required)
    Provide the text you want to appear in the CAPTCHA. If this field is omitted, the request is invalid.

  • width and height (Optional)
    Set your custom dimensions. If these are left as null, the defaults (400×100) are used.

  • difficulty (Optional)

    • 0 – Easiest (minimal distortion)
    • 1 – Basic distortion (default)
    • 2 – Moderate distortion
    • 3 – Most challenging (heaviest distortion)

    If set to null, difficulty 1 is used.


Step 4: Understand the Responses

OpenCaptcha returns a JPEG image upon success, or an error status if something goes wrong:

HTTP StatusDescription
200 OKReturns the generated CAPTCHA image (JPEG) in the response body.
400 Bad RequestThe request is invalid (for example, missing or malformed parameters).
500 Internal Server ErrorAn unexpected error occurred on the server side.