PrintNode Scales API

Read weight measurements from USB scales connected to a computer running the PrintNode Client, supporting point-of-sale and shipping use cases alongside printing.

OpenAPI Specification

printnode-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: PrintNode API
  description: >-
    Specification of the PrintNode cloud and remote printing API. PrintNode lets
    web and server applications print to physical printers through the PrintNode
    Client running on a remote computer. All requests use HTTP Basic
    authentication with the API key supplied as the username and an empty
    password.
  termsOfService: https://www.printnode.com/en/terms
  contact:
    name: PrintNode Support
    url: https://www.printnode.com/en/contact
  version: '1.0'
servers:
  - url: https://api.printnode.com
security:
  - apiKeyBasicAuth: []
paths:
  /ping:
    get:
      operationId: ping
      tags:
        - Utility
      summary: Health check endpoint that confirms the API is reachable.
      responses:
        '200':
          description: OK
  /noop:
    get:
      operationId: noop
      tags:
        - Utility
      summary: No-operation endpoint useful for testing authentication.
      responses:
        '200':
          description: OK
  /whoami:
    get:
      operationId: whoAmI
      tags:
        - Account
      summary: Returns the Account object for the currently authenticated account.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Account'
  /account:
    post:
      operationId: createAccount
      tags:
        - Account
      summary: Create a child account (Integrator accounts only).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAccountRequest'
      responses:
        '201':
          description: Created
    patch:
      operationId: modifyAccount
      tags:
        - Account
      summary: Modify the authenticated or controlled account.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '200':
          description: OK
    delete:
      operationId: deleteAccount
      tags:
        - Account
      summary: Delete the controlled child account.
      responses:
        '200':
          description: OK
  /account/controllable:
    get:
      operationId: getControllableAccounts
      tags:
        - Account
      summary: List the child accounts this Integrator account can control.
      responses:
        '200':
          description: OK
  /account/tag/{name}:
    get:
      operationId: getAccountTag
      tags:
        - Account
      summary: View a named tag stored against the account.
      parameters:
        - $ref: '#/components/parameters/TagName'
      responses:
        '200':
          description: OK
    post:
      operationId: setAccountTag
      tags:
        - Account
      summary: Create or update a named tag stored against the account.
      parameters:
        - $ref: '#/components/parameters/TagName'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: string
      responses:
        '200':
          description: OK
    delete:
      operationId: deleteAccountTag
      tags:
        - Account
      summary: Delete a named tag stored against the account.
      parameters:
        - $ref: '#/components/parameters/TagName'
      responses:
        '200':
          description: OK
  /account/apikey/{description}:
    get:
      operationId: getApiKey
      tags:
        - API Keys
      summary: View an API key by its description (Integrator accounts only).
      parameters:
        - $ref: '#/components/parameters/ApiKeyDescription'
      responses:
        '200':
          description: OK
    post:
      operationId: createApiKey
      tags:
        - API Keys
      summary: Create an API key with the given description.
      parameters:
        - $ref: '#/components/parameters/ApiKeyDescription'
      responses:
        '200':
          description: OK
    delete:
      operationId: deleteApiKey
      tags:
        - API Keys
      summary: Delete the API key with the given description.
      parameters:
        - $ref: '#/components/parameters/ApiKeyDescription'
      responses:
        '200':
          description: OK
  /computers:
    get:
      operationId: getComputers
      tags:
        - Computers
      summary: List all computers connected to the account.
      parameters:
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/After'
        - $ref: '#/components/parameters/Dir'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Computer'
  /computers/{computerSet}:
    get:
      operationId: getComputerSet
      tags:
        - Computers
      summary: Return the computers matching the supplied computer set.
      parameters:
        - $ref: '#/components/parameters/ComputerSet'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Computer'
  /printers:
    get:
      operationId: getPrinters
      tags:
        - Printers
      summary: List all printers attached to the account.
      parameters:
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/After'
        - $ref: '#/components/parameters/Dir'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Printer'
  /printers/{printerSet}:
    get:
      operationId: getPrinterSet
      tags:
        - Printers
      summary: Return the printers matching the supplied printer set.
      parameters:
        - $ref: '#/components/parameters/PrinterSet'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Printer'
  /computers/{computerSet}/printers:
    get:
      operationId: getPrintersByComputer
      tags:
        - Printers
      summary: List printers attached to the given set of computers.
      parameters:
        - $ref: '#/components/parameters/ComputerSet'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Printer'
  /printjobs:
    get:
      operationId: getPrintJobs
      tags:
        - PrintJobs
      summary: List print jobs associated with the account.
      parameters:
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/After'
        - $ref: '#/components/parameters/Dir'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PrintJob'
    post:
      operationId: createPrintJob
      tags:
        - PrintJobs
      summary: Submit a print job to a printer.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePrintJobRequest'
      responses:
        '201':
          description: Created. Returns the new print job id.
          content:
            application/json:
              schema:
                type: integer
  /printjobs/{printJobSet}:
    get:
      operationId: getPrintJobSet
      tags:
        - PrintJobs
      summary: Return the print jobs matching the supplied print job set.
      parameters:
        - $ref: '#/components/parameters/PrintJobSet'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PrintJob'
  /printjobs/states:
    get:
      operationId: getPrintJobStates
      tags:
        - PrintJobs
      summary: Return the state change history for print jobs on the account.
      responses:
        '200':
          description: OK
  /printers/{printerSet}/printjobs:
    get:
      operationId: getPrintJobsByPrinter
      tags:
        - PrintJobs
      summary: List the print jobs sent to the given set of printers.
      parameters:
        - $ref: '#/components/parameters/PrinterSet'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PrintJob'
  /computer/{computerId}/scales:
    get:
      operationId: getScales
      tags:
        - Scales
      summary: List the scales connected to the given computer.
      parameters:
        - $ref: '#/components/parameters/ComputerId'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Scale'
  /computer/{computerId}/scales/{deviceName}:
    get:
      operationId: getScalesByDeviceName
      tags:
        - Scales
      summary: List scale measurements for a named device on a computer.
      parameters:
        - $ref: '#/components/parameters/ComputerId'
        - $ref: '#/components/parameters/DeviceName'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Scale'
  /computer/{computerId}/scale/{deviceName}/{deviceNumber}:
    get:
      operationId: getScale
      tags:
        - Scales
      summary: Return a single scale measurement for a named device and number.
      parameters:
        - $ref: '#/components/parameters/ComputerId'
        - $ref: '#/components/parameters/DeviceName'
        - $ref: '#/components/parameters/DeviceNumber'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Scale'
  /webhook:
    get:
      operationId: getWebhooks
      tags:
        - Webhooks
      summary: View the webhooks registered on the account.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Webhook'
    post:
      operationId: createWebhook
      tags:
        - Webhooks
      summary: Register a new webhook on the account.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Webhook'
      responses:
        '201':
          description: Created
    patch:
      operationId: modifyWebhook
      tags:
        - Webhooks
      summary: Modify an existing webhook.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Webhook'
      responses:
        '200':
          description: OK
    delete:
      operationId: deleteWebhook
      tags:
        - Webhooks
      summary: Delete a webhook from the account.
      responses:
        '200':
          description: OK
  /download/clients:
    get:
      operationId: getClientDownloads
      tags:
        - Clients
      summary: List the available PrintNode Client download versions.
      responses:
        '200':
          description: OK
components:
  securitySchemes:
    apiKeyBasicAuth:
      type: http
      scheme: basic
      description: >-
        HTTP Basic authentication. Supply the PrintNode API key as the username
        and leave the password empty. Integrator accounts may additionally
        authenticate on behalf of a child account using the X-Child-Account-By-Id,
        X-Child-Account-By-Email, or X-Child-Account-By-CreatorRef header.
  parameters:
    Limit:
      name: limit
      in: query
      description: Maximum number of rows returned. Default is 100.
      required: false
      schema:
        type: integer
        default: 100
    After:
      name: after
      in: query
      description: Return records whose id is after this value, for pagination.
      required: false
      schema:
        type: integer
    Dir:
      name: dir
      in: query
      description: Ordering of returned records, asc or desc. Default is desc.
      required: false
      schema:
        type: string
        enum:
          - asc
          - desc
        default: desc
    ComputerSet:
      name: computerSet
      in: path
      description: A set of computer ids, e.g. 123 or 123,456 or a range 100-200.
      required: true
      schema:
        type: string
    PrinterSet:
      name: printerSet
      in: path
      description: A set of printer ids, e.g. 123 or 123,456 or a range 100-200.
      required: true
      schema:
        type: string
    PrintJobSet:
      name: printJobSet
      in: path
      description: A set of print job ids, e.g. 123 or 123,456 or a range 100-200.
      required: true
      schema:
        type: string
    ComputerId:
      name: computerId
      in: path
      description: The id of a single computer.
      required: true
      schema:
        type: integer
    DeviceName:
      name: deviceName
      in: path
      description: The device name of a connected scale.
      required: true
      schema:
        type: string
    DeviceNumber:
      name: deviceNumber
      in: path
      description: The device number of a connected scale.
      required: true
      schema:
        type: integer
    TagName:
      name: name
      in: path
      description: The name of the account tag.
      required: true
      schema:
        type: string
    ApiKeyDescription:
      name: description
      in: path
      description: The description identifying the API key.
      required: true
      schema:
        type: string
  schemas:
    Account:
      type: object
      properties:
        id:
          type: integer
          description: Unique account identifier.
        firstname:
          type: string
        lastname:
          type: string
        email:
          type: string
        canCreateSubAccounts:
          type: boolean
        creatorEmail:
          type: string
          nullable: true
        creatorRef:
          type: string
          nullable: true
        credits:
          type: integer
          nullable: true
        numComputers:
          type: integer
        totalPrints:
          type: integer
        versions:
          type: array
          items:
            type: string
        connected:
          type: array
          items:
            type: integer
        permissions:
          type: array
          items:
            type: string
    Computer:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        inet:
          type: string
          nullable: true
        inet6:
          type: string
          nullable: true
        hostname:
          type: string
          nullable: true
        version:
          type: string
          nullable: true
        jre:
          type: string
          nullable: true
        createTimestamp:
          type: string
          format: date-time
        state:
          type: string
          description: Connection state, e.g. connected or disconnected.
    Printer:
      type: object
      properties:
        id:
          type: integer
        computer:
          $ref: '#/components/schemas/Computer'
        name:
          type: string
        description:
          type: string
        capabilities:
          type: object
          nullable: true
        default:
          type: boolean
        createTimestamp:
          type: string
          format: date-time
        state:
          type: string
          description: Printer state, e.g. online, offline or deleted.
    PrintJob:
      type: object
      properties:
        id:
          type: integer
        printer:
          $ref: '#/components/schemas/Printer'
        title:
          type: string
        contentType:
          type: string
        source:
          type: string
        expireAt:
          type: string
          format: date-time
          nullable: true
        createTimestamp:
          type: string
          format: date-time
        state:
          type: string
    CreatePrintJobRequest:
      type: object
      required:
        - printerId
        - contentType
        - content
      properties:
        printerId:
          type: integer
          description: The id of the target printer.
        title:
          type: string
          description: Title displayed in the print queue.
        contentType:
          type: string
          description: The content encoding of the job.
          enum:
            - pdf_uri
            - pdf_base64
            - raw_uri
            - raw_base64
        content:
          type: string
          description: A URI or base64-encoded payload depending on contentType.
        source:
          type: string
          description: Free-text description of the job origin.
        options:
          type: object
          description: Printer options such as copies, dpi, paper, fit_to_page.
        expireAfter:
          type: integer
          description: Retention period in seconds. Default 1209600.
        qty:
          type: integer
          description: Number of times to deliver the job. Default 1.
        authentication:
          type: object
          description: Optional HTTP credentials for fetching a content URI.
    CreateAccountRequest:
      type: object
      properties:
        Account:
          type: object
          properties:
            firstname:
              type: string
            lastname:
              type: string
            email:
              type: string
            password:
              type: string
            creatorRef:
              type: string
        ApiKeys:
          type: array
          items:
            type: string
        Tags:
          type: object
    Scale:
      type: object
      properties:
        mass:
          type: array
          items:
            type: integer
            nullable: true
          description: Measured mass as [grams, micrograms].
        deviceName:
          type: string
        deviceNum:
          type: integer
        computerId:
          type: integer
        vendor:
          type: string
          nullable: true
        product:
          type: string
          nullable: true
        count:
          type: integer
        measurement:
          type: object
          nullable: true
        clientReportedCreateTimestamp:
          type: string
          format: date-time
        ntpOffset:
          type: integer
          nullable: true
        ageOfData:
          type: integer
          nullable: true
    Webhook:
      type: object
      properties:
        id:
          type: integer
        url:
          type: string
          description: The HTTPS endpoint that receives event notifications.
        enabled:
          type: boolean