Skip to content

How to replay a captured API

After scouting, the worker tool replays captured API calls directly — no browser needed.

Terminal window
curl -X POST https://your-unsurf-url.workers.dev/tools/worker \
-H "Content-Type: application/json" \
-d '{
"pathId": "your-path-id",
"data": {
"name": "Jane Doe",
"email": "jane@example.com"
}
}'

The worker tries two strategies:

  1. Fast path — if the scouted path found a direct API endpoint (e.g., POST /api/contact), the worker replays the HTTP call directly. This takes milliseconds.

  2. Slow path — if no direct API endpoint exists (e.g., the form submits through JavaScript), the worker launches a browser and executes the step-by-step path. This takes seconds.

The worker chooses automatically. You don’t need to specify which.

The data field maps to the captured endpoint’s request schema. If the scout found a POST /api/contact with fields name, email, and message, pass those:

{
"pathId": "example-com-contact-form",
"data": {
"name": "Jane Doe",
"email": "jane@example.com",
"message": "Hello from unsurf"
}
}
{
"success": true,
"response": {
"id": 42,
"status": "submitted"
}
}

The response field contains the target API’s response body, validated against the inferred schema.

If the target site has changed since the scout, the worker will return an error. Use the heal tool to re-scout and update the path automatically.