How to replay a captured API
Replay an endpoint
Section titled “Replay an endpoint”After scouting, the worker tool replays captured API calls directly — no browser needed.
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" } }'Fast path vs. slow path
Section titled “Fast path vs. slow path”The worker tries two strategies:
-
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. -
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.
Passing data
Section titled “Passing data”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" }}Reading the response
Section titled “Reading the response”{ "success": true, "response": { "id": 42, "status": "submitted" }}The response field contains the target API’s response body, validated against the inferred schema.
When replay fails
Section titled “When replay fails”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.