Skip to main content

snipeit-asset-management CLI

Repo: snipeit-asset-management (private) CLI entry point: python scripts/<script>.py Framework: argparse + FastAPI (label-service) Language: Python 3.11+

Asset tracking workflows and label printing for Snipe-IT. Includes Python CLI scripts for label generation and asset export, plus a FastAPI label-service that manages label lifecycle and generates print-ready images for the Brother PT-D610BT.

CLI Scripts

Label Generation and Printing

ScriptDescriptionDocs
batch-label.pyBatch-generate labels for multiple assetsView
print-label.pyGenerate print-ready label for one or more assets--
print-to-brother.pySend PNG labels to Brother PT-D610BT printer--

Asset Export

ScriptDescriptionDocs
export_location.pyExport assets by location to PDF, HTML, or CSV--

Testing

ScriptDescriptionDocs
test-label-e2e.pyEnd-to-end validation of label pipeline--

Label-Service API

The label-service runs as a Docker container (ra_labels) on port 8100. It manages label lifecycle (draft, active, voided, retired) and generates QR codes, barcodes, and print-ready PNGs.

Key Endpoints

EndpointMethodDescription
/healthGETService health check
/api/v1/labelsPOSTCreate a new label (draft state)
/api/v1/labelsGETList labels with filtering
/api/v1/labels/batchPOSTBatch-create labels
/api/v1/labels/{id}/activatePOSTActivate a draft label
/api/v1/labels/{id}/printGETGenerate print-ready PNG
/api/v1/labels/{id}/qrGETGenerate QR code PNG
/{asset_identifier}GETScan label (redirects to Snipe-IT)

Authenticated endpoints require X-API-Key header.

Prerequisites

  • Python 3.11+ with requests, Pillow, reportlab
  • Docker Desktop (for label-service)
  • SNIPEIT_TOKEN -- Snipe-IT API bearer token
  • LABEL_SERVICE_URL -- Label service base URL (default: http://localhost:8100)
  • LABEL_SERVICE_API_KEY -- Label service API key
  • Brother PT-D610BT with b-PAC SDK v3.4+ (for printing)