API Contract Mutation Tester

Mutate OpenAPI request fields into semantically risky variants and optionally send them to a real backend to check defensive validation coverage

Paste an OpenAPI 3.x document and let the tool derive valid baseline requests from each documented operation. It then mutates request fields into semantically risky values such as omitted required fields, negative numbers, enum violations, whitespace-only strings, or special-character payloads.

How to use it:

  • OpenAPI Specification: paste a YAML or JSON OpenAPI 3.x document
  • Base URL: leave empty for offline mutation-plan generation, or point it at a real backend such as https://api.example.com
  • Execute Mutations: when enabled, the tool actually sends the mutated requests
  • Authorization Header: optional raw header value such as Bearer
  • Mutations Per Field: caps how many semantic mutations are generated per field
  • Request Timeout (ms): limits real-request execution time

What it tests:

  • Required-field omission
  • Special-character and suspicious string payloads
  • Negative or oversized numeric values
  • Invalid enum members
  • Wrong scalar-vs-array shapes

How to read the output:

  • defended: the backend rejected the mutated request
  • accepted: the backend still returned a success code for the mutated request
  • documented: the observed status code exists in the OpenAPI responses section

Example Results

1 examples

Probe whether a signup endpoint really rejects dangerous semantic mutations

Generate omission, negative-number, and special-character request mutations from an OpenAPI contract before trusting the backend validation layer.

{
  "summary": {
    "operations": 1,
    "generatedMutations": 8,
    "executedMutations": 0,
    "acceptedMutations": 0,
    "defendedMutations": 0
  },
  "mutations": [
    {
      "fieldPath": "body.email",
      "mutation": "Inject special characters"
    },
    {
      "fieldPath": "body.age",
      "mutation": "Negative numeric mutation"
    }
  ]
}
View input parameters
{ "openApiSpec": "openapi: 3.0.3\npaths:\n /users:\n post:\n requestBody:\n required: true\n content:\n application/json:\n schema:\n type: object\n required: [email, role, age]\n properties:\n email: { type: string, minLength: 5 }\n role: { type: string, enum: [admin, member] }\n age: { type: integer, minimum: 18 }\n responses:\n \"201\": { description: created }\n \"400\": { description: invalid }\n", "baseUrl": "", "executeMutations": false, "authorizationHeader": "", "mutationsPerField": 3, "timeoutMs": 8000 }

Key Facts

Category
Developer & Web
Input Types
textarea, text, checkbox, number
Output Type
json
Sample Coverage
4
API Ready
Yes

Overview

The API Contract Mutation Tester evaluates the defensive validation of your backend by generating semantically risky requests from an OpenAPI 3.x specification. It automatically mutates request fields—such as omitting required parameters, injecting special characters, or violating enum constraints—and can optionally execute these payloads against a live endpoint to verify if your API correctly rejects invalid data.

When to Use

  • When auditing a new API endpoint to ensure it properly rejects malformed or malicious payloads.
  • Before deploying to production to verify that defensive validation rules match the OpenAPI contract.
  • When generating a comprehensive list of negative test cases for automated security or QA pipelines.

How It Works

  • Paste your OpenAPI 3.x specification (YAML or JSON) into the tool to parse documented operations and schemas.
  • The tool generates valid baseline requests, then applies semantic mutations like negative numbers, missing required fields, or invalid enums.
  • If a Base URL is provided and execution is enabled, the tool sends the mutated requests to the target backend.
  • Review the JSON output to see which mutations were 'defended' (rejected by the API) and which were 'accepted' (potentially exposing a validation gap).

Use Cases

Hardening user registration endpoints against invalid email formats, missing age fields, or oversized payloads.
Testing financial or e-commerce APIs to ensure negative numbers or invalid currencies are strictly rejected.
Validating that internal microservices enforce strict contract compliance and do not silently ignore malformed input.

Examples

1. Testing a User Signup Endpoint

Security QA Engineer
Background
A new user registration endpoint has been developed, and the team needs to ensure it doesn't accept invalid data like negative ages or missing emails.
Problem
Manually writing negative test cases for every field in the signup payload is time-consuming and prone to human error.
How to Use
Paste the OpenAPI YAML for the `/users` endpoint, set 'Mutations Per Field' to 3, and leave the Base URL empty to generate an offline test plan.
Example Config
executeMutations: false, mutationsPerField: 3
Outcome
The tool outputs a JSON plan detailing generated mutations, including injecting special characters into the email field and applying negative numbers to the age field.

2. Live Defensive Validation Check

Backend Developer
Background
An inventory management API is ready for staging, but the developer wants to confirm the API gateway correctly blocks invalid enum values.
Problem
Need to quickly fire malformed requests at the staging server without writing a custom test script.
How to Use
Paste the OpenAPI spec, enter the staging Base URL, enable 'Execute Mutations', and provide a Bearer token in the Authorization Header.
Example Config
baseUrl: "https://staging-api.example.com", executeMutations: true, authorizationHeader: "Bearer abc123xyz"
Outcome
The tool executes the mutations against the live endpoint and returns a summary showing which invalid enum requests were 'defended' (e.g., 400 Bad Request) versus 'accepted' (e.g., 200 OK).

Try with Samples

development

Related Hubs

FAQ

What versions of OpenAPI are supported?

The tool supports OpenAPI 3.x specifications in both YAML and JSON formats.

Do I have to send requests to a live server?

No. You can leave the Base URL empty and disable execution to generate an offline mutation plan for review.

How does the tool authenticate with my API?

You can provide a raw authorization header, such as a Bearer token, which will be injected into all executed requests.

What types of mutations are generated?

Mutations include required-field omission, negative or oversized numbers, invalid enum members, wrong data types, and special-character payloads.

What do 'defended' and 'accepted' mean in the results?

'Defended' means your API correctly rejected the invalid request. 'Accepted' means the API returned a success code, indicating a potential missing validation rule.

API Documentation

Request Endpoint

POST /en/api/tools/api-contract-mutation-tester

Request Parameters

Parameter Name Type Required Description
openApiSpec textarea Yes -
baseUrl text No -
executeMutations checkbox No -
authorizationHeader text No -
mutationsPerField number No -
timeoutMs number No -

Response Format

{
  "key": {...},
  "metadata": {
    "key": "value"
  },
  "error": "Error message (optional)",
  "message": "Notification message (optional)"
}
JSON Data: JSON Data

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-api-contract-mutation-tester": {
      "name": "api-contract-mutation-tester",
      "description": "Mutate OpenAPI request fields into semantically risky variants and optionally send them to a real backend to check defensive validation coverage",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=api-contract-mutation-tester",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]