---
title: "Generate test steps"
method: POST
path: "/generate/steps"
tags: ["TestGeneration"]
---

# Generate test steps

`POST /generate/steps`

Generate test steps from the given context information

## Query parameters

- `workspaceId` string, required

## Request body

- StepGenerationRequest — Request to generate test steps
  - `intent` string — The intent of the test as plain text
  - `context` TestCreationContext — The context of the test creation and training session
    - `applicationId` string — The ID of the application being used for training the test
    - `environmentId` string — The ID of the environment being used for training the test
    - `sessionId` string — The ID of the current test creation session
    - `testInvariantId` string — The invariant ID of the test
    - `testRunId` string — The ID of the test run
    - `url` string — The URL being used for training the test, if a web test
    - `testType` 'api' | 'browser' | 'performance' | 'mobile' — Type of test
    - `mobilePlatform` 'android' | 'ios' — The mobile platform associated with this object
    - `api_description` string — The description of the API being used for training the test, if an API test.
    - `variables` object — Key-value object containing the variables available for use in the test
    - `step_id` string — The ID of the step
    - `step_context` object — Key-value object containing the metadata about the step
    - `training_session_id` string — The ID of the training session

## Response `200`

The resulting test steps

- StepGenerationResponse — Response from generating test steps
  - `api_test_configuration` ApiConfiguration — Configuration of the API test type.
    - `authentication` ApiAuthentication — Configuration for API authentication
      - `type` 'apikey' | 'basic' | 'bearer' | 'noauth' | 'oauth1' | 'oauth2', required — The authentication type to use
      - `api_key` ApiKeyAuthentication — Configuration for API key authentication
        - `location` 'header' | 'query' — The location of the API key
        - `key` string — The key to use for authentication
        - `value` string — The value to use for authentication
      - `basic` BasicAuthentication — Configuration for basic authentication
        - `username` string — The username to use for authentication
        - `password` string — The password to use for authentication
      - `bearer` BearerAuthentication — Configuration for bearer authentication
        - `token` string — The token to use for authentication
      - `oauth1` OAuth1Authentication — Configuration for OAuth 1.0 authentication
        - `add_parameters_to_header` boolean
        - `add_empty_parameters_to_signature` boolean
        - `callback_url` string
        - `consumer_key` string
        - `consumer_secret` string
        - `include_body_hash` boolean
        - `nonce` string
        - `realm` string
        - `signature_method` 'HMAC-SHA1' | 'HMAC-SHA256' | 'HMAC-SHA512' | 'RSA-SHA1' | 'RSA-SHA256' | 'RSA-SHA512' | 'PLAINTEXT'
        - `timestamp` string
        - `token` string
        - `token_secret` string
        - `verifier` string
        - `version` string
      - `oauth2` OAuth2Authentication — Configuration for OAuth 2.0 authentication
        - `access_token_url` string, required
        - `client_credentials_location` 'basic_auth_header' | 'body', required
        - `client_id` string, required
        - `client_secret` string, required
        - `grant_type` 'client_credentials', required
        - `scope` string
        - `token_variable` string, required — The OAuth token will be stored to this variable
    - `pre_request_snippets` ExecutableSnippet[] — Snippets to execute before the request
      - `invariant_id` string — Object ID for the parent type. Set by system.
      - `description` string — Summary of the Snippet
      - `name` string — The display name of the Snippet
      - `body` string — the base64 encoded body of the Snippet
      - `snippet_type` 'css' | 'javascript' | 'xpath' | 'sql' | 'postman'
      - `reusable` boolean — Indicates whether the snippet is reusable
      - `workspace_id` string — The ID of the workspace that this Snippet belongs to
    - `post_request_snippets` ExecutableSnippet[] — Snippets to execute after the request
      - `invariant_id` string — Object ID for the parent type. Set by system.
      - `description` string — Summary of the Snippet
      - `name` string — The display name of the Snippet
      - `body` string — the base64 encoded body of the Snippet
      - `snippet_type` 'css' | 'javascript' | 'xpath' | 'sql' | 'postman'
      - `reusable` boolean — Indicates whether the snippet is reusable
      - `workspace_id` string — The ID of the workspace that this Snippet belongs to
  - `steps` Step[] — The steps generated
    - `intent` string — The intent of this test interaction
    - `stepType` 'step_group' | 'assert_step' | 'flow' | 'api_test_step' — The type of step
  - `prompt_id` string — The ID of the prompt used to generate the steps
  - `session_id` string — The ID of the generation session

## Other responses

- `400` — Invalid or missing parameter
- `401` — User not authenticated
- `default` — Unknown error

---

[API](https://skmtc.net/mabl/apis/mabl-api.md) · [All operations](https://skmtc.net/mabl/apis/mabl-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mabl/mabl-api/revisions/d0fc0114da66/schema)
