AI Features

Routemage integrates with OpenAI (gpt-4o-mini) to generate documentation and test cases directly from your request configuration. Both features are available inside any open request — no setup beyond adding your OPENAI_API_KEY to the web app environment.

Info
AI features require OPENAI_API_KEY to be set in the web app's environment variables. If the key is missing, the Generate buttons will return an error instead of calling OpenAI.
FeatureTabWhat it produces
Generate DocsDocsFull markdown documentation: overview, params, request/response examples, error codes
Generate Test CasesScripts4–5 test cases (happy-path, edge-case, error) with assertion rules
Run TestsScriptsExecutes each test against the live URL, returns pass/fail per assertion
Download ResultsScriptsJSON export of all test cases and their run results

Generate Documentation

Open any request and click the Docs tab. If the request already has documentation, the editor will show it. Click Generate with AI to let Routemage call OpenAI and write full markdown documentation for that endpoint.

1
Open a request
Select any request from the sidebar. The request must be saved — the AI uses the saved method, URL, params, headers, body, and auth type.
2
Click the Docs tab
The Docs tab has a markdown editor with Edit, Split, and Preview modes. Any previously written or generated docs appear here.
3
Click "Generate with AI"
The button is in the toolbar above the editor. Routemage sends the request configuration to OpenAI and streams back the generated markdown. This takes 3–8 seconds depending on complexity.
4
Review and edit
The generated content fills the editor. You can edit it freely — use the toolbar buttons for H1, H2, bold, italic, inline code, blockquote, and horizontal rule. Switch to Split or Preview mode to see the rendered output.
5
Save
Click Save in the URL bar to persist the docs. The Docs tab badge will appear indicating saved content.

What gets generated

The AI generates a markdown document that typically includes:

  • Endpoint overview — what it does, who it's for
  • Query parameters table — name, type, required/optional, description
  • Request headers — with notes on auth headers
  • Request body example — formatted JSON or form data
  • Success response example — with realistic field values
  • Error response examples — 400, 401, 404, 500 patterns
Tip
The more specific your URL and body are, the better the output. A URL like https://api.example.com/users/123/orders with a JSON body produces much richer docs than a bare {{baseUrl}}/endpoint.

Generate Test Cases

Open any request and click the Scripts tab. Click Generate with AI to have Routemage create a set of test cases for that endpoint. Each test case includes a name, type badge, description, any request overrides, and a list of assertions.

Test case types

TypeColorWhat it tests
happy-pathGreenThe expected successful flow — correct inputs, expected 2xx response
edge-caseYellowBoundary values, empty arrays, null fields, max-length strings
errorRedMissing required fields, unauthorized requests, invalid data formats

Assertion types

Each test case can have one or more assertions. Routemage evaluates them when you run the test:

TypeDescriptionExample
statusHTTP status code must equal expected valueexpected: 200
body-containsResponse body (as string) must contain the expected substringexpected: "success"
json-pathValue at JSON path must equal expected, or be non-null / nullpath: $.id, expected: not-null

Running Tests

Each test case card has a Run button. Click it to send the request (with any overrides from the test case) through the Routemage proxy and evaluate all assertions against the response.

Use Run All in the toolbar to execute every test case in sequence. Results appear inline on each card — a green PASS badge or red FAIL badge with status code and duration.

1
Run a single test
Click Run on any test case card. The card expands automatically to show assertion results after the run completes.
2
Expand a card
Click anywhere on the card header to toggle the detail view. It shows the description, each assertion with pass/fail indicator, and the full response body.
3
Check assertion results
Each assertion shows its type, expected value, and — on failure — the actual value received. A ✓ or ✗ prefix tells you immediately which assertions passed.
4
Run all tests
The Run All button runs every test case sequentially. The summary in the toolbar updates in real time: "4 passed · 1 failed".
Warning
Tests run against the URL saved in the request. Make sure the URL is reachable from the Routemage server (not localhost unless you're running Routemage locally). Environment variable substitution is not applied during test runs — use literal values.

Downloading Results

After running one or more tests, a Download Results button appears in the Scripts toolbar. Clicking it downloads a test-results.json file containing all test cases and their run results.

The JSON structure is an array of objects, one per test case:

  • id, name, type, description — the test case metadata
  • overrides — any body/params/headers applied for this test
  • assertions — the assertion rules
  • resultnull if not run, otherwise: status (pass/fail/error), actualStatus, actualBody, assertions (with actual vs expected), durationMs

Routemage · API Development Platform