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

# Spin up an AI-built website on a custom domain

> Brief Crevio to build a site from a prompt, poll the build task until it's live, then buy and assign a custom domain.

**Describe the site you want and Crevio builds it — then put it on a domain you own.** This recipe goes from a one-line brief to a live site on a custom domain. Builds and deploys run **asynchronously**, so the pattern throughout is: kick off → poll a Task until it's done.

<Note>
  A site build is driven by an AI **Task**. `POST /sites` returns a `build_task_id` — that's the [Task](/developer/guides/tasks) doing the engineering work. You poll the site (or that task) until `is_live` is true.
</Note>

## Recipe

<Steps>
  <Step title="Brief Crevio to build the site">
    The `prompt` is the build brief — your brand, what you sell, the look and feel. It kicks off an AI engineering build.

    ```bash theme={null}
    curl -X POST https://api.crevio.co/v1/sites \
      -H "Authorization: Bearer YOUR_API_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "Flow Yoga Studio",
        "prompt": "A warm, minimal site for a yoga and fitness studio that sells class memberships. Calm palette, bold class schedule, a featured unlimited-membership subscription, and an about page telling our instructors story.",
        "access_mode": "public"
      }'
    ```

    ```json theme={null}
    {
      "id": "site_def456",
      "object": "site",
      "name": "Flow Yoga Studio",
      "subdomain": "flow-yoga-studio",
      "app_url": "https://flow-yoga-studio.crevio.app",
      "is_live": false,
      "build_task_id": "task_build01",
      "domain": null,
      "domain_verified": false
    }
    ```

    The site exists immediately, but it's still building. Note `build_task_id`.
  </Step>

  <Step title="Poll the build task until the site is live">
    Poll the task (or re-fetch the site) until the build finishes and `is_live` becomes true.

    ```bash theme={null}
    curl https://api.crevio.co/v1/tasks/task_build01 \
      -H "Authorization: Bearer YOUR_API_TOKEN"
    ```

    ```bash theme={null}
    curl https://api.crevio.co/v1/sites/site_def456 \
      -H "Authorization: Bearer YOUR_API_TOKEN"
    ```

    ```json theme={null}
    {
      "id": "site_def456",
      "object": "site",
      "is_live": true,
      "app_url": "https://flow-yoga-studio.crevio.app"
    }
    ```

    Once `is_live` is true, the website is reachable at its `app_url`. Now attach a custom domain.
  </Step>

  <Step title="Search for an available domain">
    ```bash theme={null}
    curl "https://api.crevio.co/v1/domains/search?query=flowstudio" \
      -H "Authorization: Bearer YOUR_API_TOKEN"
    ```

    Returns availability and pricing for matching domains.
  </Step>

  <Step title="Purchase the domain">
    ```bash theme={null}
    curl -X POST https://api.crevio.co/v1/domains/purchase \
      -H "Authorization: Bearer YOUR_API_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{ "domain": "flowstudio.fit" }'
    ```

    ```json theme={null}
    {
      "id": "domain_ghi789",
      "object": "domain",
      "domain": "flowstudio.fit",
      "verified": false
    }
    ```

    Already own a domain elsewhere? Use `POST /domains/connect` with `{ "domain": "flowstudio.fit", "site": "site_def456" }` instead.
  </Step>

  <Step title="Assign the domain to your site">
    The field is `site` (not `site_id`).

    ```bash theme={null}
    curl -X POST https://api.crevio.co/v1/domains/domain_ghi789/assign \
      -H "Authorization: Bearer YOUR_API_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{ "site": "site_def456" }'
    ```
  </Step>

  <Step title="Verify the domain">
    Verification kicks off DNS setup and validation. It runs asynchronously — re-check until `verified` is true.

    ```bash theme={null}
    curl -X POST https://api.crevio.co/v1/domains/domain_ghi789/verify \
      -H "Authorization: Bearer YOUR_API_TOKEN"
    ```

    ```json theme={null}
    {
      "id": "domain_ghi789",
      "object": "domain",
      "domain": "flowstudio.fit",
      "verified": true
    }
    ```

    Once verified, your AI-built website is live on your own domain.
  </Step>
</Steps>

<Tip>
  Building from your own GitHub repo instead of a prompt? Pass `repository: "owner/repo"` to `POST /sites` (then `prompt` is optional). Multi-site is a paid feature.
</Tip>

## Next steps

<CardGroup cols={2}>
  <Card title="Tasks" icon="robot" href="/developer/guides/tasks">
    The engine behind site builds — your AI workforce.
  </Card>

  <Card title="Launch a paid course" icon="graduation-cap" href="/developer/guides/recipe-launch-paid-course">
    Add sellable products to your new site.
  </Card>

  <Card title="Autonomous outreach" icon="envelope" href="/developer/guides/recipe-autonomous-outreach">
    Drive traffic to your site with a research-and-email agent.
  </Card>

  <Card title="API overview" icon="book" href="/developer/guides/api-overview">
    The full set of primitives.
  </Card>
</CardGroup>
