# Create Manifest

This operation creates an end-of-day manifest (a compilation of information about all shipments) that combines all shipments of the day into a single form or electronic record, depending on the carrier. For USPS®, this manifest is called a SCAN form (Shipment Confirmation Acceptance Notice), which combines all trackable shipments into a single form with a single barcode. When the carrier scans the barcode, all shipments for that barcode receive an Acceptance event from USPS. If the SCAN form includes shipments from multiple different induction postal codes, this operation generates a multi-page form with one bar code per page.
Key Considerations: 
  - Only shipments with the addToManifest shipment option set to true are eligible for inclusion in the manifest or SCAN form.
  - Shipments can be added to the SCAN form by specifying the carrierAccountId.
  - To generate a SCAN form for the current day, the Create Manifest request must be issued before 8 p.m. local time. Requests made after 8 p.m. require the next day's date to be specified in the submissionDate field.
  - Any eligible shipment not included in a SCAN form by 6 a.m. UTC/GMT the following calendar day will be automatically manifested.
  - Shipments, once manifested, cannot be re-manifested.
  - To prevent a shipment from being auto-manifested, specify the shipment's dateOfShipment option during creation.
  - A single Create Manifest request can include up to 7,000 shipments.
  - USPS SCAN forms retrieved through URLs are available for 24 hours after creation.

Endpoint: POST /api/v1/manifests
Version: 1.0.0
Security: bearerAuth

## Header parameters:

  - `X-PB-Developer-Partner-ID` (string)
    This is the Developer Partner ID. When the developer is the only partner, this field is not required.

  - `X-PB-LocationId` (string)
    The X-PB-LocationId header identifies the enterprise, division, or partner location under which a shipment is processed and billed.
If this header is not provided, the system automatically uses the enterprise-level location that was created during developer account onboarding. This default location is then used for shipment processing, carrier selection, and billing.

Selection Rules

------------------------
- If X-PB-LocationId is provided and the location has one carrier with one account:
  - carrier is optional
  - carrierAccountId is optional
  - The available carrier account is selected and the manifest is created.

- If X-PB-LocationId is not provided and the default location has one carrier with one account:
  - carrier is optional
  - carrierAccountId is optional
  - The available carrier account is selected and the manifest is created.
------------------------
- If X-PB-LocationId is provided and the location has one carrier with multiple accounts:
  - carrier is optional
  - carrierAccountId is required
  - The specified carrierAccountId is selected and the manifest is created.

- If X-PB-LocationId is not provided and the default location has one carrier with multiple accounts:
  - carrier is optional
  - carrierAccountId is required
  - The specified carrierAccountId is selected and the manifest is created.
---------------------------
- If X-PB-LocationId is provided and the location has multiple carriers with one account each:
  - carrier is required
  - carrierAccountId is optional
  - The specified carrier and its associated account are selected and the manifest is created.

- If X-PB-LocationId is not provided and the default location has multiple carriers with one account each:
  - carrier is required
  - carrierAccountId is optional
  - The specified carrier and its associated account are selected and the manifest is created.
----------------------------
- If X-PB-LocationId is provided and the location has multiple carriers with multiple accounts:
  - carrier is optional
  - carrierAccountId is required
  - The specified carrierAccountId is selected and the manifest is created.

- If X-PB-LocationId is not provided and the default location has multiple carriers with multiple accounts:
  - carrier is optional
  - carrierAccountId is required
  - The specified carrierAccountId is selected and the manifest is created.
-----------------------------

  - `compactResponse` (boolean)
    This header defines if the response required is detailed or compact. When value is set to true, it will only return manifest details in response.
    Example: "false"

## Request fields (application/json):

  - `carrier` (string)
    Name of the carrier for the manifest.
When to provide

- Required if multiple carriers are configured for the resolved location.
- Optional if only one carrier exists.
    Example: "USPS"

  - `carrierAccountId` (string, required)
    Unique identifier of the carrier account used for manifest processing.

When to provide

- Required if multiple accounts exist for the selected carrier.
- Optional if only one account exists

  - `fromAddress` (object, required)
    The complete address of the Sender.
The fromAddress is selected using the following order of precedence:

Request Body → Location ID

- fromAddress provided in the request payload is used if available.
- If not provided in the request, the fromAddress associated with the resolved location is used.
- If fromAddress cannot be resolved from any source, the request fails with a validation error.
Note: fromAddress is required.

  - `fromAddress.name` (string)
    Name of the sender to which this address points.
    Example: "Paul Wright"

  - `fromAddress.addressLine1` (string, required)
    The addressLine1 can contain the Flat number, Building or Apartment Name/number (if any) or company name (if not residential).
    Example: "27 Watervw Dr"

  - `fromAddress.addressLine2` (string)
    The addressLine2 contains Street address or Landmark (if any).
    Example: "near abc street"

  - `fromAddress.addressLine3` (string)
    The addressLine3 contains P.O.Box (if any) near the address.
    Example: "near xyz street"

  - `fromAddress.cityTown` (string)
    The name of the city or town to where the address belongs.
    Example: "Stamford"

  - `fromAddress.company` (string)
    The name of the company, in case if the sender address is not residential.  Max length = 30.
    Example: "PB"

  - `fromAddress.email` (string)
    This must be sender's valid email. Email is required if the customer is using GoFor Carrier.  Max length = 30
    Example: "testuser@gmail.com"

  - `fromAddress.phone` (string)
    This is sender's phone number. Enter the digits with or without spaces or hyphens. The maximum limit of characters for Phone number are 10 digits.
    Example: "203-555-1213"

  - `fromAddress.countryCode` (string, required)
    This indicates the two-character ISO code of the source country from the ISO country list.
    Example: "US"

  - `fromAddress.postalCode` (string, required)
    The postal code or ZIP code of the address. For US addresses, use either the 5-digit or 9-digit ZIP code in one of the following formats: '12345' or '12345-6789'. If you use a different format, such as 12345- or 123451234, will receive an error.
    Example: 6905

  - `fromAddress.residential` (boolean)
    The specified adress can be Residential or Official. In case if the adress is Residential, the boolean value will be 'true', else it will take 'false'.

  - `fromAddress.stateProvince` (string)
    The State or Province of the address. For a US or Canadian address, it is the 2-letter state or province code.
    Example: "CT"

  - `submissionDate` (string)
    The date the shipments are to be tendered to the carrier, entered as YYYY-MM-DD.
    Example: "2023-05-25"

  - `parcelTrackingNumbers` (array)
    List of parcel tracking numbers used to generate manifest form for selected shipments. This option is subject to carriers supported individual parcel tracking number.
    Example: ["9405509105156006650803","9405509105156006650810"]

  - `options` (object)
    Additional manifest options.

  - `options.shipperID` (string)
    Unique identifier assigned to the shipper by the carrier. This option is subject to carrier-supported shipper identifiers. Currently, the shipper identifier is supported only by USPS.
    Example: "2000094635"

## Response 200 fields (application/json):

  - `body` (ManifestDetailedResponse (object) or ManifestCompactResponse (object)) — one of:
    - ManifestDetailedResponse:
      - `carrierAccountId` (string)
        A unique identifier associated with the Carrier account which is used while creating Manifest.
        Example: "JORx6bVG8mr"
      - `carrierName` (string)
        Name of the Carrier.
        Example: "USPS"
      - `manifestDocuments` (array)
        The electronically generated document that has manifest (end-of-day) records of all shipments of the day.
        Example: [{"contentType":"URL","contents":"https://example.com/manifest.pdf","type":"MANIFEST"}]
      - `manifestDocuments.contentType` (string)
        Determines whether the API returns the document as a URL or a Base64-encoded string. This field is required for PB Expedited (USPS), PB Standard, PB Presort, and PMOD. For PMOD, this field is optional if fileFormat is set to PDF.  For the valid values for your API operation, see the Labels section of the carrier’s reference page. The field’s possible values are: - URL: The response returns a link to the label or manifest. - BASE64: Available for shipping labels only (both delivery and return labels). The response returns the shipping label as one or more Base64-encoded strings. If you use an APAC URL, the field instead returns raw ZPL, as described in Label Settings for APAC Services.
        Example: "URL"
      - `manifestDocuments.contents` (string)
        When contentType is URL, this is the URL to access the label or manifest. Note: The document is available for 24 hours after it is created.
        Example: "https://example.com/manifest.pdf"
      - `manifestDocuments.type` (string)
        Specifies the type of manifest.
        Example: "MANIFEST"
      - `manifestID` (string)
        The unique manifest ID. This field is not returned for APAC Services.
        Example: "9475709898644001806609"
      - `manifestTrackingNumber` (string)
        The manifest tracking number. This is returned only if the carrier has a pre-defined valid value, e.g., UPS, FedEX, or USPS.
        Example: "9475709898644001806609"
      - `fromAddress` (object)
      - `fromAddress.name` (string)
        Name of the sender to which this address points.
        Example: "Paul Wright"
      - `fromAddress.addressLine1` (string)
        The addressLine1 can contain the Flat number, Building or Apartment Name/number (if any) or company name (if not residential).
        Example: "27 Watervw Dr"
      - `fromAddress.addressLine2` (string)
        The addressLine2 contains Street address or Landmark (if any).
        Example: "near abc street"
      - `fromAddress.addressLine3` (string)
        The addressLine3 contains P.O.Box (if any) near the address.
        Example: "near xyz street"
      - `fromAddress.cityTown` (string)
        The name of the city or town to where the address belongs.
        Example: "Stamford"
      - `fromAddress.company` (string)
        The name of the company, in case if the sender address is not residential.  Max length = 30.
        Example: "PB"
      - `fromAddress.email` (string)
        This must be sender's valid email. Email is required if the customer is using GoFor Carrier.  Max length = 30
        Example: "testuser@gmail.com"
      - `fromAddress.phone` (string)
        This is sender's phone number. Enter the digits with or without spaces or hyphens. The maximum limit of characters for Phone number are 10 digits.
        Example: "203-555-1213"
      - `fromAddress.countryCode` (string)
        This indicates the two-character ISO code of the source country from the ISO country list.
        Example: "US"
      - `fromAddress.postalCode` (string)
        The postal code or ZIP code of the address. For US addresses, use either the 5-digit or 9-digit ZIP code in one of the following formats: '12345' or '12345-6789'. If you use a different format, such as 12345- or 123451234, will receive an error.
        Example: 6905
      - `fromAddress.residential` (boolean)
        The specified adress can be Residential or Official. In case if the adress is Residential, the boolean value will be 'true', else it will take 'false'.
      - `fromAddress.stateProvince` (string)
        The State or Province of the address. For a US or Canadian address, it is the 2-letter state or province code.
        Example: "CT"
      - `parcelTrackingNumbers` (array)
        List of parcel tracking numbers used to generate the 3877 manifest for selected shipments.
        Example: ["9405509105156006650803","9405509105156006650810"]
      - `options` (object)
        Additional manifest options.
      - `options.shipperID` (string)
        Unique identifier assigned to the shipper by the carrier. This option is subject to carrier-supported shipper identifiers. Currently, the shipper identifier is supported only by USPS.
        Example: "2000094635"
      - `submissionDate` (string)
        The date the shipments are to be tendered to the carrier, entered as YYYY-MM-DD.
        Example: "2023-05-25"
    - ManifestCompactResponse:
      - `manifestDocuments` (array)
        Example: [{"contentType":"URL","contents":"https://example.com/manifest.pdf","type":"MANIFEST"}]
      - `manifestDocuments.contentType` (string)
        The media type of the request entity.
        Example: "URL"
      - `manifestDocuments.contents` (string)
        The defines the contents, e.g. URL.
        Example: "https://example.com/manifest.pdf"
      - `manifestDocuments.type` (string)
        The defines the type of contents, e.g. Manifest.
        Example: "MANIFEST"
      - `manifestID` (string)
        Example: "9475709898644001806609"
      - `manifestTrackingNumber` (string)
        Example: "9475709898644001806609"

## 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: "Error while geting rates for carrier with carrierAccount eRMnRx4mzPP."

  - `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, that indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource.


## Response 500 fields
