---
title: "How do I turn a UI test into API tests?"
section: "Use cases"
description: "Turn a web UI test into an API test in SmartestQA: capture the browser's calls with a Network step in List mode, run the test in a pipeline, and convert the calls to API Request steps with Make API test, login token included."
url: https://docs.smartestqa.ai/en/use-case-ui-to-api.html
audience: [customer, admin]
updated: 2026-11-12
keywords: "ui test to api test convert ui test to api test network capture capture browser traffic network calls make api test network step list mode api test from recording generate api tests from ui login token authToken baseUrl convert to api steps api tests from browser traffic instead of copying requests by hand api test example alternative to writing api test scripts"
---
# Use cases: How do I turn a UI test into API tests?

In SmartestQA a web test case with a Network step in List mode records the calls the browser makes during a pipeline run. In Maintenance, on the Network Calls tab, Make API test turns the calls you pick into API Request steps in a new test case, with the login token extracted and secrets replaced by variables.

## In short

**On this page you can**

- Capture the API calls behind a web UI flow during a normal run.
- Turn the captured calls into API Request steps in a new test case.
- Keep the login: the token is extracted and sent by the later requests.
- Replace the host with a {{baseUrl}} variable for every environment.
- Generate a JMeter test from the new API test case.

**How to use it**

1. Add a Network step in List mode at the end of the web test case.
2. Run the test case in a pipeline.
3. Open Maintenance , tab Network Calls , and click Make API test .
4. Pick the requests, set the two options and click Create with n steps .
5. Define the listed variables, add assertions and run the new test case.

## The short answer

You do not rebuild the requests by hand. A **Network step** in **List** mode writes the calls of the browser session, with their requests and responses, to the report. After the test case has run in a pipeline, **Maintenance** lists it on the **Network Calls** tab. Click [**Make API test**](https://docs.smartestqa.ai/en/maintenance-network-calls.html#make-api-test), pick the requests, and SmartestQA creates a new test case in the same folder with one API Request step per request, in capture order.

Network steps exist only in WEB projects, so this path starts from a web test.

## The problem this solves

Many teams have UI tests for their main flows and few or no API tests. To add them, someone has to find out which calls a screen makes. Often that means opening the browser’s developer tools, clicking through the flow and copying the calls one by one into a client or a script.

That takes patience, and it has traps. The copied calls carry a token that soon expires, and sometimes a password. The login has to be rebuilt so later calls get a fresh token. When the flow changes, the copying starts again. So the API tests are often put off, although the UI test already makes every call that is needed.

## An example

This is an illustration, not a customer story. A team tests an HR portal and has a web test case named “Submit leave request” that logs in, fills the form and checks the confirmation.

1. A tester opens the test case in Automate, clicks [**Network**](https://docs.smartestqa.ai/en/automate-steps-network.html#add-network-step), picks **List** and [**Set it up myself**](https://docs.smartestqa.ai/en/automate-steps-network.html#add-network-step), leaves the URL empty and adds the step at the end. It shows the chip **Net List**.
2. The test case runs in the nightly pipeline, as it did before.
3. The next morning the tester opens Maintenance and the Network Calls tab. Under **Pending** there is one row for the test case, and the tester clicks [**Make API test**](https://docs.smartestqa.ai/en/maintenance-network-calls.html#make-api-test).
4. The dialog [**Network → API steps**](https://docs.smartestqa.ai/en/maintenance-network-calls.html#make-api-test) opens on the filter **API calls**. The request marked **Login** and the portal’s own calls are pre-selected, and the counter says “6 requests selected”. The tester turns on **Replace the host with a {{baseUrl}} variable (update it in one place per environment)**.
5. The name is pre-filled as “Submit leave request - API”. A click on **Create with 6 steps** answers “Submit leave request - API created (6 API steps)”. The new test case opens in Automate and the row moves to **Converted**.
6. The tester defines the listed variables, among them `baseUrl` and the password that was masked, adds an Assertion on the status of each response and runs the test case.

The team now has an API test for the flow without having copied a single call.

## Copied by hand, with your own scripts, and with SmartestQA

| Question | Calls copied by hand from the browser | Your own API test scripts | SmartestQA |
| --- | --- | --- | --- |
| How do you find the calls a screen makes? | Click through the flow with the developer tools open | Read the API documentation or ask the developers | A Network step in **List** mode writes them to the report during a pipeline run |
| Who builds the requests? | A person, one by one | Someone who writes code | [**Make API test**](https://docs.smartestqa.ai/en/maintenance-network-calls.html#make-api-test) creates one API Request step per selected request, in capture order |
| What happens to the login? | The copied token works until it expires | You write the login call and pass the token on | The token of the login request is stored in `{{authToken}}` and later requests send it |
| What happens to passwords and tokens? | They are in the copied call unless you remove them | In configuration you manage | The report masks them as `***`; the conversion turns them into variables that you fill in |
| What is left for you to do? | Everything after the copy, including the checks | Everything | Define the listed variables, add custom headers your API needs, and add assertions: an API step passes for every HTTP status |
| Where does it work? | Any application you can open in a browser | Any API | WEB projects only, for test cases that have run in a pipeline or scheduled run |

## Steps

1. **Add a Network step in List mode**

   Open the web test case in Automate and click [**Network**](https://docs.smartestqa.ai/en/automate-steps-network.html#add-network-step) on the step toolbar. In the dialog [**Add Network step**](https://docs.smartestqa.ai/en/automate-steps-network.html#add-network-step) pick **List** and [**Set it up myself**](https://docs.smartestqa.ai/en/automate-steps-network.html#add-network-step). The URL is optional (“Leave empty to list every call.”). Fill [**Test Step Name**](https://docs.smartestqa.ai/en/automate-editor.html#rename-step) and click **Add**. Put the step at the end of the flow: by default List uses the **Scope** “Whole session”. See [List](https://docs.smartestqa.ai/en/automate-steps-network.html#list).

   The step appears with the chip **Net List**.
2. **Run the test case in a pipeline**

   The Network Calls tab lists a test case only after it has run in a [pipeline or scheduled run](https://docs.smartestqa.ai/en/schedule-runs.html). New runs update the row; they do not add rows.
3. **Open Network Calls**

   Open **Maintenance** and the **Network Calls** tab. It opens on **Pending**, with one row per test case: “*s* Network steps · *c* calls”, the date of the latest run and the number of runs. Click [**Make API test**](https://docs.smartestqa.ai/en/maintenance-network-calls.html#make-api-test). From a [report](https://docs.smartestqa.ai/en/report-steps.html#network-report), [**Convert to API steps**](https://docs.smartestqa.ai/en/maintenance-network-calls.html#make-api-test) brings you to the same dialog.
4. **Pick the requests**

   The dialog [**Network → API steps**](https://docs.smartestqa.ai/en/maintenance-network-calls.html#make-api-test) opens on the filter **API calls**. Tick or untick rows, or use **Select All** for the visible filter. The counter says “*n* requests selected”. Keep the request marked **Login** selected whenever later calls need a token.
5. **Choose the two options**

   [**Add Bearer {{authToken}} to requests after login**](https://docs.smartestqa.ai/en/maintenance-network-calls.html#make-api-test) is on by default: requests after the login request send its token. **Replace the host with a {{baseUrl}} variable (update it in one place per environment)** is off by default; turn it on when the same API runs on several environments.
6. **Read the warnings, name and create**

   The dialog lists what you must fill in afterwards, for example “You need to define values for these variables: …”. **New test case name** is pre-filled as “<test case> - API”. Click **Create with n steps**.

   “<name> created (*n* API steps)”. The new test case opens in Automate, and the row moves to **Converted**.
7. **Finish the API test case**

   Define the listed [variables](https://docs.smartestqa.ai/en/automate-test-data.html#variables), add any [custom headers](https://docs.smartestqa.ai/en/automate-steps-api.html#request-fields) your API needs, add [assertions](https://docs.smartestqa.ai/en/automate-steps-assertions.html) on the responses, and [run it](https://docs.smartestqa.ai/en/automate-dry-run.html#start-dry-run). An API step passes for every HTTP status, so the assertions are what make the test fail. See [Check the status code](https://docs.smartestqa.ai/en/automate-steps-api.html#check-the-status).

## What the conversion does with the capture

| In the capture | In the new API test case |
| --- | --- |
| Each selected request | One [API Request step](https://docs.smartestqa.ai/en/automate-steps-api.html), in capture order, named by method and path, for example `POST /api/orders`. Query parameters are kept. |
| The login request (its response contains a session token) | A JSON extractor stores the token in `{{authToken}}`, and a refresh token in `{{refreshToken}}`. |
| A masked Authorization header | Bearer `{{authToken}}` |
| A masked header or body field, such as a password | A `{{name}}` variable; you fill in the value. |
| Browser headers: Host, Cookie, User-Agent, Referer, Origin, caching and similar | Not copied |
| A body that is truncated in the report | Marked “truncated”: “The body is truncated in the report. Complete it after saving.” |
| The new test case | Created in the folder of the source test case, with its environment, and the description “Generated from the Network capture of the "<name>" run.” |

## Which requests are pre-selected

| Request | Pre-selected |
| --- | --- |
| Your app’s own API calls that did not fail, each method and path once | Yes |
| The login request, marked **Login** | Yes, unless it goes to a third-party site |
| The same method and path again, marked “duplicate” | No, only the first |
| Requests to other sites, analytics and tracking services | No |
| Static files: scripts, styles, images, fonts | No |
| WebSocket and event streams | No |
| OPTIONS and HEAD requests | No |

The filters **Pages**, **Static**, **Third party**, **Other** and **All** appear when there are such requests, so you can still tick them. See [Make an API test, step by step](https://docs.smartestqa.ai/en/maintenance-network-calls.html#make-api-test).

## What you get

- **An API test from a run you already have.** One API Request step per selected request, in the order the browser made the calls.
- **A working login.** The token of the login request is stored in `{{authToken}}` and the later requests send it.
- **No secrets copied.** The report masks Authorization, Cookie, Set-Cookie and X-API-Key headers and body fields such as password, token, secret or otp as `***`; the conversion turns them into variables.
- **One switch per environment.** With the `{{baseUrl}}` option the host is a variable; set `baseUrl` as a suite parameter.
- **A clear status.** The test case stays under **Converted** with a link to the API test case, even after later runs.
- **A path to load tests.** A JMeter test can be generated from the new test case in Automate.

## Questions and answers

### Q: Which test cases can I convert to API tests?

Test cases that have a Network step and have run in a pipeline or scheduled run. SmartestQA lists them in Maintenance on the Network Calls tab, one row per test case; the latest run of each Network step is used and all Network steps of the test case are combined in one list. See [What the tab lists](https://docs.smartestqa.ai/en/maintenance-network-calls.html#what-is-listed).

_Audience: customer, admin_

### Q: Why is my test case not on the Network Calls tab?

The tab lists a test case only when it has a Network step and has run in a pipeline or scheduled run. It opens on **Pending**; a test case that was already converted is under **Converted**. See [My test case is not listed](https://docs.smartestqa.ai/en/maintenance-troubleshooting.html#fix-network-missing).

_Audience: customer, admin_

### Q: Does this work for mobile or desktop tests?

No. Network steps exist only in WEB projects and are not offered in mobile and desktop projects. In those projects you can still add API steps from the API Requests library. See [Network step limits](https://docs.smartestqa.ai/en/automate-steps-network.html#limits).

_Audience: customer, admin_

### Q: Which Network step mode should I use for the capture?

**List**, for the whole session. Check and Get value capture a single request. List hides static files such as CSS, scripts and images and reports API calls, page loads and errors. See [The three modes](https://docs.smartestqa.ai/en/automate-steps-network.html#modes).

_Audience: customer, admin_

### Q: Does the capture see every call with Selenium and with Playwright?

Playwright sees all calls. Selenium sees fetch and XHR calls, and the first page load only in Chrome and Edge; iframes, service workers, sendBeacon, form posts and static files are not seen. See [Limits](https://docs.smartestqa.ai/en/automate-steps-network.html#limits).

_Audience: customer, admin_

### Q: What happens to passwords and tokens in the captured calls?

They are not copied. The report shows them as `***`, and the conversion adds them as variables: a masked Authorization header becomes Bearer `{{authToken}}`, a masked header or body field becomes a `{{name}}` variable that you fill in. See [What gets created](https://docs.smartestqa.ai/en/maintenance-network-calls.html#result).

_Audience: customer, admin_

### Q: What does “Requests use {{authToken}}, but no selected request produces a token.” mean?

The requests you picked send a token, but the login request is not among them. Select the request marked **Login** whenever later calls need a token. Each warning of the dialog is explained in [Troubleshooting](https://docs.smartestqa.ai/en/maintenance-troubleshooting.html#network-issues).

_Audience: customer, admin_

### Q: Can the API test run on DEV, TEST and PRP?

Yes. Turn on **Replace the host with a {{baseUrl}} variable (update it in one place per environment)** in the dialog and define `baseUrl`, for example as a suite parameter in the pipeline. See [“{{baseUrl}} must be defined at run time”](https://docs.smartestqa.ai/en/maintenance-troubleshooting.html#fix-baseurl).

_Audience: customer, admin_

### Q: My API needs a tenant or language header. Is it copied?

No. A List capture has no request headers, so add such a header to the API steps after the conversion. See [The request](https://docs.smartestqa.ai/en/automate-steps-api.html#request-fields).

_Audience: customer, admin_

### Q: Can I convert the same test case again?

The test case stays under **Converted**, even after later runs. If you delete the API test case that was created, the row returns to **Pending** and you can convert it again. See [After the conversion](https://docs.smartestqa.ai/en/maintenance-network-calls.html#after).

_Audience: customer, admin_

### Q: Can I load test the calls I captured?

Yes, in two steps: make the API test in Maintenance, then generate a JMeter test from that test case in Automate. See [Generate with AI from API steps](https://docs.smartestqa.ai/en/automate-steps-load.html#generate).

_Audience: customer, admin_

## Read more

- [Network Calls](https://docs.smartestqa.ai/en/maintenance-network-calls.html): the tab, the dialog and what gets created.
- [Network step](https://docs.smartestqa.ai/en/automate-steps-network.html): Check, Get value and List, with all settings.
- [API Request step](https://docs.smartestqa.ai/en/automate-steps-api.html): the request, JSON paths and status checks.
- [The API library](https://docs.smartestqa.ai/en/api-requests-library.html): build API tests from Postman, Swagger / OpenAPI or curl instead.
- [Maintenance FAQ](https://docs.smartestqa.ai/en/maintenance-faq.html): more questions and the limits.
- [How do I test a REST API without writing code?](https://docs.smartestqa.ai/en/use-case-api-testing.html): API steps and assertions from the start.
- [How do I get a load test from my functional tests?](https://docs.smartestqa.ai/en/use-case-load-test.html): the next step after the conversion.
