---
title: "Use the BizPrint Node.js SDK to create and check print jobs"
description: "Install the BizPrint Node.js SDK on your server and use it to list printers, create print jobs, and check their status without signing requests by hand."
url: https://docs.getbizprint.com/developers/node-sdk/
section: "Developers"
last_updated: 2026-11-12
---

# Use the BizPrint Node.js SDK to create and check print jobs

Section: Developers

> Install the BizPrint Node.js SDK on your server and use it to list printers, create print jobs, and check their status without signing requests by hand.

This page shows you how to use the BizPrint Node.js SDK, published on npm as `@bizswoop/print-client`, to call the BizPrint Print API from your own server. It is for developers who build their own app or store integration in Node.js or TypeScript, and it works with both the desktop app and the Android app as [stations](https://docs.getbizprint.com/start-here/glossary/#station).

The SDK signs every request for you, so you do not need to follow [Sign BizPrint Print API requests](https://docs.getbizprint.com/developers/authentication/) by hand.

## Before you start

- Use Node.js 20.19 or later on your server.
- Have the [Public Key and Secret Key](https://docs.getbizprint.com/start-here/glossary/#public-key-and-secret-key) of an [application](https://docs.getbizprint.com/start-here/glossary/#application) that uses the **REST API**. See [Get API keys for the BizPrint Print API](https://docs.getbizprint.com/developers/get-api-keys/).
- Use the SDK on your server only. It needs your Secret Key, so never use it in browser code or in an app you hand out.
- Keep your keys in your server’s environment, not in your code repository.

## Install the SDK

1. Open a terminal in your project folder.

2. Run this command:

   ```sh
   npm install @bizswoop/print-client
   ```

## Create a client

```js
import PrintClient from '@bizswoop/print-client';

// Set these on your server to YOUR_PUBLIC_KEY and YOUR_SECRET_KEY.
const client = new PrintClient({
  publicKey: process.env.BIZPRINT_PUBLIC_KEY,
  secretKey: process.env.BIZPRINT_SECRET_KEY,
});
```

If your project uses `require` instead of `import`, load the client like this:

```js
const PrintClient = require('@bizswoop/print-client').default;
```

The SDK includes TypeScript types, so you do not need to install them separately. This page covers `client.Printers` and `client.Jobs`.

## Find your printer

Each [print job](https://docs.getbizprint.com/start-here/glossary/#print-job) goes to one [printer](https://docs.getbizprint.com/start-here/glossary/#printer), by its ID. List your printers to find it:

```js
const printers = await client.Printers.list({ perPage: 20, page: 1 });

for (const printer of printers.data) {
  console.log(printer.id, printer.name, printer.status, printer.station.name);
}
```

To get one printer, use `client.Printers.retrieve(YOUR_PRINTER_ID)`. For the fields, see [List printers with the BizPrint Print API](https://docs.getbizprint.com/developers/printers/).

## Create a print job

```js
const job = await client.Jobs.create({
  printerId: YOUR_PRINTER_ID,
  url: 'https://example.com/receipts/1001.pdf?token=LONG_RANDOM_TOKEN',
  description: 'Order 1001',
});

console.log(job.id, job.status);
```

- `printerId` is the printer’s ID, as a number.
- `url` is the address the station downloads and prints. Send a PDF to printers on desktop stations. Printers on Android stations accept a PDF, an HTML page or plain text, and label printers also accept ZPL or TSPL label code in their own printer language. See [Serve the document to print with the BizPrint Print API (print by URL)](https://docs.getbizprint.com/developers/print-by-url/).
- `description` is a short name for the job, such as the order number. Make it unique to the job, so you can find the job again later.
- `printOption` is optional. See [Create a print job with the BizPrint Print API](https://docs.getbizprint.com/developers/create-print-job/).

Save `job.id`. You need it to check the job later.

## Check a print job

```js
const job = await client.Jobs.retrieve(savedJobId);
console.log(job.status);
```

For what each status means, see [Check print job status with the BizPrint Print API](https://docs.getbizprint.com/developers/job-status/).

## Go through all pages of a list

A list call returns one page, with `data`, `hasMore`, `totalAll` and `totalPages`. To go through every page, use `for await`. Each loop gives you one page:

```js
let allJobs = [];
for await (const page of client.Jobs.list({ perPage: 50 })) {
  allJobs = allJobs.concat(page.data);
}
```

Jobs are listed oldest first. To see your newest jobs:

1. Ask for the first page, for example with `client.Jobs.list({ perPage: 50 })`.
2. Read `totalPages` from it. If it is 0, there are no jobs to list.
3. Ask for the last page only when `totalPages` is more than 1, with the same `perPage`, for example `client.Jobs.list({ perPage: 50, page: totalPages })`.

For more about pages, see [Page through results with the BizPrint Print API](https://docs.getbizprint.com/developers/pagination/).

## Handle errors without printing twice

Every accepted `client.Jobs.create` call creates a new job, and every new job prints. So never call it again automatically after an error or a timeout.

Check the error’s `name`:

| `name`                                                                        | What happened                                                                                                                          | What to do                                                                                                                     |
| ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `JobCreatingInvalidRequestError`                                              | A field is missing or wrong. Its `errors` property lists the messages for each field.                                                  | Fix the request. No job was created.                                                                                           |
| `JobCreatingInvalidPrinterError`                                              | The printer ID is not one of your printers.                                                                                            | Check the ID. No job was created.                                                                                              |
| `JobCreatingPrintJobLimitError`                                               | Your account reached its print job limit.                                                                                              | See [BizPrint pricing](https://getbizprint.com/pricing/). No job was created.                                                  |
| `UnauthorizedError`                                                           | The keys or the signature were not accepted.                                                                                           | Check your keys. No job was created.                                                                                           |
| Another error with `error.response?.data?.errorCode` of `ERR_USER_IS_BLOCKED` | Your account cannot create print jobs right now, for example because the printing service is paused.                                   | See [BizPrint Print API error codes and how to fix them](https://docs.getbizprint.com/developers/errors/). No job was created. |
| Anything else, or no answer                                                   | The SDK could not confirm what happened, for example because of a server or network problem. The job may or may not have been created. | Do not create it again yet. Look up your recent jobs first.                                                                    |

```js
try {
  const job = await client.Jobs.create({
    printerId: YOUR_PRINTER_ID,
    url: 'https://example.com/receipts/1001.pdf?token=LONG_RANDOM_TOKEN',
    description: 'Order 1001',
  });
  await saveJobId('order-1001', job.id);
} catch (error) {
  if (error.name === 'JobCreatingInvalidRequestError') {
    console.error('Fix these fields:', error.errors);
  } else {
    // The job may exist. Do not retry automatically.
    // Look up recent jobs (for example, by description) before you create it again.
    console.error('Could not confirm the print job:', error.message);
  }
}
```

When you look up a job with `client.Jobs.retrieve` or `client.Printers.retrieve`, the SDK can also throw `NotFoundError` (the ID does not exist) or `AccessForbiddenError` (your application is not allowed to see it). See [BizPrint Print API error codes and how to fix them](https://docs.getbizprint.com/developers/errors/).

`saveJobId` stands for your own code that remembers which job belongs to which order.

Before anyone prints the same order again, check all of these:

1. Look at the paper at the printer.
2. Look up your newest jobs with `client.Jobs.list`, and match the description, url and `createdAt`.
3. Check the job’s status in the [BizPrint dashboard](https://docs.getbizprint.com/start-here/glossary/#bizprint-dashboard).
4. Let the station finish what it is printing, whatever status the job shows.

Never create a new job while a matching job is `pending`, `connecting-to-printer` or `processing`. If it really did not print, reprint the existing job from the dashboard. See [Reprint a print job from the BizPrint dashboard](https://docs.getbizprint.com/print/reprint-a-job/).

## Related pages

- [Create a print job with the BizPrint Print API](https://docs.getbizprint.com/developers/create-print-job/)
- [Check print job status with the BizPrint Print API](https://docs.getbizprint.com/developers/job-status/)
- [BizPrint Print API error codes and how to fix them](https://docs.getbizprint.com/developers/errors/)
- [Sign and check BizPrint Print API requests with the signing tool](https://docs.getbizprint.com/developers/signing-tool/)
- [Receive print job updates from BizPrint with webhooks](https://docs.getbizprint.com/developers/webhooks/)

Need help? Contact BizPrint support at <https://getbizprint.com/support/>.
