Source Code Fetcher API

Fetch and view the complete source code from any website URL

Fetch Source Code

Enter your API key to authenticate requests
Enter a valid HTTP or HTTPS URL to fetch its source code
Loading...

Fetching source code...

API Documentation

Endpoint
POST/GET /api/fetch-source
Authentication

All API requests require authentication with an API key. Provide your API key in one of these ways:

  • Authorization header: Authorization: Bearer YOUR_API_KEY
  • X-API-Key header: X-API-Key: YOUR_API_KEY
  • Query parameter: ?api_key=YOUR_API_KEY
Note: Use your personal API key for authentication
Parameters
  • url (required): The URL to fetch source code from
  • api_key (required): Your authentication API key
Example API Calls
GET Request with API Key
curl "https://your-app.replit.app/api/fetch-source?url=https://example.com&api_key=YOUR_API_KEY"
POST Request with Authorization Header
curl -X POST "https://your-app.replit.app/api/fetch-source" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"url": "https://example.com"}'
POST Request with X-API-Key Header
curl -X POST "https://your-app.replit.app/api/fetch-source" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{"url": "https://example.com"}'
JavaScript/Fetch
fetch('/api/fetch-source', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({ url: 'https://example.com' })
}).then(response => response.json())
Response Format
{
  "success": true,
  "url": "https://example.com",
  "source_code": "...",
  "metadata": {
    "status_code": 200,
    "content_type": "text/html",
    "content_length": 1024,
    "encoding": "utf-8",
    "response_time_ms": 150.5,
    "final_url": "https://example.com",
    "headers": {...}
  }
}
Error Codes
  • MISSING_API_KEY: API key is required for authentication
  • INVALID_API_KEY: The provided API key is invalid
  • MISSING_URL: URL parameter is required
  • INVALID_URL: Invalid URL format
  • TIMEOUT: Request timed out
  • CONNECTION_ERROR: Could not connect to the website
  • HTTP_ERROR: HTTP error occurred
  • RATE_LIMIT_EXCEEDED: Too many requests