Authentication
How to authenticate requests to the NoCaptchaAI API.
Every request to the NoCaptchaAI API must be authenticated with your API key. This page covers where to find your key and the two ways to send it.
Get an API key
Sign in to the NoCaptchaAI dashboard and copy your API key from the account page. The same key works across the async (/createTask), sync (/solve), and /balance endpoints.
The API base URL is:
https://api.nocaptchaai.comTreat your API key like a password. Never embed it in client-side code, browser extensions, mobile apps, or public repositories. Always call the API from a server you control, and rotate the key immediately if it leaks.
Authentication methods
There are two methods, depending on the endpoint you call.
| Method | Where the key goes | Endpoints |
|---|---|---|
clientKey | JSON request body | POST /createTask, POST /getTaskResult |
apikey | Request header | POST /solve |
Method 1 — clientKey in the JSON body
The async flow passes the key as a clientKey field inside the request body.
curl -X POST https://api.nocaptchaai.com/createTask \
-H "Content-Type: application/json" \
-d '{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "ImageToTextTask",
"body": "BASE64_IMAGE"
}
}'import requests
resp = requests.post(
"https://api.nocaptchaai.com/createTask",
json={
"clientKey": "YOUR_API_KEY",
"task": {
"type": "ImageToTextTask",
"body": "BASE64_IMAGE",
},
},
)
print(resp.json())const resp = await fetch("https://api.nocaptchaai.com/createTask", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
clientKey: "YOUR_API_KEY",
task: {
type: "ImageToTextTask",
body: "BASE64_IMAGE",
},
}),
});
console.log(await resp.json());The same clientKey is required when you poll for the result:
curl -X POST https://api.nocaptchaai.com/getTaskResult \
-H "Content-Type: application/json" \
-d '{ "clientKey": "YOUR_API_KEY", "taskId": "TASK_ID" }'Method 2 — apikey request header
The synchronous /solve endpoint reads the key from an apikey header instead of the body.
curl -X POST https://api.nocaptchaai.com/solve \
-H "apikey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "ImageToTextTask",
"body": "BASE64_IMAGE"
}'import requests
resp = requests.post(
"https://api.nocaptchaai.com/solve",
headers={"apikey": "YOUR_API_KEY"},
json={
"type": "ImageToTextTask",
"body": "BASE64_IMAGE",
},
)
print(resp.status_code, resp.json())const resp = await fetch("https://api.nocaptchaai.com/solve", {
method: "POST",
headers: {
apikey: "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
type: "ImageToTextTask",
body: "BASE64_IMAGE",
}),
});
console.log(resp.status, await resp.json());Check your balance
You can verify a key and see remaining credits with the /balance endpoint, which takes the key as the apiKey query parameter:
curl "https://api.nocaptchaai.com/balance?apiKey=YOUR_API_KEY"A KEY_DOES_NOT_EXIST error (code 1) means the key is missing or malformed. See Error Handling for the full list of error codes.