Build a BizPrint Print API integration with an AI coding assistant
This page shows you how to use an AI coding assistant, such as Claude Code, Cursor, GitHub Copilot or Lovable, to add BizPrint printing to your own app with the BizPrint Print API. It is for developers, agencies and makers who build with an assistant and want the code it writes to be safe to run in front of real customers.
If you want an AI assistant to print for you, rather than write code, see Print from AI assistants with the BizPrint MCP server instead.
Before you start
Section titled “Before you start”- Have a BizPrint account, a station and at least one printer that prints a test page from the computer or device itself. See Choose your BizPrint setup path.
- Create an application for your app and copy its Public Key and Secret Key. See Get API keys for the BizPrint Print API.
- Make sure your app has a server side: a backend, an API route or a server function. Your Secret Key and the code that signs requests must live there. See Keep the Secret Key on a server.
Point the assistant at the BizPrint docs
Section titled “Point the assistant at the BizPrint docs”Assistants write better code from the real docs than from memory or from search results. Give your assistant one of these addresses:
https://docs.getbizprint.com/llms.txt: a short guide for AI assistants and a list of every page.https://docs.getbizprint.com/llms/developers.txt: the full text of every developer page in one file.- Any single page as Markdown: add
index.mdto its address, for examplehttps://docs.getbizprint.com/developers/create-print-job/index.md.
Tell the assistant to build only on what these pages describe. If your assistant cannot open web addresses, paste the text of the pages you need into the chat.
Rules to give your assistant
Section titled “Rules to give your assistant”Copy these rules into your project’s instructions file for the assistant (for example CLAUDE.md, AGENTS.md or your tool’s project rules), or paste them at the start of the chat:
BizPrint printing rules for this project
Docs: use https://docs.getbizprint.com/llms.txt and the pages it lists.Use only the endpoints, fields and values those pages describe. Ifsomething is not documented, stop and ask me. Do not guess.
Keys- Read BIZPRINT_PUBLIC_KEY and BIZPRINT_SECRET_KEY from server-side environment variables. Never write real keys in code, tests, logs or commits, and never print them in error messages.- The Secret Key and all request signing stay on the server. Never put them in browser code, a mobile app, or anything sent to the browser.- If the app has no server side, stop and ask me before adding printing.
Requests- In Node.js or TypeScript, use the BizPrint Node.js SDK (@bizswoop/print-client, /developers/node-sdk/) on the server. It signs every request for you.- Otherwise, sign every request as described on "Sign BizPrint Print API requests" (/developers/authentication/). Make a new time value for each request.- Create print jobs with POST /jobs (client.Jobs.create in the SDK) and the fields printerId, url and description. Leave out printOption.- Give every job a description that is unique to it, such as the order number, and save the job id from the response.- Send PDF documents to printers on desktop stations. Printers on Android stations accept PDF, HTML or plain text documents, so a PDF works on both.- Send ZPL or TSPL label code only to a label printer on an Android station whose printer language is the same as the code.- Serve PDFs with Content-Type: application/pdf, and answer HEAD requests for the same address with that content type. Otherwise a desktop station can treat the PDF as a web page and print nothing.- The document url must work from the station without a login. Protect it with a long random token in the address, not with a session.
Never print twice- Never retry POST /jobs automatically, in a loop, or in a queue. Every accepted request prints again.- After a timeout, a network error or a server error, check whether the job exists before doing anything else: GET /jobs/{id} if you have the id, otherwise list jobs. Jobs are listed oldest first, so use the X-Biz-Total-Pages header to read the last pages, and match the description, url and createdAt.- Never create a new job while a matching job is pending, connecting-to-printer or processing, or after it is done.- A job's status alone does not tell you whether paper came out. A webhook update, or no update, does not prove it either.- Before any job is sent again, a person must check the paper at the printer, check the job in the BizPrint dashboard, and let the station finish what it is printing. Never do this automatically.- Never re-create an order or repeat a payment to get a printout.
Errors- Handle each error code as described on "BizPrint Print API error codes and how to fix them" (/developers/errors/).- On a 400, 401 or 403 error, show a clear message and stop. Sending the same request again gets the same error.Keep the Secret Key on a server
Section titled “Keep the Secret Key on a server”Anyone who has your Secret Key can send print jobs to your printers. A key in browser code can be read by every visitor to your site, so the signing code must run on a server.
Some app builders make apps that run only in the browser. If yours does:
- Ask the assistant to add a server function or backend to your app first.
- Store the Public Key and Secret Key as secret environment variables in that server, using your tool’s own secrets settings.
- Ask the assistant to put the signing code and the call to BizPrint in that server function.
- Have your web page call your own server function, never BizPrint directly.
Never paste your Secret Key into the chat with the assistant. Put it in the environment variable yourself. If you think the key has been seen by anyone else, see Keep your BizPrint Public Key and Secret Key safe.
Check the code before you go live
Section titled “Check the code before you go live”Before the code prints real orders, read through what the assistant wrote, or ask it to show you each of these:
- Search the code for your Secret Key. It must appear only as an environment variable name, never as a value.
- Check that the signing code runs only on the server.
- Check that nothing sends
POST /jobsagain on its own after an error or a timeout. - Check that the job
idis saved, so you can look the job up later. See Check print job status with the BizPrint Print API. - Check that the document address opens in a private browser window without signing in.
- Check that your server sends PDFs with the content type
application/pdf, for normal requests and forHEADrequests. See Serve the document to print with the BizPrint Print API (print by URL). - Send one test job to a printer you can see.
- Check the paper at the printer.
- Open the job in the BizPrint dashboard.
- Check that its status is done.
For desktop stations, you can mark test printouts so nobody mistakes them for real orders. See Test printing with Development Mode in the BizPrint dashboard. Development Mode applies to your whole account, so turn it off again when you finish testing.
If a request fails, see BizPrint Print API error codes and how to fix them before you change any retry logic.
Related pages
Section titled “Related pages”- Sign BizPrint Print API requests
- Use the BizPrint Node.js SDK to create and check print jobs
- Create a print job with the BizPrint Print API
- Serve the document to print with the BizPrint Print API (print by URL)
- Receive print job updates from BizPrint with webhooks
Need help? Contact BizPrint support at https://getbizprint.com/support/.