API Endpoints
Complete reference of all available endpoints
Base URL:
https://api.snaptrack.dev
Website Endpoints
List Websites
GET /websites?page=1
Authorization: Bearer YOUR_TOKEN
Query Parameters:
- page (int): Page number
Response: 200 OK
{
"data": [
{
"id": 1,
"name": "My Website",
"url": "https://example.com",
"viewport_width": 1920,
"viewport_height": 1080,
"full_page": true,
"status": "active",
"last_screenshot_at": "2025-01-27T10:30:00Z"
}
],
"meta": {
"current_page": 1,
"total": 5
}
}Create Website
POST /websites
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"name": "My Website",
"url": "https://example.com",
"viewport_width": 1920,
"viewport_height": 1080,
"full_page": true
}
Response: 201 Created
{
"success": true,
"data": {
"id": 1,
"name": "My Website",
"url": "https://example.com",
"viewport_width": 1920,
"viewport_height": 1080,
"full_page": true,
"status": "active"
}
}Get Website
GET /websites/{id}
Authorization: Bearer YOUR_TOKEN
Response: 200 OK
{
"data": {
"id": 1,
"name": "My Website",
"url": "https://example.com",
"viewport_width": 1920,
"viewport_height": 1080,
"full_page": true,
"status": "active",
"last_screenshot_at": "2025-01-27T10:30:00Z"
}
}Update Website
PUT /websites/{id}
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"name": "Updated Name",
"viewport_width": 1280
}
Response: 200 OK
{
"success": true,
"data": {
"id": 1,
"name": "Updated Name",
"viewport_width": 1280
}
}Delete Website
DELETE /websites/{id}
Authorization: Bearer YOUR_TOKEN
Response: 200 OK
{
"success": true,
"message": "Website deleted successfully"
}Take Screenshot
POST /websites/{id}/screenshot
Authorization: Bearer YOUR_TOKEN
Response: 200 OK
{
"success": true,
"message": "Screenshot job queued successfully",
"job_id": "abc123"
}Screenshot Endpoints
List Screenshots
GET /screenshots?page=1
Authorization: Bearer YOUR_TOKEN
Query Parameters:
- page (int): Page number
- website_id (int): Filter by website
Response: 200 OK
{
"data": [
{
"id": 1,
"website_id": 1,
"file_path": "/storage/screenshots/...",
"file_size": 245678,
"width": 1920,
"height": 1080,
"status": "success",
"taken_at": "2025-01-27T10:30:00Z"
}
]
}Get Screenshot
GET /screenshots/{id}
Authorization: Bearer YOUR_TOKEN
Response: 200 OK
{
"data": {
"id": 1,
"website_id": 1,
"file_path": "/storage/screenshots/...",
"file_size": 245678,
"width": 1920,
"height": 1080,
"status": "success",
"taken_at": "2025-01-27T10:30:00Z"
}
}Download Screenshot
GET /screenshots/{id}/download
Authorization: Bearer YOUR_TOKEN
Response: Binary image file (PNG)Bulk Download Screenshots
POST /screenshots/download-bulk
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"screenshot_ids": [1, 2, 3]
}
Response: ZIP file (requires Pro or Business plan)Delete Screenshot
DELETE /screenshots/{id}
Authorization: Bearer YOUR_TOKEN
Response: 200 OK
{
"success": true,
"message": "Screenshot deleted successfully"
}Scenario Endpoints
List Scenarios
GET /scenarios?page=1
Authorization: Bearer YOUR_TOKEN
Response: 200 OK
{
"data": [
{
"id": 1,
"name": "Login Test",
"description": "Test user login",
"website_id": 1,
"status": "active",
"steps": [...]
}
]
}Create Scenario
POST /scenarios
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"name": "Login Test",
"description": "Test user login",
"website_id": 1,
"steps": [
{
"type": "navigate",
"url": "https://example.com/login"
},
{
"type": "fill",
"selector": "#email",
"value": "[email protected]"
},
{
"type": "fill",
"selector": "#password",
"value": "password123"
},
{
"type": "click",
"selector": "button[type='submit']"
},
{
"type": "wait",
"duration": 2000
}
]
}
Response: 201 CreatedGet Scenario
GET /scenarios/{id}
Authorization: Bearer YOUR_TOKEN
Response: 200 OKUpdate Scenario
PUT /scenarios/{id}
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"name": "Updated Name",
"description": "Updated description"
}
Response: 200 OKDelete Scenario
DELETE /scenarios/{id}
Authorization: Bearer YOUR_TOKEN
Response: 200 OK
{
"success": true,
"message": "Scenario deleted successfully"
}Run Scenario
POST /scenarios/{id}/run
Authorization: Bearer YOUR_TOKEN
Response: 200 OK
{
"success": true,
"message": "Scenario execution started",
"execution_id": "exec_123"
}Schedule Endpoints
List Schedules
GET /schedules
Authorization: Bearer YOUR_TOKEN
Response: 200 OK
{
"data": [
{
"id": 1,
"name": "Daily Screenshot",
"website_id": 1,
"frequency": "daily",
"time": "09:00",
"timezone": "America/New_York",
"enabled": true,
"next_run_at": "2025-01-28T09:00:00Z"
}
]
}Create Schedule
POST /schedules
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"name": "Daily Screenshot",
"website_id": 1,
"frequency": "daily",
"time": "09:00",
"timezone": "America/New_York",
"enabled": true
}
Response: 201 CreatedGet Schedule
GET /schedules/{id}
Authorization: Bearer YOUR_TOKEN
Response: 200 OKUpdate Schedule
PUT /schedules/{id}
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"name": "Updated Name",
"frequency": "weekly",
"enabled": false
}
Response: 200 OKDelete Schedule
DELETE /schedules/{id}
Authorization: Bearer YOUR_TOKEN
Response: 200 OK
{
"success": true,
"message": "Schedule deleted successfully"
}Utility Endpoints
Health Check
GET /health
Response: 200 OK
{
"status": "healthy",
"timestamp": "2025-01-27T15:30:00Z",
"api_version": "1.0"
}Test Connection
GET /test
Authorization: Bearer YOUR_TOKEN
Response: 200 OK
{
"success": true,
"message": "API is working",
"user": {
"id": 1,
"name": "John Doe",
"subscription_tier": "pro"
},
"rate_limit": {
"limit": 20,
"remaining": 19,
"reset": 1706371200
}
}Response Format
Success Response
{
"success": true,
"data": { ... },
"message": "Operation successful"
}Error Response
{
"success": false,
"error": "Error message",
"code": "ERROR_CODE"
}Pagination
{
"data": [...],
"meta": {
"current_page": 1,
"last_page": 5,
"per_page": 15,
"total": 73
},
"links": {
"first": "https://api.snaptrack.dev/websites?page=1",
"last": "https://api.snaptrack.dev/websites?page=5",
"prev": null,
"next": "https://api.snaptrack.dev/websites?page=2"
}
}
SnapTrack API