Captcha OCR

Send base64 with no line breaks

2026-01-27 · Captchas

The image field is one JSON string. Line wraps from the base64 tool must be removed.

JSON does not allow a raw newline inside a string. base64 on macOS wraps at 76 columns unless you pass a flag. Those wraps make the body invalid, and the API answers 422.

base64 < captcha.png | tr -d '\n' is the usual shell fix. In Python, base64.b64encode(...).decode() does not wrap. In Node, Buffer.from(bytes).toString('base64') does not wrap.

A data:image/png;base64, prefix is accepted. The characters after the comma still have to be the image, with no line breaks.

The samples in the quickstart already strip the newlines. Copy those, and keep the key in the environment.

Ready to call it? Start with the quickstart, the API guide, or pricing.

More in Captchas