Self-Healing
Let AI automatically generate, repair, and extend Manual Scraper workflows from the dashboard or through the Self-Heal API.
Websites change their markup all the time. When a selector breaks, a Manual Scraper keeps running but returns empty or partial data. Self-Healing uses AI to automatically generate, repair, and extend Manual Scraper workflows so you don't have to write or update selectors manually.
You can use Self-Healing in two ways:
- UI Platform: Generate a full workflow or generate/repair single steps directly inside the scraper builder using the AI buttons.
- Self-Heal API Access: Trigger automated workflow repairs programmatically using the API endpoint.
Tip
Self-Healing is also useful for a scraper you haven't built yet. Point it at a URL and let the AI generate the full workflow automatically, then fine-tune the steps yourself.
When to Use Self-Healing
- Website Redesign: The scraper suddenly returns empty fields because the target website changed its markup.
- Automated Workflow Creation: You want to automatically generate a starting workflow for a new URL instead of writing every step manually.
- Single Step Repair: One specific step is broken while the rest of the workflow still functions properly.
- Multi-URL Coverage: You want a step or workflow to cover additional URLs or page layouts on the same website.
Generate a Full Workflow
You can generate an entire multi-step workflow automatically using the main AI button at the top of the scraper builder:
Open a manual scraper or create a new one.
Click the + AI button at the top right of the builder. Select Create Workflow if you are creating a new scraper, or Replace All to replace an existing workflow.
Enter your prompt (or let the AI inspect the page) and wait for the AI to generate the workflow steps.
Review the generated steps, fine-tune any selectors or code, then click Save.
Review before saving
Generating a full workflow overwrites the steps currently shown in the builder. Run the scraper and check the output before saving over a workflow you still rely on.
Generate or Repair a Single Step
Instead of rebuilding the entire workflow, you can generate or repair an individual step. Every step block in the workflow builder has its own dedicated + AI button in its top-right corner.
Clicking the + AI button on an individual step reveals two options:
| Option | What it does | Use it when |
|---|---|---|
| Extend Step | Keeps the existing step configuration and extends it so the workflow can cover additional URLs or page layouts. | The step works on some pages but fails on others, and you want one step/workflow to cover multiple page variants. |
| Replace Step | Discards the current step configuration and generates a new one for the target page URL. | The step is broken or outdated, and you want to replace its configuration with a newly generated workflow step. |
Locate the step you want to modify in the builder, then click its + AI button.
Select either Extend Step or Replace Step based on your objective.
Wait for the AI to inspect the page and generate the updated step configuration.
Review the generated selectors or JavaScript code, then click Save to persist the workflow.
Extend vs Replace
- Extend Step is additive: it broadens the step so the workflow can cover additional URLs and layout variants.
- Replace Step replaces the existing step configuration with a brand new workflow step for the current URL.
Self-Heal API Access
Besides using Self-Healing in the UI platform, MrScraper also provides the Self-Heal API. This allows you to trigger automated workflow repairs programmatically from a monitoring script, a scheduled task, or your own application whenever a scraper detects empty or invalid results.
Accessing Self-Heal API in the Dashboard
You can retrieve the API endpoint, your scraper ID, and your API token directly from the scraper dashboard:
Open your manual scraper in the builder dashboard.
Click the ⋮ (more options) menu icon at the top right of the page.
Select Self-Heal API Access from the menu.
In the popup modal, enter or copy your API token (or click Generate to create a new one). The modal provides a ready-made cURL example pre-configured with your scraperId and token.
Note
See Authentication for more details on managing API tokens.
Request
curl --request POST "https://api.app.mrscraper.com/api/v1/scrapers-manual/{scraperId}/heal" \
--header "accept: application/json" \
--header "x-api-token: YOUR_API_TOKEN"| Parameter | Type | Location | Required | Description |
|---|---|---|---|---|
x-api-token | string | header | Yes | Your MrScraper API token |
scraperId | string | path | Yes | The ID of the manual scraper you want to repair (found in the scraper URL or API Access modal) |
See Self-Heal a Manual Scraper in the API reference for the complete OpenAPI schema and error handling details.
Response
{
"message": "Successful operation!",
"data": {
"success": true,
"scraperId": "<SCRAPER_ID>",
"workflowUpdated": true
}
}Safe repair execution
The endpoint asks the AI engine to repair the current workflow. The scraper's saved workflow is updated only when a valid workflow response is returned. If the repair attempt fails, your existing workflow configuration remains unchanged.