1. Cloud Printing
  2. Print Stations

Cloud Printing

Print Stations

Print stations represent computers or devices running the PackageX Print Station application. Each station can manage multiple physical printers and receive print jobs via push notifications.

Endpoints

Method Endpoint Description
GET /v1/cloud-printing/stations List all print stations
POST /v1/cloud-printing/stations Create a new print station
GET /v1/cloud-printing/stations/:station_id Retrieve a print station
POST /v1/cloud-printing/stations/:station_id Update a print station
DELETE /v1/cloud-printing/stations/:station_id Remove a print station

Required Scopes

  • print_stations:read - For listing and retrieving stations
  • print_stations:write - For creating, updating and removing stations (including removing printers through an update)

Create Print Station

        POST /v1/cloud-printing/stations

      

Creates a new print station with one or more printers.

Request Body

        {
  "name": "Station-001",
  "display_name": "Front Desk Printer",
  "location_id": "loc_abc123",
  "device_token": "pushy_device_token_here",
  "status": "online",
  "allow_all_users": true,
  "configuration": {
    "pooling_enabled": false
  },
  "printers": [
    {
      "name": "HP LaserJet Pro",
      "model": "HP LaserJet Pro M404dn",
      "status": "online",
      "configuration": {
        "dpi": "600",
        "speed": "40",
        "color_print": false,
        "double_sided": true,
        "spooling": true,
        "port": 9100,
        "priority": 1,
        "type": "laser"
      },
      "page_size": {
        "letter": true,
        "legal": true,
        "a4": true
      }
    }
  ]
}

      

Parameters

Parameter Type Required Description
name string ✓ Unique station name (max 191 chars)
display_name string ✓ Display name (max 191 chars)
location_id string ✓ Location where station is installed
device_token string ✓ Pushy device token for push notifications
status string online (default) or offline
allow_all_users boolean Allow all location users (default: true)
configuration object Station configuration
printers array ✓ Array of printer objects

Printer Parameters

Parameter Type Required Description
name string ✓ Unique printer name within station
model string ✓ Printer model name
configuration object ✓ Printer configuration
page_size object ✓ Supported paper sizes
status string online, offline, busy, error

Response

        {
  "data": {
    "object": "print_station",
    "id": "prnt_stn_abc123",
    "name": "Station-001",
    "display_name": "Front Desk Printer",
    "location_id": "loc_abc123",
    "status": "online",
    "printers": [...],
    "created_at": "2024-01-15T10:30:00.000Z",
    "updated_at": "2024-01-15T10:30:00.000Z"
  },
  "status": 201,
  "message": "Print station created"
}

      

Update Print Station

        POST /v1/cloud-printing/stations/:station_id

      

Updates an existing print station. All fields are optional.

Request Body

        {
  "display_name": "Updated Display Name",
  "status": "offline",
  "device_token": "new_pushy_token",
  "printers": [...]
}

      

Important: When updating printers, provide the complete list. Printers not included in the request will be soft-deleted, and any queued jobs for those printers will be aborted with the reason "Printer Removed". See Remove Printer.

Managing Allowed Users

You can control which users have access to the station:

        // Add users to allowed list
{
  "allow_all_users": false,
  "allowed_users": {
    "add": ["prf_user1", "prf_user2"]
  }
}

// Remove users from allowed list
{
  "allowed_users": {
    "remove": ["prf_user1"]
  }
}

// Replace entire allowed list
{
  "allowed_users": {
    "set": ["prf_user3", "prf_user4"]
  }
}

// Allow all users (clears allowed list)
{
  "allow_all_users": true
}

      

List Print Stations

        GET /v1/cloud-printing/stations

      

Returns a paginated list of print stations.

Query Parameters

Parameter Type Description
page integer Page number (default: 1)
limit integer Results per page (default: 20, max: 100)
order_by string Sort field: created_at, updated_at, name
direction string Sort direction: asc, desc
location_id string Filter by location ID
name string Filter by station name
display_name string Filter by station display name
status string Filter by status: online, offline
page_size string Filter stations by supported paper size (e.g., page_size_a4, page_size_letter). Returns stations that have at least one printer supporting the given page size.
include_print_jobs_count boolean Include count of print jobs
created_at[gte] string Filter by creation date (greater than or equal)
created_at[lte] string Filter by creation date (less than or equal)
updated_at[gte] string Filter by update date
updated_at[lte] string Filter by update date

Example Request

        curl -H "PX-API-KEY: your_api_key" \
     "https://api.packagex.io/v1/cloud-printing/stations?location_id=loc_abc123&status=online"

      

Response

        {
  "data": [
    {
      "object": "print_station",
      "id": "prnt_stn_abc123",
      "name": "Station-001",
      "display_name": "Front Desk Printer",
      "status": "online",
      "printers": [...],
      ...
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "has_more": false
  },
  "message": "1 print station retrieved"
}

      

Retrieve Print Station

        GET /v1/cloud-printing/stations/:station_id

      

Retrieves a single print station by ID.

Example Request

        curl -H "PX-API-KEY: your_api_key" \
     "https://api.packagex.io/v1/cloud-printing/stations/prnt_stn_abc123"

      

Response

        {
  "data": {
    "object": "print_station",
    "id": "prnt_stn_abc123",
    "name": "Station-001",
    "display_name": "Front Desk Printer",
    "location_id": "loc_abc123",
    "location": {
      "id": "loc_abc123",
      "name": "Main Warehouse",
      "code": "MW001"
    },
    "status": "online",
    "allow_all_users": true,
    "device_token": "pushy_token",
    "configuration": {
      "pooling_enabled": false
    },
    "printers": [
      {
        "id": "019b1234-5678-...",
        "name": "HP LaserJet Pro",
        "model": "HP LaserJet Pro M404dn",
        "status": "online",
        "configuration": {...},
        "page_size": {...}
      }
    ],
    "allowed_users": [],
    "created_at": "2024-01-15T10:30:00.000Z",
    "updated_at": "2024-01-15T10:30:00.000Z"
  },
  "message": "Print station retrieved"
}

      

Remove Print Station

        DELETE /v1/cloud-printing/stations/:station_id

      

Removes a print station along with all of its printers.

Example Request

js
        const response = await fetch("https://api.packagex.io/v1/cloud-printing/stations/prnt_stn_abc123", {
  method: "DELETE",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
}).then((res) => res.json());

      

Response

        {
  "data": {
    "success": true,
    "id": "prnt_stn_abc123"
  },
  "message": "Print station removed"
}

      

What Happens on Removal

  • Station and printers are soft deleted. The station no longer appears in List Print Stations, and Retrieve Print Station, Update Print Station and a second delete all return 404 for its ID. A print job that names the removed station in print_station_id also returns 404, and the station is never picked when a job is auto-assigned.
  • The station's names are freed. The removed station is renamed so a new station at the same location can reuse its name and display_name. Each name is cut to its first 160 characters and a short suffix taken from the station ID is appended: name becomes <name>__removed_<suffix> and display_name becomes <display_name> (removed <suffix>). Historical print jobs show the renamed display name.
  • In-flight jobs are aborted. Jobs on the station that are still queued or processing are set to aborted with the reason "Station Removed". A later status report for one of these jobs (for example, the station reporting completed) is rejected with 400 and code print_job.invalid_state. Jobs that already reached a final status are not changed, and unreported jobs are also left unchanged and can still be updated after the station is removed.
  • Job history is kept. Existing print jobs remain available through the print jobs endpoints.
  • Access and push settings are cleared. The station's allowed users list and push device_token are removed, and its status becomes disconnected.
INFO

The bulk abort does not emit a separate event for each aborted print job. The removal itself is emitted as the cloud_printing.station.updated event (there is no separate station deleted event); the event's station carries the renamed name and display_name and status: "disconnected".

WARNING

The PackageX Print Bridge app signs in with your organization's API key, so if it is still running on the station's computer it will sync the machine back as a new station with a new ID. After removing a station, change the API key used by the app on that computer (or uninstall the app).


Remove Printer

There is no separate endpoint for removing a printer. Remove one by updating the station with its printers list minus that printer: printers is treated as the complete set, so any printer left out is removed.

Example Request

js
        const station = await fetch("https://api.packagex.io/v1/cloud-printing/stations/prnt_stn_abc123", {
  headers: { "PX-API-KEY": process.env.PX_API_KEY },
}).then((res) => res.json());

// Re-read the station first so the remaining printers are sent with their latest saved values
const printers = station.data.printers.filter((printer) => printer.name !== "HP LaserJet Pro");

const response = await fetch("https://api.packagex.io/v1/cloud-printing/stations/prnt_stn_abc123", {
  method: "POST",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ printers }),
}).then((res) => res.json());

      

The response is the updated station, without the removed printer.

What Happens on Removal

  • The printer is soft deleted and no longer appears in the station's printers list.
  • Jobs on that printer that are still queued are set to aborted with the reason "Printer Removed". Jobs that are processing or unreported are not changed.
  • The printers you send replace the saved ones, so always build the list from a fresh read of the station; a stale list can overwrite newer printer settings or remove a printer added since.
  • The change is emitted as the cloud_printing.station.updated event.
WARNING

If the PackageX Print Bridge app is still running with this printer attached, it may add the printer back the next time it syncs its printers.


Error Codes

Code Status Description
station.exists 400 Station name or display_name already exists at this location
location.cloud_printing_disabled 400 Cloud printing is not enabled at this location
location_access 403 You don't have access to this location
print_job.invalid_state 400 The job is already completed, canceled, or aborted (including jobs aborted by a station or printer removal)
print_station.not_found 404 Print station not found or removed, including a removal that raced the request