Use these endpoints to register the client, create print jobs (upload or URL), poll and update jobs, and query history. All responses are JSON. By default, each API key has a daily creation limit of 10 jobs (resets daily).
apiKey) → open /dashboard/YOUR_API_KEY. Deploy to Vercel when ready.
Description: Used by the ePrinter_client application to register itself with the server, providing its unique API key and a list of available printers.
Endpoint: GET /api/client/:apiKey
Description: Retrieves information about a specific client, including its status (online/offline) and registered printers. Used by the web dashboard.
curl -X GET https://eprinter.fadel.web.id/api/client/your_client_api_key
apiKey: The unique API key of the client.Success (200 OK):
{
"apiKey": "string",
"printers": ["string"],
"lastSeen": "ISO 8601 datetime string",
"status": "online" | "offline"
}
Error (404 Not Found):
{
"message": "Client not found"
}
Endpoint: POST /api/print
Description: Creates a new print job by uploading a PDF or image. Image files (JPG/PNG) are converted to PDF server-side before being sent to the client.
curl -X POST https://eprinter.fadel.web.id/api/print \
-H "Content-Type: multipart/form-data" \
-F "apiKey=your_client_api_key" \
-F "printer=Your Printer Name" \
-F "document=@/path/to/your/file.pdf" \ # or image: .jpg/.png
-F "paperSize=A4" \
-F "orientation=Portrait" \
-F "colorMode=Color"
apiKey: string (Unique API key)printer: string (Name of the target printer)document: file (PDF or image; images are auto-converted to PDF)paperSize: string (e.g., "A4", "Letter", "Legal")orientation: string (e.g., "Portrait", "Landscape")colorMode: string (e.g., "Color", "Grayscale")Success (201 Created):
{
"message": "Print job created."
}
Error (400 Bad Request):
{
"message": "Document file is required."
}
Error (429 Too Many Requests): daily limit reached
{
"message": "Daily limit reached (10 jobs). Try again tomorrow."
}
Endpoint: POST /api/print-raw
Description: Creates a new print job by providing a URL to a file. PDF is used as-is; supported images (JPG/PNG) are converted to PDF server-side before sending to the client.
curl -X POST https://eprinter.fadel.web.id/api/print-raw \
-H "Content-Type: application/json" \
-d '{
"apiKey": "your_client_api_key",
"printer": "Your Printer Name",
"documentUrl": "http://example.com/file.pdf" # or image URL
"paperSize": "A4",
"orientation": "Portrait",
"colorMode": "Color"
}'
{
"apiKey": "string", // Unique API key of the target client
"printer": "string", // Name of the target printer on the client machine
"documentUrl": "string", // URL to the PDF document (e.g., "http://example.com/document.pdf")
"paperSize": "string", // Optional: "A4", "Letter", "Legal" (default: "A4")
"orientation": "string", // Optional: "Portrait", "Landscape" (default: "Portrait")
"colorMode": "string" // Optional: "Color", "Grayscale" (default: "Color")
}
Success (201 Created):
{
"message": "Print job created via API.",
"jobId": "string" // The ID of the newly created job
}
Error (400 Bad Request):
{
"message": "apiKey, printer, and documentUrl are required."
}
or
{
"message": "Failed to download document from [URL]"
}
Error (500 Internal Server Error):
{
"message": "Failed to create print job via API.",
"error": "string"
}
Endpoint: GET /api/jobs/:apiKey
Description: Used by the ePrinter_client to check for any pending print jobs assigned to its API key.
curl -X GET https://eprinter.fadel.web.id/api/jobs/your_client_api_key
apiKey: The unique API key of the client.Success (200 OK):
If a pending job is found:
{
"jobId": "string",
"apiKey": "string",
"printer": "string",
"paperSize": "string",
"orientation": "string",
"colorMode": "string",
"documentName": "string", // Original filename
"documentBase64": "string", // Base64 PDF content (delivered to client only; not persisted)
"createdAt": "ISO 8601 datetime string",
"status": "processing" // Status is immediately set to 'processing' by the server
}
If no pending job is found:
null
Endpoint: POST /api/jobs/:jobId/status
Description: Used by the ePrinter_client to update the status of a print job after it has been processed (printed successfully or failed).
curl -X POST https://eprinter.fadel.web.id/api/jobs/your_job_id/status \
-H "Content-Type: application/json" \
-d '{ "status": "success", "message": "Printed successfully." }'
jobId: The ID of the job to update.{
"status": "success" | "failed", // The new status of the job
"message": "string" // Optional: A message describing the outcome (e.g., error message)
}
Success (200 OK):
{
"message": "Job status updated."
}
Error (404 Not Found):
{
"message": "Job not found."
}
Endpoint: GET /api/history/:apiKey
Description: Retrieves the print history for a specific API key. Can also be used to check the status of a single job by providing a jobId query parameter.
curl -X GET https://eprinter.fadel.web.id/api/history/your_client_api_key
curl -X GET https://eprinter.fadel.web.id/api/history/your_client_api_key?jobId=your_job_id
apiKey: The unique API key of the client.jobId: string (Optional) - If provided, returns details for this specific job.If jobId query parameter is provided and found (200 OK):
{
"jobId": "string",
"apiKey": "string",
"printer": "string",
"paperSize": "string",
"orientation": "string",
"colorMode": "string",
"documentName": "string",
"createdAt": "ISO 8601 datetime string",
"status": "pending" | "processing" | "success" | "failed",
"completedAt": "ISO 8601 datetime string", // Present if job is completed
"message": "string" // Present if job is completed
}
If jobId query parameter is provided but not found (404 Not Found):
{
"message": "Job not found for this API Key."
}
If no jobId query parameter is provided (200 OK):
[
{
"jobId": "string",
"apiKey": "string",
"printer": "string",
"paperSize": "string",
"orientation": "string",
"colorMode": "string",
"documentName": "string",
"createdAt": "ISO 8601 datetime string",
"status": "pending" | "processing" | "success" | "failed",
"completedAt": "ISO 8601 datetime string",
"message": "string"
},
// ... more job objects
]
Endpoint: POST /api/reprint/:jobId
Description: Creates a new print job referencing the same document as an existing job. Reprints count toward the daily limit.
{ "message": "Job queued for reprint." }
Error: 404 if job not found; 429 if daily limit reached.