Skip to content

Commit 8d004cb

Browse files
committed
chore: update the captcha doc with manual captcha solving
1 parent b89f556 commit 8d004cb

File tree

1 file changed

+96
-2
lines changed

1 file changed

+96
-2
lines changed

content/docs/overview/captchas-api/overview.mdx

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,56 @@ CAPTCHA solving is particularly useful for:
1919
* AI agents that need to navigate CAPTCHA-protected websites
2020

2121

22+
### Session Configuration
23+
24+
To enable autosolving, simply set `solveCaptcha: true` when creating a session.
25+
26+
<CodeTabs storage="languageSwitcher">
27+
28+
```typescript !! Typescript -wcn
29+
import Steel from 'steel-sdk';
30+
31+
const client = new Steel();
32+
33+
const session = await client.sessions.create({
34+
solveCaptcha: true
35+
});
36+
```
37+
38+
```python !! Python -wcn
39+
from steel import Steel
40+
41+
client = Steel()
42+
session = client.sessions.create(
43+
solve_captcha=True
44+
)
45+
```
46+
</CodeTabs>
47+
48+
To detect CAPTCHAs without automatically solving them, disable `autoCaptchaSolving` in the stealth config:
49+
50+
<CodeTabs storage="languageSwitcher">
51+
52+
```typescript !! Typescript -wcn
53+
const session = await client.sessions.create({
54+
solveCaptcha: true,
55+
stealthConfig: {
56+
autoCaptchaSolving: false
57+
}
58+
});
59+
```
60+
61+
```python !! Python -wcn
62+
session = client.sessions.create(
63+
solve_captcha=True,
64+
stealth_config={
65+
"autoCaptchaSolving": False
66+
}
67+
)
68+
```
69+
</CodeTabs>
70+
71+
2272
### How CAPTCHA Solving Works with the CAPTCHAs API
2373

2474
Steel's CAPTCHAs API operates through a bridge architecture that connects your browser sessions with our external CAPTCHA-solving capabilities. It helps with four key parts:
@@ -76,11 +126,15 @@ The status endpoint returns an array of current pages and their CAPTCHA states.
76126
"type":"image_to_text",
77127
"status":"solving",
78128
"created":1640995200000,
79-
"totalDuration":5000
129+
"url":"https://example.com/login",
130+
"pageId":"page_12345",
131+
"detectionTime":1640995200500,
132+
"totalDuration":5000,
133+
"solveTime":1640995205500
80134
}
81135
],
82136
"created":1640995200000,
83-
"lastUpdated":1640995205000
137+
"lastUpdated":1640995205500
84138
}
85139
]
86140
```
@@ -95,6 +149,8 @@ Tasks can have the following statuses:
95149

96150
* `validating`: CAPTCHA is currently being validated
97151

152+
* `validation_failed`: CAPTCHA token failed validation after submission
153+
98154
* `solving`: CAPTCHA is currently being solved
99155

100156
* `solved`: CAPTCHA has been successfully solved
@@ -104,6 +160,44 @@ Tasks can have the following statuses:
104160
* `failed_to_solve`: CAPTCHA solving failed
105161

106162

163+
### Manual Solving
164+
165+
If auto-solving is disabled, use the solve endpoint to trigger solving. You can solve all detected CAPTCHAs or target specific ones.
166+
167+
The `taskId`, `url`, and `pageId` required for targeting specific CAPTCHAs can be retrieved from the CAPTCHA status response.
168+
169+
<CodeTabs storage="languageSwitcher">
170+
171+
```typescript !! Typescript -wcn
172+
// Solve all detected CAPTCHAs
173+
await client.sessions.captchas.solve('sessionId');
174+
175+
// Solve specific task
176+
await client.sessions.captchas.solve('sessionId', { taskId: 'task_123' });
177+
178+
// Solve by URL
179+
await client.sessions.captchas.solve('sessionId', { url: 'https://example.com' });
180+
181+
// Solve by Page ID
182+
await client.sessions.captchas.solve('sessionId', { pageId: 'page_123' });
183+
```
184+
185+
```python !! Python -wcn
186+
# Solve all detected CAPTCHAs
187+
client.sessions.captchas.solve("sessionId")
188+
189+
# Solve specific task
190+
client.sessions.captchas.solve("sessionId", task_id="task_123")
191+
192+
# Solve by URL
193+
client.sessions.captchas.solve("sessionId", url="https://example.com")
194+
195+
# Solve by Page ID
196+
client.sessions.captchas.solve("sessionId", page_id="page_123")
197+
```
198+
</CodeTabs>
199+
200+
107201
### Solving Image CAPTCHAs
108202

109203
For image-based CAPTCHAs, you can provide XPath selectors to help the system locate and solve the CAPTCHA.

0 commit comments

Comments
 (0)