# Print Document

It contains information about a label or a document, e.g., a shipping label, a customs form, manifest report etc., that pertains to a shipment or manifest.

Endpoint: POST /api/v1/document/print
Version: 1.0.0
Security: bearerAuth

## Header parameters:

  - `X-PB-Developer-Partner-Id` (string)
    The Developer Partner ID is assigned by PB to uniquely identify a Developer's strategic business partners. If the developer is the sole business partner, this field isn't required.

  - `X-PB-LocationId` (string)
    The X-PB-LocationId header identifies the enterprise, developer, or partner location under which a shipment is processed and billed.
If the header is not provided, the system defaults to the enterprise-level location that was created during developer account onboarding. This default location is automatically used for shipment processing and billing. <br/>

**Requirement Rules**

- The `X-PB-LocationId` header is optional when the shipment origin country code matches the enterprise's default address country code.
- The `X-PB-LocationId` header is required when the shipment origin country code differs from the enterprise's default address country code.
- If the header is required but not provided, the API will return a validation error *"invalid origin countryCode"*.

  - `X-PB-TransactionId` (string)
    A unique Transaction ID provided by the partner, which is used to enable debugging and linking between the client's transaction and the system.

## Request fields (application/json):

  - `printerAliasName` (string, required)
    Name of the Printer connected (directly or via network) to a Computer. `Max length = 30`
    Example: Pitney Bowes Printer

  - `data` (string, required)
    Content/Identifier of document e.g., DOCUMENT_REFERECE_ID. Actual document name e.g., abc.pdf. [IN] i.e base64 string, URL, file path
    Example: <<base64string>>

  - `dataType` (string, required)
    Data Type of the document e.g., DOCUMENT_REFERENCE. [IN/OUT]
    Enum: "BASE64", "URL"

  - `documentType` (string, required)
    The format of the document file the print takes.
    Enum: "ZPL2", "ZPL", "PDF"

  - `formName` (string, required)
    The name of the Document Form.
    Enum: "8x11", "4x6", "2x1", "ENV10", "ENV9", "A1"

  - `orientation` (string)
    The orientation of the document layout: Portrait or Landscape.
    Example: PORTRAIT

  - `reference` (object)
    - Contains key value map for passing references. Max references allowed is 6.  - References are tags or information that is printed on Shipping Label based on the customer's requirement. - Reference Fields can have values/indication like department name, invoice no., package description, purchase order no., carrier note, cost account no., transportation no., or PO No., etc.  - Each of the reference field can have only one indication/value.

  - `reference.reference1` (string)
    Reference 1 can have one of the above-indicated values/information, which is printed on Label, e.g., Cost Account No. (if any) or Invoice Number.  `Max length = 30`.
    Example: 123456

  - `reference.reference2` (string)
    Reference 2 can have other details as indicated in the list above. This is also printed on Label, e.g., Package Description .  `Max length = 30`.
    Example: SendTech

  - `reference.reference3` (string)
    Reference 3 can have the information which were not fulfilled in Ref1 and Ref2, e.g., Order No. or Purchase Order ID.  `Max length = 30`.
    Example: 65439

  - `reference.reference4` (string)
    Reference 4 can have more information which were not provided in Ref1, Ref2, or Ref3 e.g., Carrier Note.  `Max length = 30`.
    Example: FedEx First Overnight

## Response 200 fields (application/json):

  - `jobId` (string)
    Job ID of the printed document.
    Example: accc

## Response 400 fields (application/json):

  - `errorCode` (string)
    Error code(s) that appear due to HTTP  400- Invalid or Bad Request, e.g., validation-error.
    Example: validation_error

  - `errorDescription` (string)
    The HTTP 400 Bad Request response status code indicates that the server cannot process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
    Example: string

  - `additionalCode` (string)
    A unique identifier for the error, for example 1101055, 0100008, or 1021126.

  - `additionalInfo` (string)
    This is an additional information about the error. This error 'Invalid Request' might appear due to invalid dimension, weight, or serviceID, or if the information is missing.

  - `additionalParameters` (array)

## Response 401 fields (application/json):

  - `message` (string, required)
    This is HTTP 401 Unauthorized response status code, which indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource.

## Response 500 fields (application/json):

  - `message` (string, required)
    This is HTTP 500 Internal Server Error response status code, which indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

