MockOut Logo

MockOut Documentation

Learn how to use MockOut

Create an endpoint

Getting Started

🎉 Completely Free • Set up in under 1 minute

No credit card required. No complex setup. Start creating mock APIs instantly.

MockOut is a powerful tool for creating mock API endpoints instantly. No setup required, no hosting needed. Perfect for frontend development, testing, and prototyping.

Quick Start:

  1. Create an endpoint by filling out the form with your desired path and method
  2. Add your response body (static JSON or dynamic templates)
  3. Click "Create Endpoint" to generate your mock API
  4. Copy the URL and use it in your application

Example endpoint URL:

https://xnezohcsjebrdnomuvri.supabase.co/functions/v1/mock-api/api/users

Static Responses

Create simple static JSON responses for consistent, predictable data.

Simple Object:

{
  "message": "Hello World",
  "status": "success",
  "timestamp": "2025-10-01T12:00:00Z"
}

Array of Objects:

{
  "users": [
    {
      "id": 1,
      "name": "John Doe",
      "email": "john@example.com"
    },
    {
      "id": 2,
      "name": "Jane Smith",
      "email": "jane@example.com"
    }
  ]
}

Route Parameters & Dynamic Paths

Create RESTful API endpoints with dynamic route parameters using curly braces syntax.

Syntax:

Use {paramName} to define dynamic segments in your path:

/users/{userId}
/posts/{postId}/comments/{commentId}
/api/v1/{category}/{id}

How it Works:

  • Path /users/{userId} matches /users/123
  • The value 123 is extracted as parameter userId
  • Access it in templates with {{request 'params' 'userId'}}

Request Inspection & Echoing

Echo incoming request data back in your response using the {{request 'source' 'key'}} helper.

Available Sources:

  • params - Route parameters from dynamic paths
  • query - URL query string parameters
  • headers - HTTP request headers
  • body - Request body (POST, PUT, PATCH)

Example 1: Echo Route Params

Path: /users/{userId}

{
  "id": "{{request 'params' 'userId'}}",
  "name": "{{faker 'name.fullName'}}",
  "email": "user-{{request 'params' 'userId'}}@example.com"
}

Request to /users/123 returns userId as "123"

Example 2: Echo Query Parameters

Path: /search

{
  "query": "{{request 'query' 'q'}}",
  "page": "{{request 'query' 'page'}}",
  "results": [{"id": "{{faker 'datatype.uuid'}}"}]
}

Request to /search?q=test&page=1 echoes query params

Example 3: Echo Request Headers

{
  "token_received": "{{request 'headers' 'authorization'}}",
  "user_agent": "{{request 'headers' 'user-agent'}}",
  "verified": true
}

Example 4: Echo Request Body

Method: POST

{
  "submitted_email": "{{request 'body' 'email'}}",
  "submitted_name": "{{request 'body' 'name'}}",
  "confirmation_id": "{{faker 'datatype.uuid'}}",
  "status": "received"
}

Dynamic Templates with Handlebars

Use Handlebars templating syntax to generate dynamic data on every request. Each API call will return fresh, randomized data.

Template Helpers:

  • {{faker 'category.method'}} - Generate fake data
  • {{now 'format'}} - Current date/time
  • {{random min max}} - Random number
  • {{request 'source' 'key'}} - Echo request data

Faker.js Examples

Faker.js provides hundreds of methods for generating realistic fake data. Here are the most commonly used categories:

User Profile Example:

{
  "id": "{{faker 'datatype.uuid'}}",
  "username": "{{faker 'internet.userName'}}",
  "email": "{{faker 'internet.email'}}",
  "avatar": "{{faker 'image.avatar'}}",
  "firstName": "{{faker 'name.firstName'}}",
  "lastName": "{{faker 'name.lastName'}}",
  "phone": "{{faker 'phone.number'}}",
  "website": "{{faker 'internet.url'}}",
  "company": "{{faker 'company.name'}}",
  "bio": "{{faker 'lorem.sentence'}}",
  "created_at": "{{now 'YYYY-MM-DD HH:mm:ss'}}"
}

E-commerce Product Example:

{
  "id": "{{faker 'datatype.uuid'}}",
  "name": "{{faker 'commerce.productName'}}",
  "description": "{{faker 'commerce.productDescription'}}",
  "price": "{{faker 'commerce.price'}}",
  "currency": "USD",
  "category": "{{faker 'commerce.department'}}",
  "sku": "{{faker 'datatype.number'}}",
  "inStock": "{{faker 'datatype.boolean'}}",
  "image": "{{faker 'image.url'}}",
  "rating": "{{random 1 5}}",
  "created_at": "{{now 'ISO'}}"
}

Blog Post Example:

{
  "id": "{{faker 'datatype.uuid'}}",
  "title": "{{faker 'lorem.sentence'}}",
  "slug": "{{faker 'lorem.slug'}}",
  "excerpt": "{{faker 'lorem.paragraph'}}",
  "content": "{{faker 'lorem.paragraphs'}}",
  "author": "{{faker 'name.fullName'}}",
  "publishedAt": "{{now 'YYYY-MM-DD'}}",
  "tags": ["{{faker 'lorem.word'}}", "{{faker 'lorem.word'}}"],
  "views": "{{faker 'datatype.number'}}",
  "likes": "{{random 0 1000}}"
}

Address & Location Example:

{
  "street": "{{faker 'address.streetAddress'}}",
  "city": "{{faker 'address.city'}}",
  "state": "{{faker 'address.state'}}",
  "country": "{{faker 'address.country'}}",
  "zipCode": "{{faker 'address.zipCode'}}",
  "latitude": "{{faker 'address.latitude'}}",
  "longitude": "{{faker 'address.longitude'}}",
  "timezone": "{{faker 'address.timeZone'}}"
}

Date & Time Formatting

Use the {{now 'format'}} helper to generate current timestamps in various formats:

{{now 'YYYY-MM-DD'}}→ 2025-10-01
{{now 'YYYY-MM-DD HH:mm:ss'}}→ 2025-10-01 14:30:45
{{now 'ISO'}}→ 2025-10-01T14:30:45.123Z
{{now 'DD/MM/YYYY'}}→ 01/10/2025

Available Tokens:

  • YYYY - Year
  • MM - Month
  • DD - Day
  • HH - Hour
  • mm - Minutes
  • ss - Seconds

Popular Faker.js Methods by Category

Person & Identity:

{{faker 'name.firstName'}}{{faker 'name.lastName'}}{{faker 'name.fullName'}}{{faker 'name.jobTitle'}}

Internet:

{{faker 'internet.email'}}{{faker 'internet.userName'}}{{faker 'internet.url'}}{{faker 'internet.domainName'}}{{faker 'internet.ip'}}{{faker 'internet.userAgent'}}

Commerce:

{{faker 'commerce.productName'}}{{faker 'commerce.price'}}{{faker 'commerce.department'}}{{faker 'commerce.productDescription'}}

Data Types:

{{faker 'datatype.uuid'}}{{faker 'datatype.number'}}{{faker 'datatype.boolean'}}{{faker 'datatype.hexadecimal'}}

Lorem Text:

{{faker 'lorem.word'}}{{faker 'lorem.sentence'}}{{faker 'lorem.paragraph'}}{{faker 'lorem.slug'}}

Company:

{{faker 'company.name'}}{{faker 'company.catchPhrase'}}{{faker 'company.bs'}}

Phone:

{{faker 'phone.number'}}

Images:

{{faker 'image.url'}}{{faker 'image.avatar'}}

API Key Authentication

Protect your mock endpoints with API key authentication. Perfect for testing apps that require authentication headers.

How It Works:

  1. Sign in to your account
  2. When creating an endpoint, check "Protect with API key"
  3. Your API key will be auto-generated (or you'll use your existing one)
  4. Include the API key in the X-API-Key header when making requests

Example Request with API Key:

curl -H "X-API-Key: mk_live_your_api_key_here" \
  https://xnezohcsjebrdnomuvri.supabase.co/functions/v1/mock-api/api/protected

JavaScript Fetch Example:

fetch('https://xnezohcsjebrdnomuvri.supabase.co/functions/v1/mock-api/api/protected', {
  headers: {
    'X-API-Key': 'mk_live_your_api_key_here'
  }
})
  .then(res => res.json())
  .then(data => console.log(data));

Axios Example:

axios.get('https://xnezohcsjebrdnomuvri.supabase.co/functions/v1/mock-api/api/protected', {
  headers: {
    'X-API-Key': 'mk_live_your_api_key_here'
  }
});

🔒 Security Best Practices:

  • Never commit API keys to version control (git, GitHub, etc.)
  • Use environment variables to store API keys in your applications
  • Regenerate keys immediately if you suspect they've been compromised
  • Keep your key secret - it's shown only once during generation
  • One key per user - your API key works for all your protected endpoints

💡 Use Cases:

  • Test authentication flows in your frontend application
  • Practice handling API key headers before integrating real APIs
  • Control access to your mock endpoints (only those with your key can access)
  • Simulate production-like authentication in development

Error Responses:

Missing API Key:

HTTP 401 Unauthorized
{
  "error": "API key required. Add X-API-Key header."
}

Invalid API Key:

HTTP 403 Forbidden
{
  "error": "Invalid API key"
}

Auto-Delete Policy for Public Endpoints

Public endpoints are automatically deleted 15 days after creation to keep the service clean and efficient.

⏰ Important Information:

  • Public endpoints only: Only public (non-private) endpoints are automatically deleted
  • 15-day lifespan: Public endpoints are deleted exactly 15 days after their creation date
  • Daily cleanup: The cleanup process runs automatically every day at 2 AM UTC
  • No warning: Endpoints are deleted without prior notification
  • View deletion date: Check when an endpoint will be deleted by expanding it in the endpoint list

💡 How to Keep Your Endpoints:

  • Create private endpoints: Sign in and mark endpoints as "Private" when creating them
  • Private endpoints never expire: Private endpoints are never automatically deleted and persist indefinitely
  • Full control: Only you can view and manage your private endpoints
  • Request logs: Private endpoints also track request logs for debugging

Why This Policy?

This policy ensures that MockOut remains fast and efficient for all users by preventing the accumulation of unused test endpoints. If you need endpoints that last longer than 15 days, simply sign in and create them as private endpoints.

Tips & Best Practices

  • •Public Endpoint Lifespan: Public endpoints automatically delete after 15 days. Create private endpoints to keep them permanently.
  • •Route Parameters: Use {paramName} syntax to create RESTful dynamic routes like /users/{userId} that match any value in that position.
  • •Request Echoing: Use {{request 'source' 'key'}} to echo back route params, query params, headers, or body data in your response.
  • •Private Endpoints: Sign in to create private endpoints that only you can see and manage. Private endpoints also track request logs.
  • •API Key Protection: Enable API key authentication to control access and test authentication flows in your applications.
  • •Dynamic Data: Each request to an endpoint with templates generates fresh data, perfect for testing with realistic variety.
  • •Custom Headers: Add custom headers to simulate real API behavior, including authentication headers or content types.
  • •Status Codes: Test error handling by setting different status codes (200, 404, 500, etc.).
  • •Valid JSON: Always ensure your response body is valid JSON. Use a JSON validator if needed.
  • •Testing: Use the "Test" button on any endpoint to open it in a new tab and see the response.

Start with a real testing problem

Read the full API documentation