# Fix

Source: https://docs.evomi.com/scraping-products-instructions/scraper-api/parameters/extraction/schema/fix/

When `fix=true`, the system enters **Autonomous Mode**. We will automatically generate or improve your `extract_scheme` based on the requirements provided in your `extract_prompt`. If `success=False` is false the scheme configuration will not be saved.

## Generate or Fix Scheme Configuration
| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| `test` | boolean | **Yes** | Must be `true` to enable Ai. |
| `fix` | boolean | **Yes** | Must be `true` to enable Ai. |
| `extract_prompt` | string | **Yes** | Describe what to find (e.g., "Extract product title and price"). 
| `extract_scheme` | array | No | **Optional.** Provide a valid or broken scheme, a rough outline ect.|
---

## How It Works Simplifed

1. **Initial Analysis**: The system scrapes the target page using your `config` and the Scraper Api.
2. **AI Synthesis**: Our AI analyzes the page structure against your `extract_prompt`.
3. **Generation**: A new `generated_scheme` is created.
4. **Validation**: The system runs a test scrape using the new scheme.
5. **Finalization**: The scheme is saved when extraction quality meets our standards.

---

## Example Request
```bash
curl -X POST https://scrape.evomi.com/api/v1/account/schemes \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "AI Product scheme",
    "config": {
      "url": "https://example.com/product"
    },
    "test": true,
    "fix": true,
    "extract_prompt": "Extract the product name, current price, and gallery images"
  }'
```

---

## Response Format

```json
{
  "success": true,
  "scheme_id": 115,
  "generated_scheme": [
    {
      "label": "title",
      "selector": "h1.product-title",
      "type": "content"
    }
  ],
  "message": "Quality adequate: 0/4 empty (0.0%)",
  "scrape_result": { "..." }
}
```

---

> **Credits**: Requires credits for the initial scrape plus the AI fee of 30 or 60 credits depending on fixes needed.
