> ## Documentation Index
> Fetch the complete documentation index at: https://docs.brightdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Understanding the AI Scraper Studio APIs

> Bright Data Scraper Studio AI Flow API overview, covering 5 endpoints. Returns AI scraper template or job progress data as JSON with 200 OK on success.

The AI Scraper Studio API is a set of endpoints that let you create Scraper Studio scrapers with AI and update existing scrapers using Self-Healing tool, without using the UI. This page explains which endpoint to call and in what order.

Both flows are asynchronous: you start an AI job, then check its progress until it completes.

## Workflow 1: Create a new scraper with AI

Use these endpoints when you want AI to generate a scraper (schema + code) from scratch for a target site.

1. Create the scraper entity\
   → <Badge color="blue"><a href="/api-reference/scraper-studio-api/ai-flow/create-scraper-template" target="_blank">Create scraper template</a></Badge>

2. Start the AI generation job (schema + code)\
   → <Badge color="blue"><a href="/api-reference/scraper-studio-api/ai-flow/trigger-ai-flow" target="_blank">Trigger AI Flow to create code</a></Badge>

3. Poll until the AI job finishes and returns the result\
   → <Badge color="blue"><a href="/api-reference/scraper-studio-api/ai-flow/ai-job-progress" target="_blank">AI job progress</a></Badge>

## Workflow 2: Update an existing scraper with Self-Healing

Use these endpoints when you already have a scraper and want to fix or modify it using a prompt.

1. Start a Self-Healing refactor job\
   → <Badge color="blue"><a href="/api-reference/scraper-studio-api/ai-flow/trigger-self-healing" target="_blank">Trigger Self-Healing</a></Badge>

2. Poll until the refactor job finishes and returns the result\
   → <Badge color="blue"><a href="/api-reference/scraper-studio-api/ai-flow/self-healing-job-progress" target="_blank">Self-Healing job progress</a></Badge>

3. After the scraper is ready, initiate collection\
   → <Badge color="blue"><a href="/api-reference/scraper-studio-api/Trigger_a_scraper_for_batch_collection_method" target="_blank">Initiate collection</a></Badge>

Once created or updated, run it using the standard Scraper Studio API initiation endpoints (manual trigger, schedule, queue, etc.).

<Columns cols={2}>
  <Tip>
    **Not sure which to use?**

    * No scraper yet → [Workflow 1](#workflow-1-create-a-new-scraper-with-ai)
    * Scraper needs changes → [Workflow 2](#workflow-2-update-an-existing-scraper-with-self-healing)
  </Tip>

  <Tip>
    **New to the API?**

    See: <a href="/api-reference/scraper-studio-api/Getting_started_wtih_the_API" target="_blank">Getting started with the API</a>
  </Tip>
</Columns>
