Skip to main content
Version: 3.0.0

Generate API Tests using AI

This guide will help you generate automated API tests using Keploy's AI-based test engine by providing structured inputs like OpenAPI specs, curl commands, Postman collections, or live endpoints.

👉 If you want to record API flows by interacting with your web app through a browser, follow this guide instead: Record API Tests via Chrome Extension

Getting Started

  • Go to the Keploy Console
  • Upload your API input (schema, collection, or curl)
  • 👊 Hit Generate Tests and Keploy will parse your input, hit the API, and generate validated test flows with response-based assertions.
  • If private endpoints are detected, follow the agent setup prompt
  • Review and edit your generated tests

⚠️ Private Endpoint API Warning

If your API is not publicly accessible, Keploy will show a warning when attempting to reach those endpoints. To resolve this, install the Keploy Agent proxy locally

Keploy Agent Installation

PlatformSteps
macOS- Download

- Open the .dmg file and install the app normally.

- Launch the Keploy Agent after installation.
Linux- Run the following in your terminal:

curl --silent -O -L https://keploy.io/ent/install.sh

chmod +x ./install.sh

source ./install.sh

- Verify the install with: keploy-agent
Windows- Download and Run

cd $env:USERPROFILE/Downloads

tar -xvf '.\keploy-agent-windows_amd64.zip'

.\keploy-agent.exe

✅ Once installed and running, return to the Keploy Console and hit Generate API Tests. The agent will proxy your local API to allow secure test generation.

BEST Practices for BEST Test Output

Input TypeTips
OpenAPI Spec/Swagger DocUse OpenAPI v3, best if links are also mentioned
Postman CollectionExport the postman collection and copy the JSON to keploy console
curl CommandsProvide 3-4 WORKING (2xx) cURL commands along with responses
Live Endpoint OnlyEnsure you're providing a valid and testable API base URL.

Valid & Invalid URL Examples

Use a base API path, not a homepage or static resource, for generating test flows.

URL ExampleWhy It's Good or Bad
https://api.example.comAPI subdomain — general and testable
https://example.com/apiAPI under path — works across many endpoints
https://example.com/api/v2Versioned API route
https://example.com/v2/ordersSpecific API group — stable path
https://example.comHomepage — not an API
https://example.com/index.htmlStatic file — not useful for API testing
https://api.example.com/orders/126789Too specific — single object, not general

⚠️ Avoid using URLs pointing to static resources or deeply nested objects.

What Keploy Generates

Every test generated will include:

  • ✅ API request + actual response
  • ✅ Assertions on status, body, and headers
  • ✅ Multi-step flow generation (e.g. POST → GET → DELETE)
  • ✅ Automatic test deduplication
  • ✅ Environment reusability for staging, QA, or CI
  • ✅ Labeled, editable, and sharable from the dashboard

Question? 🤔💭

For any support please join keploy slack community to get help from fellow users, or book a demo if you're exploring enterprise use cases.