Turn a Swagger or OpenAPI File Into a Live Mock API in 60 Seconds
If your team follows a spec-first API design process, you're already sitting on everything you need to generate a live mock. The spec describes every route, every request parameter, every response schema. A good mock platform reads that spec and serves HTTP responses — no code required from you.
Step 1: Prepare Your Spec
moqapi.dev accepts OpenAPI 3.x (YAML or JSON) and Swagger 2.0. Your spec needs:
paths— at least one defined path and method.- Response schemas under
components/schemasor inline — this drives data generation. - Response status codes —
200,201,404, etc. so the platform knows what shape each response has.
If your spec is missing schemas, responses will still be served — but they'll be empty objects. Add schema references for the richest mock data.
Step 2: Import
In moqapi.dev, navigate to Mock APIs → Import YAML (Spec). You can:
- Paste a public spec URL (Petstore, any GitHub raw URL, Stoplight-hosted specs).
- Upload a local file.
- Paste raw YAML or JSON directly into the editor.
Hit Import. The platform parses the spec, creates a mock API entry, and activates all routes.
Step 3: Call Your Mock
# Your base URL after import
https://moqapi.dev/api/invoke/mock/<your-api-id>
# The spec defines GET /pets — call it:
curl https://moqapi.dev/api/invoke/mock/<your-api-id>/pets
# Parameterised routes work too:
curl https://moqapi.dev/api/invoke/mock/<your-api-id>/pets/42
# Query filters are respected:
curl "https://moqapi.dev/api/invoke/mock/<your-api-id>/pets?status=available"
What Gets Generated Automatically
- Response bodies — populated from your schemas using Faker.js with field-name heuristics.
- Status codes — returns the first 2xx defined in your spec by default; can return error codes on demand.
- Content-Type headers — set from your spec's
produces/contentdeclarations. - Array responses — returns a realistic list (default 5–12 items) when your schema type is
array.
Spec Versioning
Every time you import a new version of your spec, moqapi.dev stores it with a version number and timestamp. You can activate any version instantly, compare diffs, and roll back if a spec change breaks consumers. Share the mock URL with your team — it stays stable across versions.
60 Seconds Is Not a Marketing Claim
The Petstore import takes less than five seconds. Parsing a complex real-world spec with 80+ endpoints takes under 30. The remaining 30 seconds are yours to write the first curl command. This is truly the fastest path from a spec file to a working API endpoint.
About the Author
Founder and sole developer of moqapi.dev. Full-stack engineer with deep experience in API platforms, serverless runtimes, and developer tooling. Built moqapi to solve the mock data and deployment friction she experienced firsthand building production APIs.
Related Articles
Free OpenAPI Mock Server: Generate Realistic API Responses Without Writing Code
Skip boilerplate and JSON fixtures. Learn how to spin up a fully functional OpenAPI mock server for free with auto-generated, schema-accurate response data.
How to Build a Full Frontend Without a Real Backend Using Mock APIs
Your backend isn't ready — but the sprint deadline is. Here's the exact workflow for building production-quality UI with mock endpoints and no compromise on realism.
I Wasted 3 Days on Mock Data. Here's How I Fixed It in 10 Minutes
A real story about hand-written JSON fixtures that broke our sprint, and the step-by-step approach that eliminated the problem entirely using a free mock API platform.
Ready to build?
Start deploying serverless functions in under a minute.