API Overview
Section titled “API Overview”The AutoPrintFarm API allows you to programmatically manage your print farm, integrate with existing systems, and build custom applications.
Base URL
Section titled “Base URL”All API requests should be made to:
https://api.autoprintfarm.com/v1API Versions
Section titled “API Versions”- v1 (Current): Stable, production-ready
- v2 (Beta): New features, breaking changes possible
Quick Example
Section titled “Quick Example”curl https://api.autoprintfarm.com/v1/printers \ -H "Authorization: Bearer YOUR_API_KEY"{ "printers": [ { "id": "prt_abc123", "name": "Prusa-A-01", "status": "printing", "current_job": "job_xyz789" } ]}API Capabilities
Section titled “API Capabilities”Fleet Management
Section titled “Fleet Management”- List and manage printers
- Monitor printer status
- Configure printer settings
- Group and organize printers
Job Management
Section titled “Job Management”- Create and queue jobs
- Monitor job progress
- Cancel or pause jobs
- Retrieve job history
Material Management
Section titled “Material Management”- Track material inventory
- Monitor consumption
- Set reorder alerts
- Manage material profiles
Analytics
Section titled “Analytics”- Retrieve performance metrics
- Generate reports
- Export historical data
- Track costs and ROI
Webhooks
Section titled “Webhooks”- Subscribe to events
- Real-time notifications
- Custom integrations
- Event filtering
Authentication
Section titled “Authentication”All API requests require authentication using an API key:
Authorization: Bearer YOUR_API_KEYGet your API key from the dashboard settings.
Request Format
Section titled “Request Format”Headers
Section titled “Headers”Content-Type: application/jsonAuthorization: Bearer YOUR_API_KEYJSON Body
Section titled “JSON Body”{ "printer_id": "prt_abc123", "action": "pause"}Response Format
Section titled “Response Format”Success Response
Section titled “Success Response”{ "success": true, "data": { "id": "job_xyz789", "status": "queued" }}Error Response
Section titled “Error Response”{ "success": false, "error": { "code": "invalid_printer", "message": "Printer not found", "details": "No printer with ID prt_abc123" }}HTTP Status Codes
Section titled “HTTP Status Codes”| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created |
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid API key |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Resource doesn’t exist |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error |
Rate Limiting
Section titled “Rate Limiting”API requests are rate limited to ensure fair usage:
- Free tier: 100 requests/hour
- Pro tier: 1,000 requests/hour
- Enterprise: Custom limits
Rate limit headers are included in responses:
X-RateLimit-Limit: 1000X-RateLimit-Remaining: 987X-RateLimit-Reset: 1633024800Pagination
Section titled “Pagination”List endpoints support pagination:
GET /v1/jobs?page=2&per_page=50Response includes pagination metadata:
{ "data": [...], "pagination": { "page": 2, "per_page": 50, "total": 234, "total_pages": 5 }}Filtering & Sorting
Section titled “Filtering & Sorting”Most list endpoints support filtering:
GET /v1/printers?status=printing&group=productionAnd sorting:
GET /v1/jobs?sort=-created_at&status=completedUse - prefix for descending order.
Idempotency
Section titled “Idempotency”POST requests that create resources support idempotency keys:
curl -X POST https://api.autoprintfarm.com/v1/jobs \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Idempotency-Key: unique-key-123" \ -d '{"file_url": "https://example.com/model.gcode"}'Repeating the request with the same key returns the original response.
Webhooks
Section titled “Webhooks”Subscribe to events for real-time updates:
POST /v1/webhooks{ "url": "https://your-app.com/webhook", "events": ["job.completed", "printer.offline"], "secret": "your_webhook_secret"}SDKs & Libraries
Section titled “SDKs & Libraries”Official SDKs available:
- JavaScript/Node.js:
npm install @autoprintfarm/sdk - Python:
pip install autoprintfarm - Ruby:
gem install autoprintfarm - Go:
go get github.com/autoprintfarm/autoprintfarm-go
Community libraries:
- PHP, C#, Java - see GitHub
API Explorer
Section titled “API Explorer”Try the API interactively in our API Explorer.
Support
Section titled “Support”- Documentation: You’re reading it!
- API Status: status.autoprintfarm.com
- Issues: GitHub Issues
- Email: api@autoprintfarm.com