📦 Generate integration code
🛡️

Mathcha · CAPTCHA

⚙️ Code Builder

Frontend language
Backend validation
FRONTEND · get challenge & verify
loading…
BACKEND · validate token
loading…

🚀 Integrate Mathcha in 3 steps

1. Frontend: get challenge

Fetch a math question from our API. Display it with the challenge token.

GET https://mathcha.riskylaw.workers.dev/?generate&type=mixed&difficulty=medium

2. User solves & verifies

Collect the answer and POST to our API with the challenge token.

POST https://mathcha.riskylaw.workers.dev/
{ "session": "ch_xxx", "answer": 42 }

3. Backend: validate token

On your server, check the verified token before processing.

POST https://mathcha.riskylaw.workers.dev/
{ "action": "check", "token": "mc_verified_..." }
🧩 Challenge & verify live
CHALLENGE idle
? ?
CHALLENGE TOKEN
→ backend
VERIFICATION RESULT
awaiting response …
VERIFIED TOKEN
🔐 Token validator check
1. Generate 2. Solve 3. Verify 4. Backend check

challenge token → solve → verified token (proof).
Tokens expire after 5 min, single‑use.

🔎 Validate token idle
enter a token to verify
BACKEND VALIDATION
POST /check
{ "token": "mc_verified_..." }
→ { "valid": true }

🛡️ only trust server‑side validation.

❓ FAQ

How do I get a verified token?

Generate a challenge, let the user solve it, then POST the answer to our API. If correct, we return a mc_verified_ token.

How long are tokens valid?

Both challenge and verified tokens expire after 2 minutes. They are single‑use and deleted after verification.

Is there a rate limit?

Yes, per IP: 15 challenge generations per minute, 15 answer verifications per minute, and 60 token checks per minute. Exceeding these returns a 429 error.

Can I use it on my own backend?

Yes! Call our API from your frontend to get the challenge, and validate the token on your server using the action: "check" endpoint.

What if the user gets it wrong?

The API returns { "success": false }. You can let them retry by generating a new challenge.

operations: plus minus times divide mixed difficulty: easy medium hard impossible mixed
© Mathcha. All rights reserved.