Skip to content

OpenAPI & Swagger

Turn your OpenAPI spec into a live mock API

Import an OpenAPI 3.x or Swagger 2.0 document and MockAPI creates the models and endpoints, then serves realistic, schema-shaped responses at a hosted URL.

Free forever plan · No credit card required

openapi.yaml
openapi: 3.0.3
paths:
  /pets/{id}:
    get:
      responses:
        '200':
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Pet' }

Specs nobody can call

A beautiful spec is still not something your frontend can fetch.

Example-only mocks

Most spec-based mocks return the same static example forever.

Silent drift

Specs evolve and mocks quietly fall out of date.

What you get

One-click import

OpenAPI 3.x and Swagger 2.0, JSON or YAML. Models and endpoints are created for you.

Schema-shaped data

Formats, enums and nested objects become realistic generated values.

Stateful CRUD

Resource endpoints remember what clients create, update and delete.

Contract drift detection

Compare your mocks with a newer spec and review breaking changes.

Scenarios and latency

Layer failure presets and timing on top of the contract.

Export anytime

Export projects back out when you need to share or back up.

Get started in three steps

  1. 01

    Import your spec

    Upload or paste OpenAPI 3 / Swagger 2 in JSON or YAML.

  2. 02

    Review models

    Tweak generated fields and data types if you want more realism.

  3. 03

    Call the mock

    Every path is live at https://api.mockapi.com with your API key.

FAQ

Common questions

Which OpenAPI versions are supported?

OpenAPI 3.x and Swagger 2.0, in JSON or YAML.

What happens when my spec changes?

Run contract drift detection with the new spec to see breaking and non-breaking differences, then update your mocks.

Can AI agents import specs?

Yes. The MockAPI MCP server exposes an import_openapi_schema tool.

Build against a mock API that behaves like your real one

Create your first endpoint in under two minutes.

Free forever · No credit card required