# Mock from OpenAPI spec

> Paste an OpenAPI or Swagger spec and mock every endpoint at once.

Mock from OpenAPI spec turns an OpenAPI or Swagger document into a live mock server for every endpoint at once — paste the spec and get a hosted URL that answers each path with an example response, no account and no backend.

Also: openapi mock server, mock from openapi, swagger mock server, mock api from spec, fake api from swagger, openapi to mock server, instant mock from spec, no signup mock server.

## What it does

A spec describes an API that may not be built yet. This reads the spec — OpenAPI 3.0, 3.1 or Swagger 2.0 — and stands up a real hosted mock for all of its endpoints in one step, each returning an example response taken from the spec or synthesised from its schema. The mock answers real HTTP requests for 24 hours, so you can develop or demo against the whole API surface before any of it exists.

## When to use it

- You have an OpenAPI spec and need a working endpoint for every path before the backend is built.
- You want to prototype a client against the whole API surface at once, not one hand-made mock at a time.
- You need a shareable URL that serves example responses matching a design spec.
- You want to sanity-check that a spec produces sensible example payloads.

## What you give it

| Input | Meaning |
| --- | --- |
| OpenAPI or Swagger spec | A JSON or YAML document (OpenAPI 3.0/3.1 or Swagger 2.0). Paste it or load a built-in example. |

## What you get back

| Output | Meaning |
| --- | --- |
| Live mock server | A hosted base URL whose endpoints answer over real HTTP for 24 hours. |
| Endpoint list | Every mocked route, each expandable to the example response it serves. |

## Key terms

- **OpenAPI** — a standard description of an HTTP API — its paths, methods, parameters and response schemas — that tools can read to generate clients, docs or mocks.
- **Path template** — a route with a variable segment such as /users/{id}; the mock matches any value in that position, so /users/42 resolves.
- **Example response** — a sample body for an endpoint, taken from the spec example when present or synthesised from the response schema and field names otherwise.

## Questions

### Which spec versions are supported?

OpenAPI 3.0, 3.1 and Swagger 2.0, in JSON or YAML.

### Where do the response bodies come from?

From the response example in the spec when there is one; otherwise a realistic body is synthesised from the response schema and its field names.

### Do path parameters work?

Yes. A templated path such as /users/{id} matches any value in that segment, so a real id resolves to the endpoint example.

### How long does the mock last?

It answers for 24 hours, then expires.


## Privacy

The spec you paste is used to build a public, unauthenticated mock server, and its example responses leave your browser to be served from that URL. Nothing else is collected — but the endpoints are public, so do not embed secrets in the spec.

## Links

- [Use the tool](https://www.postman.com/tools/mock-from-spec) — the interactive version of this page.
- [Postman Tools](https://www.postman.com/tools) — every free tool in this set.
