Mock Server
Create mock API endpoints with custom responses, status codes, and headers. Perfect for frontend development, API testing, and prototyping before backend implementation.
Quick Access: Manage your mock endpoints in the VerveKit Dashboard.
Features
- All HTTP Methods: Support for GET, POST, PUT, DELETE, and PATCH
- Custom Responses: Define exactly what your endpoint returns
- Status Codes: Configure any HTTP status code (200, 404, 500, etc.)
- Custom Headers: Add custom headers to responses
- Request Logging: View incoming request data including headers, body, and query params (paid plans)
- CDN Delivery: Responses served via Google Cloud Storage CDN
- Usage Analytics: Track endpoint access counts
- CORS Support: Built-in CORS headers for frontend integration
Request Logging (REQUEST Tab)
The REQUEST tab allows you to inspect incoming requests to your mock endpoints. This is invaluable for debugging integrations, verifying webhook payloads, and understanding how clients interact with your mocked APIs.
Plan Requirement: The REQUEST tab is only available on paid plans (Starter, Pro, Mega). Free plan users can create and use mock endpoints but cannot view incoming request data.
What's Captured
For each incoming request, the following data is logged and available in the REQUEST tab:
- Request Body: Full JSON or form data payload sent by the client
- Query Parameters: URL query string parameters (?key=value)
- Headers: All HTTP headers sent with the request
- HTTP Method: The method used (GET, POST, PUT, etc.)
- Timestamp: When the request was received
- Client IP: The originating IP address
Accessing Request Logs
- Navigate to VerveKit → Mock Server in your dashboard
- Click on an endpoint to view its details
- Select the REQUEST tab
- View the most recent request data captured for that endpoint
Testing Webhooks: Use mock endpoints with request logging to test and debug webhooks from third-party services like Stripe, GitHub, or Slack before building your actual webhook handler.
Use Cases
| Use Case | Description | Best For |
|---|---|---|
| Frontend Development | Develop and test frontend applications before the backend is ready | UI development, parallel development workflows |
| API Testing | Test error handling and edge cases with different status codes and responses | QA testing, error scenarios, integration testing |
| Client Demos | Create demo endpoints to showcase API behavior and capabilities to clients | Sales demos, proof of concepts, presentations |
| Documentation | Provide live, working examples in API documentation and tutorials | Developer docs, guides, interactive examples |
| API Prototyping | Quickly prototype API endpoints to validate design and contracts | API design, contract testing, stakeholder review |
| Third-Party Simulation | Simulate third-party API responses for development and testing | External API mocking, offline development |
Creating a Mock Endpoint
Via Dashboard
- Sign in to your APIVerve Dashboard
- Navigate to VerveKit → Mock Server
- Click "Create New Endpoint"
- Configure your endpoint:
- Name: Descriptive name for the endpoint
- HTTP Method: GET, POST, PUT, DELETE, or PATCH
- Status Code: HTTP status code to return (e.g., 200, 404, 500)
- Response Body: JSON or text response
- Headers: Optional custom headers
- Click "Save" to create your endpoint
Response Validation: If your response is JSON, it will be validated before saving. For non-JSON responses, it will be returned as plain text.
Configuration Options
HTTP Methods
Choose from the following HTTP methods:
- GET: Retrieve data (most common for mock endpoints)
- POST: Submit data (simulate resource creation)
- PUT: Update data (simulate full resource update)
- PATCH: Partial update (simulate partial resource update)
- DELETE: Delete data (simulate resource deletion)
Method Validation: Requests must match the configured HTTP method. A GET endpoint will reject POST requests with 405 Method Not Allowed.
Status Codes
Common status codes you can configure:
- 200: OK - Successful request
- 201: Created - Resource created successfully
- 400: Bad Request - Invalid request data
- 401: Unauthorized - Authentication required
- 403: Forbidden - Access denied
- 404: Not Found - Resource doesn't exist
- 500: Internal Server Error - Server error
- 503: Service Unavailable - Service temporarily down
Custom Headers
Add custom headers to your responses:
{
"Content-Type": "application/json",
"X-Custom-Header": "CustomValue",
"Cache-Control": "no-cache"
}CORS Headers: The following CORS headers are automatically added:Access-Control-Allow-Origin: *,Access-Control-Allow-Methods: [your method],Access-Control-Allow-Headers: Content-Type, Authorization, x-api-key
Accessing Your Endpoint
Once created, your mock endpoint is immediately available:
https://api.apiverve.com/v1/mockserver/{serverId}/{path}URL Structure: Each mock server has a unique serverId. You define custom paths (like /users, /products) for each endpoint. Copy the complete URL from your dashboard.
Authentication
Include your API key in the request header:
- Header:
x-api-key - Location: HTTP headers
- Required: Yes
x-api-key: YOUR_API_KEYHTTP Method
The request must match the configured HTTP method for the endpoint.
Code Examples
GET Request (cURL)
curl "https://api.apiverve.com/v1/mockserver/abc123/users" \
-H "x-api-key: YOUR_API_KEY"POST Request (cURL)
curl -X POST "https://api.apiverve.com/v1/mockserver/abc123/users" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"key": "value"}'JavaScript (Fetch API)
const apiKey = 'YOUR_API_KEY';
const serverId = 'abc123';
const path = '/users';
fetch(`https://api.apiverve.com/v1/mockserver/${serverId}${path}`, {
headers: {
'x-api-key': apiKey
}
})
.then(response => {
console.log('Status:', response.status);
return response.json();
})
.then(data => {
console.log('Response:', data);
})
.catch(error => {
console.error('Error:', error);
});JavaScript (POST with Fetch)
const apiKey = 'YOUR_API_KEY';
const serverId = 'abc123';
const path = '/users';
fetch(`https://api.apiverve.com/v1/mockserver/${serverId}${path}`, {
method: 'POST',
headers: {
'x-api-key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify({ key: 'value' })
})
.then(response => response.json())
.then(data => console.log('Response:', data))
.catch(error => console.error('Error:', error));Python (requests)
import requests
api_key = 'YOUR_API_KEY'
server_id = 'abc123'
path = '/users'
url = f'https://api.apiverve.com/v1/mockserver/{server_id}{path}'
headers = {'x-api-key': api_key}
# GET request
response = requests.get(url, headers=headers)
print(f'Status: {response.status_code}')
print(f'Response: {response.json()}')
# POST request
response = requests.post(url, headers=headers, json={'key': 'value'})
print(f'Response: {response.json()}')Node.js (axios)
const axios = require('axios');
const apiKey = 'YOUR_API_KEY';
const serverId = 'abc123';
const path = '/users';
const url = `https://api.apiverve.com/v1/mockserver/${serverId}${path}`;
const headers = { 'x-api-key': apiKey };
// GET request
axios.get(url, { headers })
.then(response => {
console.log('Status:', response.status);
console.log('Data:', response.data);
})
.catch(error => console.error('Error:', error));
// POST request
axios.post(url, { key: 'value' }, { headers })
.then(response => console.log('Data:', response.data))
.catch(error => console.error('Error:', error));Example Scenarios
Success Response (200)
Mock a successful API response:
{
"status": "success",
"data": {
"id": 123,
"name": "Product Name",
"price": 29.99,
"inStock": true
},
"message": "Product retrieved successfully"
}Error Response (404)
Mock a resource not found error:
{
"status": "error",
"code": "NOT_FOUND",
"message": "The requested resource was not found",
"timestamp": "2024-01-01T12:00:00Z"
}Validation Error (400)
Mock a validation error:
{
"status": "error",
"code": "VALIDATION_ERROR",
"message": "Invalid request data",
"errors": [
{
"field": "email",
"message": "Email is required"
},
{
"field": "password",
"message": "Password must be at least 8 characters"
}
]
}Server Error (500)
Mock a server error:
{
"status": "error",
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred",
"requestId": "abc-123-def"
}Rate Limits & Pricing
Free Plan
- Daily Limit: 100 requests per endpoint per day
- Reset: Daily at midnight UTC
- Endpoints: Unlimited endpoints, 1MB per response max
Paid Plans
- Requests: Unlimited (based on your API credit balance)
- Credit Cost: Requests do NOT consume credits
- Endpoints: Unlimited endpoints, 1MB per response max
Managing Your Endpoints
Edit Endpoint
Update your mock endpoint configuration:
- Navigate to Mock Server in your dashboard
- Click Edit next to your endpoint
- Modify method, status code, response, or headers
- Click Save
URL Persistence: Editing an endpoint does NOT change its URL. Existing integrations will automatically receive the updated configuration.
Delete Endpoint
- Navigate to Mock Server in your dashboard
- Click Delete next to your endpoint
- Confirm the deletion
Permanent Action: Deleting an endpoint is permanent. The URL will no longer be accessible.
View Analytics
Track usage for each endpoint:
- Total Access Count: Total number of requests
- Daily Access Count: Requests today (for free plan tracking)
- HTTP Method: Configured method
- Status Code: Configured status code
Error Responses
400 Bad Request
{
"status": "error",
"error": "Endpoint ID is required"
}404 Not Found
{
"status": "error",
"error": "Mock endpoint not found"
}405 Method Not Allowed
{
"status": "error",
"error": "Method not allowed. Expected POST, got GET"
}429 Too Many Requests
{
"status": "error",
"error": "Daily access limit exceeded (100 requests per day for free plan)",
"requiresUpgrade": true
}500 Internal Server Error
{
"status": "error",
"error": "Failed to fetch mock response"
}Best Practices
- Realistic Responses: Create responses that match your actual API structure
- Status Codes: Use appropriate status codes for different scenarios
- Headers: Include relevant headers (Content-Type, Cache-Control, etc.)
- Error Testing: Create endpoints with error responses to test error handling
- Documentation: Use descriptive names to document the purpose of each endpoint
- Size Limit: Keep responses under 1MB for optimal performance
- Method Matching: Ensure your client uses the correct HTTP method
Testing Tip: Create multiple endpoints with different status codes to thoroughly test your application's error handling.
Need Help?
Was this page helpful?
Help us improve our documentation