API Endpoints
Section titled “API Endpoints”Complete reference for all AutoPrintFarm API endpoints.
Printers
Section titled “Printers”List Printers
Section titled “List Printers”GET /v1/printersQuery Parameters:
status- Filter by status (idle, printing, offline)group- Filter by group IDtag- Filter by tagpage- Page numberper_page- Results per page (max 100)
Example:
curl "https://api.autoprintfarm.com/v1/printers?status=printing" \ -H "Authorization: Bearer YOUR_API_KEY"Response:
{ "data": [ { "id": "prt_abc123", "name": "Prusa-A-01", "status": "printing", "model": "Prusa i3 MK3S+", "firmware": "OctoPrint 1.8.0", "temperatures": { "hotend": 215, "bed": 60 }, "current_job": "job_xyz789", "progress": 45, "group": "production", "tags": ["enclosed", "multi-material"], "created_at": "2025-01-15T10:30:00Z", "updated_at": "2025-10-06T14:25:00Z" } ], "pagination": { "page": 1, "per_page": 20, "total": 45, "total_pages": 3 }}Get Printer
Section titled “Get Printer”GET /v1/printers/:idCreate Printer
Section titled “Create Printer”POST /v1/printersBody:
{ "name": "Prusa-B-05", "connection_url": "http://192.168.1.105", "api_key": "OctoPrint-API-Key", "model": "Prusa i3 MK3S+", "group": "production", "tags": ["enclosed"]}Update Printer
Section titled “Update Printer”PATCH /v1/printers/:idDelete Printer
Section titled “Delete Printer”DELETE /v1/printers/:idPrinter Actions
Section titled “Printer Actions”POST /v1/printers/:id/actionsActions:
pause- Pause current jobresume- Resume paused jobcancel- Cancel current jobhome- Home all axescooldown- Cool down heaters
Example:
curl -X POST "https://api.autoprintfarm.com/v1/printers/prt_abc123/actions" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{"action": "pause"}'List Jobs
Section titled “List Jobs”GET /v1/jobsQuery Parameters:
status- queued, printing, completed, failed, cancelledprinter_id- Filter by printerpriority- low, normal, high, urgentfrom- Start date (ISO 8601)to- End date (ISO 8601)
Get Job
Section titled “Get Job”GET /v1/jobs/:idResponse:
{ "id": "job_xyz789", "name": "part-001.gcode", "status": "printing", "priority": "normal", "printer_id": "prt_abc123", "progress": 45, "file_url": "https://cdn.autoprintfarm.com/files/xyz789.gcode", "estimated_duration": 7200, "elapsed_time": 3240, "material": { "type": "PLA", "color": "Black", "estimated_usage": 45.2 }, "created_at": "2025-10-06T12:00:00Z", "started_at": "2025-10-06T12:15:00Z", "completed_at": null}Create Job
Section titled “Create Job”POST /v1/jobsBody:
{ "file_url": "https://your-cdn.com/model.gcode", "name": "custom-part-v2", "priority": "high", "printer_id": "prt_abc123", // Optional - auto-assign if omitted "material": "PLA", "copies": 1, "tags": ["production", "order-456"]}With File Upload:
curl -X POST "https://api.autoprintfarm.com/v1/jobs" \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "file=@model.gcode" \ -F "name=custom-part" \ -F "priority=high"Update Job
Section titled “Update Job”PATCH /v1/jobs/:idCancel Job
Section titled “Cancel Job”DELETE /v1/jobs/:idMaterials
Section titled “Materials”List Materials
Section titled “List Materials”GET /v1/materialsGet Material
Section titled “Get Material”GET /v1/materials/:idResponse:
{ "id": "mat_pla001", "type": "PLA", "brand": "Hatchbox", "color": "Black", "spool_weight": 1000, "remaining_weight": 650, "cost_per_kg": 20.00, "printer_id": "prt_abc123", "reorder_threshold": 100, "status": "active", "created_at": "2025-09-01T10:00:00Z"}Add Material
Section titled “Add Material”POST /v1/materialsUpdate Material
Section titled “Update Material”PATCH /v1/materials/:idAnalytics
Section titled “Analytics”Fleet Overview
Section titled “Fleet Overview”GET /v1/analytics/fleetQuery Parameters:
from- Start dateto- End dategroup- Filter by group
Response:
{ "period": { "from": "2025-10-01T00:00:00Z", "to": "2025-10-06T23:59:59Z" }, "metrics": { "total_printers": 45, "active_printers": 38, "utilization_rate": 84.4, "jobs_completed": 1247, "success_rate": 96.8, "total_print_time": 89234, "material_consumed": 34567, "estimated_cost": 691.34 }}Printer Statistics
Section titled “Printer Statistics”GET /v1/analytics/printers/:idJob Statistics
Section titled “Job Statistics”GET /v1/analytics/jobsMaterial Usage
Section titled “Material Usage”GET /v1/analytics/materialsWebhooks
Section titled “Webhooks”List Webhooks
Section titled “List Webhooks”GET /v1/webhooksCreate Webhook
Section titled “Create Webhook”POST /v1/webhooksBody:
{ "url": "https://your-app.com/webhook", "events": [ "job.created", "job.started", "job.completed", "job.failed", "printer.offline", "printer.online", "material.low" ], "secret": "webhook_secret_key", "enabled": true}Available Events:
job.*- All job eventsjob.created,job.started,job.completed,job.failedprinter.*- All printer eventsprinter.online,printer.offline,printer.errormaterial.*- All material eventsmaterial.low,material.empty
Update Webhook
Section titled “Update Webhook”PATCH /v1/webhooks/:idDelete Webhook
Section titled “Delete Webhook”DELETE /v1/webhooks/:idTest Webhook
Section titled “Test Webhook”POST /v1/webhooks/:id/testOrganizations
Section titled “Organizations”Get Organization
Section titled “Get Organization”GET /v1/organizationUpdate Organization
Section titled “Update Organization”PATCH /v1/organizationList Users
Section titled “List Users”GET /v1/usersGet User
Section titled “Get User”GET /v1/users/:idInvite User
Section titled “Invite User”POST /v1/users/inviteError Codes
Section titled “Error Codes”| Code | Description |
|---|---|
invalid_request | Request format invalid |
invalid_api_key | API key invalid or expired |
insufficient_permissions | Missing required scope |
resource_not_found | Resource doesn’t exist |
printer_busy | Printer already printing |
printer_offline | Printer not connected |
file_invalid | G-code file invalid |
quota_exceeded | Plan limit reached |
rate_limit_exceeded | Too many requests |
internal_error | Server error |
Rate Limits
Section titled “Rate Limits”See API Overview - Rate Limiting for details.
Pagination
Section titled “Pagination”All list endpoints support pagination:
GET /v1/jobs?page=2&per_page=50Maximum per_page: 100
Sorting
Section titled “Sorting”Sort results with sort parameter:
GET /v1/jobs?sort=-created_at # DescendingGET /v1/jobs?sort=priority # AscendingField Selection
Section titled “Field Selection”Request specific fields only:
GET /v1/printers?fields=id,name,statusReduces response size and improves performance.
SDK Examples
Section titled “SDK Examples”JavaScript
Section titled “JavaScript”import { AutoPrintFarm } from '@autoprintfarm/sdk';
const client = new AutoPrintFarm({ apiKey: 'YOUR_KEY' });
// List printersconst printers = await client.printers.list({ status: 'printing' });
// Create jobconst job = await client.jobs.create({ file_url: 'https://example.com/model.gcode', priority: 'high'});
// Get analyticsconst analytics = await client.analytics.fleet({ from: '2025-10-01', to: '2025-10-06'});Python
Section titled “Python”from autoprintfarm import Client
client = Client(api_key='YOUR_KEY')
# List printersprinters = client.printers.list(status='printing')
# Create jobjob = client.jobs.create( file_url='https://example.com/model.gcode', priority='high')
# Get analyticsanalytics = client.analytics.fleet( from_date='2025-10-01', to_date='2025-10-06')