1. Docs
  2. Resources
  3. API Requests
  4. Use requests in tests

Use saved requests in tests

An API step is a saved request inside a test case. This page covers adding one, why the step keeps its own copy, and the differences between Send on the API Requests page and a real run.

4 min read Updated CustomersAdmins

In short

On this page you can

  • Add a saved request to a test case as an API step.
  • Create a request and its step from a curl command in one go.
  • Try the step with test values before you run the test.
  • Know that each step keeps its own copy of the request.
  • Avoid the settings a run handles differently from Send.

How to use it

  1. In Automate, add an API step from the step toolbar.
  2. In Select API Request, find the request and click Add Step.
  3. Check the step’s request; replace secrets with {{ds:…}} references.
  4. Click the step’s Send and fill the Test values.
  5. Save the test case and run a Dry Run.

Add a saved request as a step#

  1. Open the test case in Automate

    Open the scenario and add an API step from the step toolbar.

  2. Find the request

    The dialog Select API Request shows the API library as a tree. Search with “Search by name, URL or method...”.

  3. Add it

    Click Add Step on the request. SmartestQA loads the full request and adds the step. If loading fails: “Failed to load API request; step not added.”

  4. Save the test case

    The step shows the request’s name and method. In the step you add extractors (for example @status or a JSON path) and later assertions; that part is described in Automate.

Automate: Select API Request dialog with the library tree, the search field, Create from curl and the Add Step button on a request
Select API Request in Automate.

From a curl command#

In Select API Request, click Create from curl: “Paste a curl command below. A new API Request will be created and added as a step.” The request is saved in the API library and the step is added. The same rules as pasting curl into the URL apply. Messages: “Empty curl command.”, “No URL found in the curl command.”, “Failed to parse the curl command.”, “Failed to create the API request.”

Each step keeps its own copy#

When you add a request, the step gets a copy of it. From then on the two are independent:

You changeEffect
The saved request in API RequestsExisting steps do not change. New steps get the new version.
The request inside a stepOnly that step changes. The library stays as it was.
Delete the saved requestSteps keep working.

To roll out a change to many tests, keep what changes in references: {{ds:apiBase}} for the address, {{ds:apiToken}} for the token. Changing the key changes every step at once. Otherwise edit each step, or remove it and add the request again.

Try the step#

The step’s own Send fills references before it sends:

  • Data Source keys get their value automatically. An encrypted key is sent as ••••••, because the screen never has the real value.
  • Everything that only exists during a run ({{tc:…}}, {{excel:…}}) is asked for in Test values: “These variables get their value during the test run. Enter a value to try the request; values are not saved.” “Empty fields are sent as empty text.”

Like Send on the API Requests page, it goes out from the SmartestQA server. For secured calls and internal APIs, check the step with a Dry Run (Run your first test).

What a run does differently#

Send on the pageTest run
Sent fromThe SmartestQA serverThe machine that runs the test: server, agent, self-hosted runner or AWS Device Farm (details)
MethodsPOST, PUT, DELETE; GET, PATCH, HEAD and OPTIONS go out as GETGET, POST, PUT, PATCH, DELETE. HEAD and OPTIONS fail with “Unsupported HTTP method”.
ReferencesData Source keys in the URL only, default valueEverywhere: URL, headers, params, body, Bearer token; environment variants apply
ParamsNot addedAdded to the URL; a parameter already in the URL is not sent twice
Bodyraw as typed; form-data as a JSON objectThe raw body, sent as JSON. form-data rows are not sent.
AuthorizationBearer, Basic, inheritedBearer only (see below)
Time limit30 seconds30 seconds
ResultThe response is shownAny HTTP status passes the step. Check @status with an extractor and an assertion. A timeout, SSL or connection error marks the step as an error; the test case continues.

Authorization in runs#

A run applies only Bearer Token. Basic Auth and Inherit from parent are still offered in the API step, but runs ignore them, so the call goes out without credentials and usually gets 401.

You needDo this in the step’s request
A tokenBearer Token with {{ds:apiToken}} (an encrypted key), or a token produced earlier in the run, such as {{tc:accessToken}}.
Basic loginA header Authorization with the value Basic {{ds:apiBasicAuth}}, where the encrypted key holds the Base64 of user:password.
The collection’s tokenSet Bearer Token on the request itself, with the same reference as the collection.
An API key headerA header such as X-Api-Key: {{ds:apiKey}}.

The run masks Authorization, token and API key headers in its logs. See Secrets in runs.

Bodies in runs#

A run fills references in the body, then reads it as JSON and sends it as JSON. A body that is not JSON, such as XML or plain text, is sent as one JSON text in quotes. The API step still offers form-data rows, but runs ignore them. Check such requests with a Dry Run and the request log before you rely on them.

AI assistants (MCP)#

An assistant connected through MCP adds or changes library requests with smartest_api_library (name, url, method, headers, queryParams, body, formData, authType, token, username, password). Tokens and passwords are accepted only as {{ds:key}} or {{tc:…}} references, never as literal values; the keys are created empty for you to fill. Scenarios then copy the request into an API step by its id, or carry their own request. More: FAQ › MCP.

If something goes wrong#

Didn’t find your answer?Write to support with your project name and what you see on screen.

info@smartestqa.ai
© 2026 Selenity Technology · SmartestQAsmartestqa.aiThis page as MarkdownChecked against smarttest-fe predev 2a8c79cc, smarttest-be 633c2a03, smarttest-testsuite (runner), smartest-mcp-server