Making Requests
Our REST API is accessible via HTTPS at https://browserize.com/api. All requests must use HTTPS - HTTP requests will be rejected.
The API accepts requests with JSON payloads and returns JSON responses. Make sure to set the appropriate content type header:
Content-Type: application/jsonAuthentication
All API requests require authentication using an API key. Include your API key in the Authorization header:
Authorization: Bearer your_api_key_hereYou can obtain an API key from your dashboard settings. Keep your API key secure and never share it publicly.
Response Format
Successful responses follow a standard format:
{
"status": "success",
"data": {
// Response data here
},
"meta": {
"request_id": "req_abc123",
"timestamp": "2024-03-20T12:00:00Z"
}
}The data field contains the actual response data, while the meta field includes request metadata that can be useful for debugging.
Error Handling
Error responses follow a consistent format:
{
"status": "error",
"error": {
"code": "invalid_request",
"message": "The request was invalid",
"details": {
"field": "email",
"issue": "Invalid email format"
}
}
}Common HTTP status codes:
200- Success400- Bad Request401- Unauthorized403- Forbidden404- Not Found429- Too Many Requests500- Internal Server Error
Examples
Here's a complete example of making an API request using fetch:
const API_KEY = 'your_api_key_here';
const API_URL = 'https://browserize.com/api';
async function createScreenshot(url) {
try {
const response = await fetch(`${API_URL}/screenshots`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: url,
format: 'png',
width: 1920,
height: 1080
})
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.error.message);
}
const data = await response.json();
return data.data;
} catch (error) {
console.error('API request failed:', error);
throw error;
}
}Check out our examples section for more code samples in different programming languages.