Import existing API specifications to instantly create mock endpoints
OpenAPI (formerly Swagger) is an industry-standard specification format for describing RESTful APIs. It defines endpoints, request/response schemas, authentication, and more in a structured JSON or YAML format.
Modern OpenAPI format in JSON
Modern OpenAPI format in YAML
Legacy Swagger format
Legacy Swagger format
Go to Dashboard → Import or click the "Import" button in the navigation
Select one of three convenient import methods:
Features:
Security Features:
Perfect for importing from:
Example: https://petstore.swagger.io/v2/swagger.jsonFeatures:
Click "Preview" to validate and see what will be imported
The preview shows:
Customize your import:
Your project is created with all endpoints and schemas ready to use. You'll be automatically redirected to your new project dashboard.
Mock API Builder stores each HTTP method as a separate endpoint record. When importing an OpenAPI spec, paths with multiple operations are automatically split:
Example OpenAPI Spec:
Results in 5 separate database records:
1. GET /users
2. POST /users
3. GET /users/:id
4. PUT /users/:id
5. DELETE /users/:id
Each endpoint can be independently configured, tested, or deleted after import. This design allows fine-grained control over each operation's schema, validation rules, and mock data.
All paths from the spec become API endpoints (split by HTTP method):
/users → 2 endpoints (GET, POST)/users/{id} → 3 endpoints (GET, PUT, DELETE)/products → 2 endpoints (GET, POST)Total endpoints created = sum of all HTTP methods across all paths
Schema definitions are converted to database models:
OpenAPI:
type: stringMock API:
String fieldtype: integerNumber fieldEach HTTP method becomes its own endpoint record:
Field descriptions and example values from the spec are preserved
Constraints are automatically applied:
When importing OpenAPI specs from external APIs, Mock API Builder automatically transforms the base URL to work with our proxy system. This enables powerful features like proxy mode and hybrid testing.
Original URL (from your OpenAPI spec):
https://petstore.swagger.io/v2Transformed URL (used in Mock API Builder):
/api/petstore.swagger.io/v2The original URL is stored in your project settings, enabling proxy mode to forward requests to the real API when needed.
https://api.example.com/v1 → /api/api.example.com/v1http://localhost:3001 → /api/localhost:3001https://petstore.swagger.io/v2 → /api/petstore.swagger.io/v2localhost, 127.0.0.1, 0.0.0.0 use HTTPWhen you import an OpenAPI spec with an external URL, you'll see a notification showing the URL transformation. This confirms that proxy mode will be available for your project.
After importing an OpenAPI spec from an external API, you can switch between three powerful modes to control how your endpoints respond.
Returns generated mock data based on your endpoint configurations and response templates.
Best for:
Forwards all requests to the original external API and returns real responses.
Best for:
Uses mock data when available, falls back to the real API for unconfigured endpoints.
Best for:
Note: Proxy mode settings are only available for projects imported from external OpenAPI specs.
After importing, you can automatically generate mock data based on your schemas:
Field types are intelligently mapped to Faker.js generators:
format: email
→ faker.internet.email()
format: date-time
→ faker.date.recent()
format: uri
→ faker.internet.url()
type: boolean
→ faker.datatype.boolean()
If your spec includes example values, they're used as templates:
Get the most out of the file upload feature with these helpful tips:
Simply drag your OpenAPI specification file from your file explorer and drop it into the upload zone. The zone will highlight when a file is being dragged over it.
Tip: You can drag files directly from GitHub, your IDE, or any file manager.
Maximum file size is 5MB. This is sufficient for most OpenAPI specifications.
If your spec exceeds this limit, consider:
Accepted file extensions:
.json.yaml.ymlFiles with other extensions will be rejected for security reasons.
After uploading, you'll see a preview of your file's content in the code editor. You can review and even edit the content before clicking "Preview" to validate the specification.
Your uploaded files are:
Problem: "Invalid file type" or "File size exceeds limit"
Solutions:
Problem: "Invalid OpenAPI specification"
Solutions:
Problem: Endpoints imported but no data structure
Solution: Define schemas in components/schemas section
Problem: Import takes a long time or times out
Solution: Split large specs into smaller ones or import only needed paths
Use Swagger Editor or online validators to ensure your spec is valid before importing.
Add example values to your schemas for better mock data generation.
Define reusable schemas in components section to avoid duplication and ensure consistency.
When your backend API changes, re-import the updated spec to keep your mock API in sync.