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

# What's the difference between an API scenario and a UI scenario?

> Choose API scenarios for direct HTTP behavior and UI scenarios for browser-visible user flows.

# What's the difference between an API scenario and a UI scenario?

API scenarios test your application through HTTP.

UI scenarios test your application through the browser, the way a user experiences it.

Both are reusable Qodex scenarios. The right choice depends on what kind of behavior you need to prove.

## Quick comparison

| Scenario type | What it runs                        | Best for                                        | Rerun cost                              |
| ------------- | ----------------------------------- | ----------------------------------------------- | --------------------------------------- |
| API           | HTTP requests and assertions        | Status codes, payloads, auth, IDOR, rate limits | LLM-free after authoring                |
| UI            | Chromium actions through Playwright | Forms, redirects, visible errors, browser state | LLM-free after the replay cache is warm |
| Mixed         | Browser and API steps together      | Login in browser, then assert API behavior      | Depends on the step type                |

## Use API scenarios when

* The behavior can be tested with raw HTTP.
* You care about response shape, status code, headers, or payload values.
* You are testing authorization, mass assignment, rate limits, or API contracts.
* You want the fastest and cheapest replay path.

## Use UI scenarios when

* The visible user experience matters.
* The flow includes redirects, forms, modals, OAuth, or browser-only state.
* You need screenshots or step artifacts.
* The bug cannot be proven from API traffic alone.

## Simple rule

If the bug can be reproduced with `curl`, use an API scenario.

If you need to see what the user sees, use a UI scenario.

## Next steps

<CardGroup cols={2}>
  <Card title="Scenarios concept" icon="list-checks" href="/concepts-scenarios">
    Understand reusable Qodex scenarios.
  </Card>

  <Card title="API testing scenarios" icon="plug" href="/api-testing-scenarios">
    Create direct endpoint tests.
  </Card>

  <Card title="Intent-driven UI scenarios" icon="sparkles" href="/ui-testing-intent-driven-scenarios">
    Create browser-driven tests.
  </Card>

  <Card title="LLM cost on reruns" icon="receipt" href="/kb-llm-cost-on-reruns">
    Understand why saved scenarios rerun cheaply.
  </Card>
</CardGroup>
