Mock REST API Guide

Create free, instant REST API endpoints with custom responses, status codes, and advanced features. No signup required.

Getting Started

Creating a mock REST API endpoint takes less than 30 seconds. Follow these simple steps:

  1. 1

    Visit the Homepage

    Go to mockapi.dog and select the "REST API" tab.

  2. 2

    Choose HTTP Method

    Select GET, POST, PUT, PATCH, or DELETE based on your needs.

  3. 3

    Write Your JSON Response

    Enter the JSON data you want the endpoint to return. The editor validates JSON in real-time.

    {
      "id": 1,
      "name": "John Doe",
      "email": "john@example.com"
    }
  4. 4

    Configure Delays and Error Simulation Settings (Optional)

    Add delays, status codes, error rates, or custom headers if needed.

  5. 5

    Complete Verification & Save

    Complete the Turnstile verification, then click "Save Mock Endpoint". Your endpoint URL is automatically copied!

    https://abc123.mockapi.dog/api/users

Your endpoint is live immediately!

No deployment, no waiting. Start making requests right away from your app, tests, or tools like Postman and curl.

Core Features

HTTP Methods

Support for all standard HTTP methods to match your API design.

  • GET - Retrieve data
  • POST - Create resources
  • PUT - Full update
  • PATCH - Partial update
  • DELETE - Remove resources

Status Codes

Return any HTTP status code to test success, errors, and edge cases.

  • 200OK - Success
  • 201Created
  • 400Bad Request
  • 401Unauthorized
  • 500Server Error

JSON Responses

Return any valid JSON structure - from simple objects to complex nested data.

  • Objects and arrays
  • Nested structures
  • Arrays of objects
  • Real-time validation
  • Proper Content-Type

Advanced Features

Fine-tune your mock endpoints with powerful features for realistic testing scenarios.

Response Delays

Simulate slow networks or server processing time by adding delays to responses.

Use Cases:

  • Test loading states in UI
  • Simulate slow 3G/4G networks
  • Verify timeout handling
  • Check skeleton screens

Example Delays:

500ms - Fast2000ms - Normal5000ms - Slow

Error Simulation

Set a percentage of requests to return errors. Perfect for testing error handling and retry logic.

Use Cases:

  • Test error boundaries
  • Verify retry mechanisms
  • Check error messages
  • Validate fallback UI

Error Rate Examples:

10% errors50% errors100% errors

Conditional Errors

Return errors based on specific conditions like header values or request patterns.

Example Use Cases:

  • Missing Header:Return 401 if X-API-Key header is not present
  • Specific ID:Return 404 for userId "999" to test not found scenarios
  • Request Method:Return 405 for unsupported HTTP methods

TTL (Time to Live)

Set an expiration time for your endpoints. They automatically get deleted after the specified duration.

Available Options:

1 hour24 hours7 days30 days

Perfect for temporary tests or demos. No need to manually clean up.

Common Tasks

Create an Endpoint

  1. Click "Create REST Endpoint" button
  2. Select HTTP method
  3. Enter your JSON response
  4. Configure optional settings
  5. Click "Create Endpoint"

✓ Your endpoint is now live!

Edit an Endpoint

  1. Find your endpoint in "My Endpoints" list
  2. Click the "Edit" button
  3. Modify response, status, or settings
  4. Save changes

✓ Changes are live immediately

Delete an Endpoint

  1. Locate the endpoint you want to remove
  2. Click the "Delete" button
  3. Confirm deletion

This action cannot be undone

Test an Endpoint

Using curl:

curl https://abc123.mockapi.dog/api/users

Using JavaScript:

fetch('https://abc123.mockapi.dog/api/users')

Troubleshooting

Endpoint returns 404 Not Found

Solution: Double-check the endpoint URL. Make sure you're using the exact URL provided after creation, including the unique ID.

Invalid JSON error when creating endpoint

Solution: Validate your JSON using the built-in editor. Common issues: missing commas, unquoted keys, trailing commas, or unescaped quotes.

CORS errors in browser

Solution: All endpoints automatically include CORS headers. If you still see errors, check if you're using the correct URL and HTTP method.

Endpoint is too slow

Solution: Check if you've added a response delay in advanced settings. Remove or reduce the delay value if not needed.

Tips & Best Practices

Use Realistic Data

Include realistic field names, data types, and structures that match your real API. This makes testing more valuable.

Test Edge Cases

Create endpoints for empty arrays, null values, and error scenarios. This helps catch bugs early.

Document Your Endpoints

Keep a list of your endpoints and their purposes. Share URLs with team members for collaboration.

Use Delays Strategically

Add small delays to test loading states. Use longer delays to verify timeout handling.

Version Your Responses

Create multiple endpoints for different API versions. This helps test backward compatibility.

Clean Up Unused Endpoints

Regularly delete endpoints you no longer need. Use TTL to auto-expire temporary endpoints.

Ready-to-Use Mock API Library

We provide pre-built mock APIs for common use cases. Click any category to explore ready-to-use endpoints that you can test immediately - no setup required.

Pro Tip: Browse the Full Library

Visit our Mock API Library to explore all pre-built endpoints with live examples, sample responses, and one-click testing.

Glossary

REST API

Representational State Transfer API - an architectural style for building web services using standard HTTP methods.

HTTP Methods

Standard request methods (GET, POST, PUT, PATCH, DELETE) that indicate the desired action for a resource.

Status Code

Three-digit code returned by server indicating the result of a request (200 OK, 404 Not Found, 500 Error, etc).

JSON

JavaScript Object Notation - a lightweight data format for structuring and exchanging data between client and server.

Endpoint

A specific URL where an API can be accessed. Each endpoint performs a specific function.

Mock API

A simulated API that returns predefined responses, used for testing and development without a real backend.

CORS

Cross-Origin Resource Sharing - a security feature that controls which domains can access your API from browsers.

TTL

Time To Live - the duration an endpoint exists before automatic deletion. Useful for temporary tests.

Error Rate

The percentage of requests that should return errors. Used to test error handling and retry logic.

Response Delay

Artificial wait time added before sending a response. Simulates slow networks or processing.

Ready to Create Your First REST API?

Start building free mock REST API endpoints in seconds. No signup required, no credit card needed. Perfect for testing, prototyping, and development.