Skip to main content

API Reference

3DPrintForge exposes a full REST API with 590+ endpoints. The API documentation is available directly in the dashboard.

Interactive documentation

Open the OpenAPI documentation in the browser:

https://your-server:3443/api/docs

Here you will find all endpoints, parameters, request/response schemas, and the ability to test the API directly.

Authentication

The API uses Bearer token authentication (JWT):

# Log in and get token
curl -X POST https://your-server:3443/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "your-password"}'

# Response
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": "24h"
}

Use the token in all subsequent calls:

curl https://your-server:3443/api/printers \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Rate limiting

The API is rate-limited to protect the server:

LimitValue
Requests per minute200
Burst (max per second)20
Response on exceeded429 Too Many Requests

The Retry-After header in the response indicates how many seconds until the next request is allowed.

Endpoint overview

Authentication

MethodEndpointDescription
POST/api/auth/loginLog in, get JWT
POST/api/auth/logoutLog out
GET/api/auth/meGet logged-in user

Printers

MethodEndpointDescription
GET/api/printersList all printers
POST/api/printersAdd printer
GET/api/printers/:idGet printer
PUT/api/printers/:idUpdate printer
DELETE/api/printers/:idDelete printer
GET/api/printers/:id/statusReal-time status
POST/api/printers/:id/commandSend command

Filament

MethodEndpointDescription
GET/api/filamentsList all spools
POST/api/filamentsAdd spool
PUT/api/filaments/:idUpdate spool
DELETE/api/filaments/:idDelete spool
GET/api/filaments/statsConsumption statistics
MethodEndpointDescription
GET/api/historyList history (paginated)
GET/api/history/:idGet single print
GET/api/history/exportExport CSV
GET/api/history/statsStatistics
MethodEndpointDescription
GET/api/queueGet queue
POST/api/queueAdd job
PUT/api/queue/:idUpdate job
DELETE/api/queue/:idRemove job
POST/api/queue/dispatchForce dispatch

WebSocket API

In addition to REST, there is a WebSocket API for real-time data:

const ws = new WebSocket('wss://your-server:3443/ws');

ws.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log(data.type, data.payload);
};

Message types (incoming)

  • printer.status — updated printer status
  • print.progress — progress percentage update
  • ams.update — AMS state change
  • notification — notification message

Error codes

CodeMeaning
200OK
201Created
400Bad request
401Not authenticated
403Not authorized
404Not found
429Too many requests
500Server error