FakeURL API Documentation
Complete guide and API documentation for FakeURL
GET Mode
GET mode is the simplest way to use FakeURL. Configure parameters directly in the URL.
Basic Format
https://fakeurl.dev/{statusCode}?delay={delay}&json={json}&headers={headers}
Parameters
Parameter | Type | Description | Example |
---|---|---|---|
statusCode | Path parameter | HTTP status code (100-599) | 200, 404, 500 |
delay | Query parameter | Delay time in milliseconds (max 30000) | 1000, 3000 |
json | Query parameter | JSON response data (URL encoded) | {"key": "value"} |
headers | Query parameter | Custom HTTP headers (key:value format) | X-Custom:value |
POST Mode
Important: POST mode works the same as GET mode - all configuration is done via URL parameters, not request body. The request body is ignored, and the mock response is configured through the URL.
Basic Format
POST https://fakeurl.dev/{statusCode}?delay={delay}&json={json}&headers={headers}
How It Works
POST requests use the exact same URL parameter configuration as GET mode. This allows you to test POST endpoints with mock responses configured entirely through the URL.
Usage Examples
Simple Response
# Return 200 status code with empty JSON GET https://fakeurl.dev/200 # Return 404 status code GET https://fakeurl.dev/404
Delayed Response
# Return 200 after 2 second delay GET https://fakeurl.dev/200?delay=2000
Custom JSON Response
# Return custom JSON data
GET https://fakeurl.dev/201?json={"id": 123, "name": "Test Project", "status": "active"}
Custom Headers
# Add custom headers to response
GET https://fakeurl.dev/200?headers=X-Custom-Header:value,X-Another:test
cURL Examples
# GET request example
curl 'https://fakeurl.dev/200?delay=1000&json={"message":"success"}'
# POST request example (configured via URL)
curl -X POST 'https://fakeurl.dev/201?delay=500&json={"id":123,"created":true}'
# With custom headers
curl 'https://fakeurl.dev/200?json={"data":"test"}&headers=X-API-Key:secret123'
JavaScript/Fetch Example
// Simple fetch
fetch('https://fakeurl.dev/200')
.then(res => res.json())
.then(data => console.log(data));
// POST request with mock response
fetch('https://fakeurl.dev/201?json={"id":456,"status":"created"}', {
method: 'POST',
body: JSON.stringify({ name: 'Test' })
})
.then(res => res.json())
.then(data => console.log(data));
// Simulating slow network
fetch('https://fakeurl.dev/200?delay=3000&json={"slow":"response"}')
.then(res => res.json())
.then(data => console.log(data));
Best Practices
- Use appropriate status codes to simulate real scenarios (200 for success, 404 for not found, 500 for server errors)
- Add reasonable delays to simulate network conditions and test loading states
- URL encode your JSON data in query parameters
- Test both success and error cases in your application
- Use custom headers to test header-based authentication or CORS scenarios
- Remember: Both GET and POST modes use URL parameters for configuration
Common Use Cases
Frontend Development
Mock API responses while the backend is still in development.
Testing Error Handling
Simulate various HTTP error codes to ensure your app handles them gracefully.
Network Condition Testing
Add delays to test loading states, timeouts, and slow network scenarios.
API Prototyping
Quickly prototype API responses without setting up a backend server.
Demo Applications
Create demo apps without needing a real backend infrastructure.