From OpenAPI (Pro) with Mock API Studio
OpenAPI import is a Pro feature. The editor below opens on the OpenAPI tab with a small Pet Clinic spec in YAML: owners and pets with typed schemas, a required list, an enum and a nested path. Anyone can paste a spec and see the resources and skipped paths it yields, free. With Pro, Create my API turns the collection and item paths into live /owners and /pets endpoints with fake data that matches each schema; on Free, build the same API from a JSON sample.
- Check the side panel (free): /v1/owners and /v1/pets become owners and pets (version prefixes like /v1 and /api are dropped), and the two nested paths appear under "skipped" with the reason.
- Replace the sample with your own spec: paste YAML or JSON, or drop a .yaml, .yml or .json file. OpenAPI 3.0 and 3.1 are read; a Swagger 2.0 file is refused with a note to convert it first.
- Rename a resource in the side panel if you want a different path, set records per resource and press Create my API. Creating from a spec is Pro: on Free the Pro wall opens, and Paste JSON instead takes you to the free JSON tab.
- Call it like the real service: GET /pets?species=cat, GET /pets/3, POST /pets. The species enum, the email format and the required fields from the schema are enforced, so a POST without name returns 422.
- Point your generated client or frontend at the new base URL; the paths are /{resource} and /{resource}/{id}, without the /v1 prefix.
What to know
The importer groups paths into resources. A path with one name and no parameter (/pets) is the collection and the same name with one trailing parameter (/pets/{petId}) is the item. The schema comes from the GET response, unwrapping arrays and common envelopes such as {data: [...]} and {items: [...]}, then from the request body, then from a components schema with the same name. $ref, allOf (merged) and the first branch of oneOf or anyOf are followed.
Types and constraints carry over: integer and number become numbers, format: email, uuid, date, date-time and uri become validated fields, enum becomes a fixed list, and required properties are enforced on POST and PUT. A property such as ownerId is recognised as a link to owners and filled with real owner ids. example values on properties become the first sample record, so the documented example is what GET /pets/1 returns.
What is not mocked is listed rather than dropped silently. Action paths (/pets/{petId}/adopt), sub-collections (/pets/{petId}/vaccinations), paths with two parameters and operations without a JSON object schema appear under skipped with the reason. Responses are always plain JSON arrays and objects in this API's own shape: a spec that wraps lists in {data, total} is unwrapped, and the total is sent as the X-Total-Count header instead.
This is a stateful CRUD mock, not a contract-testing proxy: it does not validate responses against the spec, replay per-status examples, or honour query parameters the spec declares beyond the built-in ones (field filters, q, sort, order, page and limit). That trade-off is what makes writes persist, so a POST followed by a GET returns the new record. Files over 3 MB are refused. Importing a spec is Pro (up to 50 resources and 5,000 records each); the free plan creates up to 2 resources from a JSON sample or the field table.
Updated · Cosmovex
Questions
Is OpenAPI import free?
No, creating an API from an OpenAPI file is part of Pro ($5 a month). On Free you can still paste or drop a spec and see exactly which resources it would create and which paths it would skip. To stay on Free, paste a JSON sample with the same fields in the JSON tab: 1 project, 2 resources, 25 records each and 300 requests a day.
Which OpenAPI versions and formats are supported?
OpenAPI 3.0.x and 3.1.x, in YAML or JSON, pasted or dropped as a file up to 3 MB. Swagger 2.0 is not read; convert it to OpenAPI 3 first, for example with the convert action in Swagger Editor, then paste the result.
Why was one of my paths skipped?
Only collection and item paths become resources. Actions like /orders/{id}/cancel, nested lists like /users/{id}/posts, paths with two parameters and operations without a JSON object schema are skipped, and the side panel lists each one with the reason before you create anything.
Are required fields and enums enforced?
Yes. Properties in a schema's required list must be present on POST and PUT (PATCH may omit them), enum values are the only ones accepted, and email, uuid, date and uri formats are checked. Violations return 422 with the field name.
Will the mock return my spec's examples?
Property-level example values become the first record of the resource, so GET /owners/1 returns them. Other records are generated from each field's type and name. Per-response examples and multiple named examples are not replayed.
Can I keep the /v1 prefix in the URLs?
Not in the path: resources are served at /{resource} under the project base URL. Set your client's base URL to the project URL and drop the prefix, or keep the prefix in your environment variable and map it in one place.
The free plan covers everything on this page. Mock API Studio Pro ($5/mo, billed monthly) is described on the Mock API Studio page.