Get Transaction Reports¶
HTTP Request¶
GET /v4/ledger/developers/{developerId}/transactions/reports
Previous version: v2
Summary¶
This operation retrieves transactions from the last six months according to the parameters you specify. If you specify no parameters, the API returns all transactions for the last 92 days.
Note: To retrieve transactions that are older than 6 months, use the Get Archived Reports API.
Considerations¶
By default, the API returns transactions for shipments that have the
rates.carrier
field set toUSPS
. To instead return shipments that have therates.carrier
field set toPBCS
, use the carrier query parameter.The report returns the following transaction types within the following time frames:
Transaction Type
Description
The transaction appears in the transaction report:
POSTAGE FUND
The funding of the postage account
Within 1 hour
POSTAGE PRINT
The printing of a label
Within 1 hour for a delivery label
The same day for a return label
POSTAGE REFUND
A request for a refund from USPS®, or the resolution of a refund request
Within 1 hour for a refund request
The same day as notification from USPS for a refund resolution
FEE
An ACH return fee. The
status
field indicates whether the fee is processed or waived.Within 24 hours
APV-POSTAGE OVERPAID
An APV adjustment for an overpayment
Within 24 hours of notification from USPS
APV-POSTAGE UNDERPAID
An APV adjustment for an underpayment
Within 24 hours of notification from USPS
APV-DISPUTE ADJUSTMENT
A dispute of an APV adjustment
Within 24 hours of notification from USPS
CREDIT ADJUSTMENT
A manual credit.
The same day
DEBIT ADJUSTMENT
A manual debit.
The same day
Transactions are returned in UTC/GMT time.
All transactions for a given shipment use the same
transactionId
. Therefore, a given transaction ID can appear multiple times in a report. Each occurrence represents a different transaction for the same shipment.The
transactionId
comprises the developer ID and the shipment’s X-PB-TransactionId, separated by an underscore:<developer_id>_<X-PB-TransactionId>
The date range specified in the query parameters cannot exceed 92 days, unless you specify a
transactionId
orparcelTrackingNumber
, in which case there is no limit on the date range.For additional information, please see the Transaction Reports FAQs.
Request URLs¶
Sandbox: https://shipping-api-sandbox.pitneybowes.com/shippingservices/v4/ledger/developers/{developerId}/transactions/reports
Production: https://shipping-api.pitneybowes.com/shippingservices/v4/ledger/developers/{developerId}/transactions/reports
Path Parameter¶
Name |
Description |
---|---|
developerId |
Required. Your Pitney Bowes developer ID. |
Query Parameters¶
Query parameters are optional.
Name |
Description |
---|---|
carrier |
The carrier for which to return transactions. The parameter takes the following values:
Default Value: |
fromDate |
The beginning of the date range for the returned transactions. Specify this value in UTC using the ISO 8601 standard. The value must include both date and time and must end with fromDate=2019-10-05T00:00:00Z
The date range cannot exceed 92 days, unless you specify a Default Value: 92 days prior to the current date, with these exceptions:
|
merchantId |
Returns all transactions for a specific merchant. Enter the merchant’s Shipper ID. The Shipper ID is found in the |
page |
The index number of the page to return. Page index numbering starts at |
parcelTrackingNumber |
Returns all transactions associated with a specific label. The parameter identifies the label by the shipment’s tracking number. |
printStatus |
The transaction status, as indicated in the transaction report’s
|
referralCode |
Returns transactions for merchants who signed up using a specific referral code. Enter the referral code. |
shipDetails |
Indicates whether to return the following fields for each transaction:
If set to Default Value: 0 This field applies to v4.0 or higher of the API. |
size |
The number of transactions to return per page in the result set. Default Value: 20
|
toDate |
The end of the date range for the returned transactions. Specify this value in UTC using the ISO 8601 standard. The value must include both date and time and must end with toDate=2019-11-02T23:59:00Z
The date range cannot exceed 92 days, unless you specify a Default Value: The current date. |
trackingStatus |
This parameter does both of the following:
The parameter takes the following values:
Note: Transaction Reports record tracking events only for the first 30 days after the parcel’s ship date. Transaction Reports do not record tracking events that occur 30 days or more after the parcel’s ship date. |
transactionId |
Returns all transactions associated with a specific label. The parameter identifies the label by a string that comprises the developer ID and the shipment’s <developer_ID>_<X-PB-TransactionId>
For example: 12345678_ad507ef7414a78ac22b3
|
transactionType |
Returns all transactions of a given transaction type. Valid values:
|
Request Headers¶
Name |
Description |
---|---|
Authorization |
Required. OAuth token generated using the Generate an OAuth Token API. |
Accept-Language |
Language and country code. Default: |
X-PB-UnifiedErrorStructure |
Recommended. Set this to |
Response Elements¶
Name |
Data Type |
Description |
---|---|---|
content |
Array[Transaction Object] |
The transactions. Each object in the array is a separate transaction. The Transaction Object is described in the next table below. Note: Multiple transactions can share the same |
searchCriteria |
Object |
This object returns the developer ID and the query parameters that were used. Note the following:
The following is an example {
"developerId": "12345678",
"merchantId": "9024324564",
"transactionType": "POSTAGE PRINT",
"fromDate": "2021-03-16T18:33:12.358+0000",
"toDate": "2021-04-16T18:33:12.358+0000"
}
|
last |
Boolean |
If true, this is the last page of the result set. |
totalPages |
Number |
Total number of pages in the result set. |
totalElements |
Number |
Total number of transactions in the result set for the specified query filters. |
sort |
Array[Object] |
An object with information about the sort order. |
numberOfElements |
Number |
Number of transactions in the current page. |
first |
Boolean |
If true, this is the first page of the result set. |
size |
Number |
Number of transactions per page in the result set. |
number |
Number |
The index number of the page being returned. Page index numbering starts at 0. If number is set to |
Transaction Object (Transaction Reports API)¶
Name |
Data Type |
Description |
---|---|---|
transactionId |
String |
The ID used to uniquely identify the shipment associated with the transaction. The ID is a combination of the developer ID and the shipment’s <Developer-ID>_<X-PB-TransactionId>
|
transactionDateTime |
String |
The date and time of the transaction, returned in UTC/GMT using the ISO 8601 standard. |
transactionType |
String |
Type of transaction. Valid values:
|
developerName |
String |
Name of the developer account used to print the shipment label. |
developerId |
String |
The developer ID used to print the shipment label. |
developerPostagePaymentMethod |
String |
The developer’s PB Postage Account payment method. This applies only to transactions that use the Bulk Postage Account payment model, as described in Merchant Enrollment Models. |
developerRatePlan |
String |
Rate plan of the developer. |
developerRateAmount |
String |
Amount charged to the developer. The amount is based on the developer’s rate plan. If the merchant (shipper) has an NSA, the amount is instead based on the NSA. APV Adjustments: If the transaction is an APV adjustment, this field is the difference between the charge that was calculated at the time of print and the charge calculated by USPS®. |
developerPostagePaymentAccountBalance |
String |
This field is not currently used. |
merchantName |
String |
Name of the merchant. |
merchantId |
String |
The value of the |
merchantPostageAccountPaymentMethod |
String |
The merchant’s PB Postage Account payment method. This applies only to transactions that use the Individual Postage Account payment model, as described in Merchant Enrollment Models. |
merchantRatePlan |
String |
Rate plan of the merchant (shipper). |
merchantRate |
String |
Amount charged to the merchant. This is based on the merchant’s shipper rate plan. APV Adjustments: If the transaction is an APV adjustment, this field is the difference between the charge to the merchant calculated at the time of print and the charge calculated based on information from USPS. |
shipperPostagePaymentAccountBalance |
String |
Postage balance in the merchant’s PB Postage Account. This is the ending balance after this transaction was processed. If the merchant’s postage balance is currently negative, the merchant must refill the postage account. See How do I fill my PB Postage Account with funds? |
labelFee |
String |
Currently not used. |
parcelTrackingNumber |
String |
Tracking number. |
weightInOunces |
String |
Weight in ounces. In the case of an APV adjustment, this is based on the new information received from USPS. |
zone |
String |
Zone. In the case of an APV adjustment this is based on the new information received from USPS. |
packageLengthInInches |
String |
Package length in inches. In the case of an APV adjustment, this is based on the new information received from USPS. |
packageWidthInInches |
String |
Package width in inches. In the case of an APV adjustment, this is based on the new information received from USPS. |
packageHeightInInches |
String |
Package height in inches. In the case of an APV adjustment, this is based on the new information received from USPS. |
packageTypeIndicator |
String |
Indicates whether cubic pricing was used. Valid values:
In the case of an APV adjustment, this is based on the new information received from USPS. |
packageType |
String |
The parcel type. For supported parcel types, see the carrier page for the carrier you are using. In the case of an APV adjustment, this is based on the new information received from USPS. |
mailClass |
String |
Service. |
internationalCountryGroup |
String |
International country group code. |
originationAddress |
String |
Origination address. |
originZip |
String |
Origin postal code. |
destinationAddress |
String |
Destination address. |
destinationZip |
String |
Destination postal code. |
destinationCountry |
String |
Destination country. |
postageDepositAmount |
String |
Postage deposit amount. |
creditCardFee |
String |
Credit card fee. |
refundStatus |
String |
Refund status. Possible values include:
For more information on refunds, see Refunds FAQs. |
refundDenialReason |
String |
The reason for a refund denial. |
printStatus |
String |
For a PB Expedited Returns label, the label’s status. Possible values:
Note: This information also appears in the status field. |
shipmentId |
String |
The unique identifier for the shipment generated when the shipment was created. |
refundRequestor |
String |
Indicates who requested the refund.
|
externalId |
String |
This applies only to the following:
|
adjustmentReason |
String |
This applies only to APV adjustments and gives the reason for the adjustment based on information received from USPS. Possible values are:
|
meterNumber |
String |
Internal identification number for the postage meter that was used. |
dimensionalWeightOz |
BigDecimal |
The dimensional weight, if applicable. To return this field, set the |
valueOfGoods |
BigDecimal |
The value provided in the To return this field, set the |
specialServices |
Array[Special Services Object] |
This array contains the shipment’s special services, including the fee paid for each service. To return this field, set the |
status |
String |
The transaction status for the following types of transactions:
|
description |
String |
Details on the status of an ACH transaction. Possible values:
|
clientFacilityId |
String |
For a PB Standard transaction, this is the ID that was assigned to the merchant’s facility during onboarding with PB Standard. |
carrierFacilityId |
String |
For a PB Standard transaction, this is the ID of the PB Standard facility that was assigned to the merchant during onboarding with PB Standard. |
inductionPostalCode |
BigDecimal |
The postal code where the shipment was tendered to the carrier. To return this field, set the |
tracking |
Object |
For a Note: This object is not returned by the Get Archived Reports API. |
tracking.parcelStatus |
String |
The most recent tracking event within 30 days of the parcel’s ship date. This is the same information returned in the Note: Transaction Reports record tracking status only for the first 30 days after the parcel’s ship date. |
tracking.statusDate |
String |
The local date and time where the tracking event occurred. This is the same information returned in |
customMessage1 |
String |
The message specified in the PRINT_CUSTOM_MESSAGE_1 shipment option in the Create Shipment request. To return this field, set the |
customMessage2 |
String |
The message specified in the PRINT_CUSTOM_MESSAGE_2 shipment option in the Create Shipment request. To return this field, set the |
Sample Requests¶
See the following examples:
Transaction Reports for PB Expedited, Sample Request¶
curl -X GET ".../v4/ledger/developers/12345678/transactions/reports?shipDetails=1" \
-H "Authorization: Bearer <oauth_token>" \
-H "Accept-Language:en-US" \
-H "X-PB-UnifiedErrorStructure: true"
The response below shows three transactions for the same shipment. The response shows the printing of the label, the request for a refund, and the approval of the refund request. For each transaction, the transactionType
field shows the type of transaction.
{
"content": [ {
"transactionId": "12345678_a7-4bc2-a17a-02a37ad84a5d",
"transactionDateTime": "2020-08-01T16:08:04.025+0000",
"transactionType": "POSTAGE PRINT",
"developerName": "PB",
"developerId": "12345678",
"developerPostagePaymentMethod": null,
"developerRatePlan": null,
"developerRateAmount": 3.5,
"developerPostagePaymentAccountBalance": null,
"merchantName": "Smith",
"merchantId": "9024324564",
"merchantPostageAccountPaymentMethod": "OTHER",
"merchantRatePlan": null,
"merchantRate": null,
"shipperPostagePaymentAccountBalance": 1803.41,
"labelFee": null,
"parcelTrackingNumber": "0400109205168000244595",
"weightInOunces": 10,
"zone": "",
"packageLengthInInches": 6,
"packageWidthInInches": 2,
"packageHeightInInches": 4,
"packageTypeIndicator": "NonCubic",
"packageType": "PKG",
"mailClass": "First-Class Mail",
"internationalCountryPriceGroup": null,
"originationAddress": "27 Waterview Dr,Shelton,CT,06484",
"originZip": "06484",
"destinationAddress": "625 S Main St,Greenville,SC,29601",
"destinationZip": "29601250431",
"destinationCountry": "US",
"postageDepositAmount": null,
"creditCardFee": null,
"refundStatus": null,
"refundDenialReason": null,
"printStatus": null,
"shipmentId": "USPS2200487400865080",
"refundRequestor": null,
"externalId": null,
"adjustmentReason": null,
"meterNumber": "0001259113",
"dimensionalWeightOz": null,
"valueOfGoods": 0,
"specialServices": [ {
"specialServiceId": "DelCon",
"fee": 0,
"inputParameters": [ {
"name": "INPUT_VALUE",
"value": "0"
} ]
} ],
"status": "",
"description": null,
"inductionPostalCode": "06484",
"tracking": {
"parcelStatus": "Acceptance",
"statusDate": "2020-08-01T18:54:26.033
"customMessage1": null,
"customMessage2": null
},
{
"transactionId": "12345678_a7-4bc2-a17a-02a37ad84a5d",
"transactionDateTime": "2020-08-02T00:00:00.000+0000",
"transactionType": "POSTAGE REFUND",
"developerName": "PB",
"developerId": "12345678",
"developerPostagePaymentMethod": null,
"developerRatePlan": null,
"developerRateAmount": 3.5,
"developerPostagePaymentAccountBalance": null,
"merchantName": "Smith",
"merchantId": "9024324564",
"merchantPostageAccountPaymentMethod": "OTHER",
"merchantRatePlan": null,
"merchantRate": null,
"shipperPostagePaymentAccountBalance": 1547.53,
"labelFee": null,
"parcelTrackingNumber": "0400109205168000244595",
"weightInOunces": 10,
"zone": "",
"packageLengthInInches": 6,
"packageWidthInInches": 2,
"packageHeightInInches": 4,
"packageTypeIndicator": "NonCubic",
"packageType": "PKG",
"mailClass": "First-Class Mail",
"internationalCountryPriceGroup": null,
"originationAddress": "27 Waterview Dr,Shelton,CT,06484",
"originZip": "06484",
"destinationAddress": "625 S Main St,Greenville,SC,29601",
"destinationZip": "29601250431",
"destinationCountry": "US",
"postageDepositAmount": null,
"creditCardFee": null,
"refundStatus": "REQUESTED",
"refundDenialReason": null,
"printStatus": null,
"shipmentId": "USPS2200487400865080",
"refundRequestor": "Shipper Requested",
"externalId": null,
"adjustmentReason": null,
"meterNumber": "0001259113",
"dimensionalWeightOz": null,
"valueOfGoods": 0,
"specialServices": [ {
"specialServiceId": "DelCon",
"fee": 0,
"inputParameters": [ {
"name": "INPUT_VALUE",
"value": "0"
} ]
} ],
"status": "",
"description": null,
"inductionPostalCode": "06484",
"customMessage1": null,
"customMessage2": null
},
{
"transactionId": "12345678_a7-4bc2-a17a-02a37ad84a5d",
"transactionDateTime": "2020-08-14T11:19:20.864+0000",
"transactionType": "POSTAGE REFUND",
"developerName": "PB",
"developerId": "12345678",
"developerPostagePaymentMethod": null,
"developerRatePlan": null,
"developerRateAmount": 3.5,
"developerPostagePaymentAccountBalance": null,
"merchantName": "Smith",
"merchantId": "9024324564",
"merchantPostageAccountPaymentMethod": "OTHER",
"merchantRatePlan": null,
"merchantRate": 3.5,
"shipperPostagePaymentAccountBalance": 1700.97,
"labelFee": null,
"parcelTrackingNumber": "0400109205168000244595",
"weightInOunces": 10,
"zone": "",
"packageLengthInInches": 6,
"packageWidthInInches": 2,
"packageHeightInInches": 4,
"packageTypeIndicator": "NonCubic",
"packageType": "PKG",
"mailClass": "First-Class Mail",
"internationalCountryPriceGroup": null,
"originationAddress": "27 Waterview Dr,Shelton,CT,06484",
"originZip": "06484",
"destinationAddress": "625 S Main St,Greenville,SC,29601",
"destinationZip": "29601250431",
"destinationCountry": "US",
"postageDepositAmount": null,
"creditCardFee": null,
"refundStatus": "ACCEPTED",
"refundDenialReason": null,
"printStatus": null,
"shipmentId": "USPS2200487400865080",
"refundRequestor": "Shipper Requested",
"externalId": null,
"adjustmentReason": null,
"meterNumber": "0001259113",
"dimensionalWeightOz": null,
"valueOfGoods": 0,
"specialServices": [ {
"specialServiceId": "DelCon",
"fee": 0,
"inputParameters": [ {
"name": "INPUT_VALUE",
"value": "0"
} ]
} ],
"status": "",
"description": null,
"inductionPostalCode": "06484",
"customMessage1": null,
"customMessage2": null
},
...
],
"searchCriteria": {
"developerId": "12345678",
"fromDate": "2020-08-01T00:00:00.000+0000",
"toDate": "2020-08-30T23:59:59.000+0000"
},
"last": false,
"totalElements": 27,
"totalPages": 2,
"first": true,
"numberOfElements": 20,
"sort": [ {
"direction": "ASC",
"property": "transactionDateTime",
"ignoreCase": false,
"nullHandling": "NATIVE",
"descending": false,
"ascending": true
} ],
"size": 20,
"number": 0
}
Transaction Reports for PB Delivery, Sample Request¶
The following request uses the carrier
query parameter set to PBCS
to return PB Delivery transactions.
Note: When you set carrier=PBCS
, the response’s searchCriteria
object lists the parameter and value as "pbService": "Standard"
, which is synonymous.
curl -X GET ".../v4/ledger/developers/12345678/transactions/reports?carrier=PBCS&shipDetails=1&sort=transactionDateTime,desc" \
-H "Authorization: Bearer <oauth_token>" \
-H "Accept-Language:en-US" \
-H "X-PB-UnifiedErrorStructure: true"
{
"content": [ {
"transactionId": "12345678_n46202",
"transactionDateTime": "2021-04-28T18:40:14.153+0000",
"transactionType": "POSTAGE PRINT",
"developerId": "12345678",
"developerRatePlan": null,
"developerRateAmount": null,
"merchantId": "9024324564",
"merchantRatePlan": null,
"merchantRate": null,
"parcelTrackingNumber": "4206740192001901006014000001530820",
"weightInOunces": 8,
"zone": null,
"packageLengthInInches": 8.000,
"packageWidthInInches": 4.000,
"packageHeightInInches": 6.000,
"packageTypeIndicator": "NonCubic",
"packageType": "PKG",
"mailClass": "First-Class Mail",
"internationalCountryPriceGroup": null,
"originationAddress": "2352 Bent Creek Rd,Auburn,AL,36830-6433",
"originZip": "36830",
"destinationAddress": "400 S Santa Fe Ave,Salina,KS,67401-4144",
"destinationZip": "67401414400",
"destinationCountry": "US",
"refundDenialReason": null,
"shipmentId": "NGST2200324745116923",
"refundRequestor": null,
"specialServices": [ {
"specialServiceId": "DelCon",
"inputParameters": []
} ],
"status": null,
"description": "",
"clientFacilityId": "0093",
"carrierFacilityId": "1585",
"customMessage1": "",
"customMessage2": "Leave at door"
},
...
],
"searchCriteria": {
"developerId": "12345678",
"fromDate": "2021-03-28T22:08:43.912+0000",
"toDate": "2021-04-28T22:08:43.912+0000",
"shipDetails": 1,
"pbService": "Standard"
},
"last": false,
"totalElements": 548,
"totalPages": 28,
"first": true,
"numberOfElements": 20,
"sort": [ {
"property": "transactionDateTime",
"direction": "DESC",
"ignoreCase": false,
"nullHandling": "NATIVE",
"descending": true,
"ascending": false
} ],
"size": 20,
"number": 0
}
Error Codes¶
The following error codes are specific to Transaction Reports:
Error Code |
Error Message |
Solution |
---|---|---|
invalid.date.time |
Date range can not exceed 3 months. From date: ___ To date: ___ |
See Query Parameters for allowed range. |
invalid.date.time |
Provided Date/time ___ is invalid, valid format is YYYY-MM-DDThh:mm:ss.sZ |
See Query Parameters for correct format. |
For a list of all error codes returned by the Ecommerce APIs, please see Error Codes.