Members
(constant) EASYPOST_OBJECT_ID_PREFIX_TO_CLASS_NAME_MAP
A map of EasyPost object ID prefixes to their associated class names.
- Source:
(constant) RESOURCES
A map of EasyPost services available to the client.
- Source:
Methods
(async) _all(url, paramsopt) → {EasyPostObject|Array.<EasyPostObject>|Promise.<never>}
Retrieve a list of records from the API.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
url |
string | The URL to send the API request to. | |
params |
Object |
<optional> |
The parameters to send with the API request. |
- Source:
Returns:
The retrieved EasyPostObject-based class instance(s), or a `Promise` that rejects with an error.
- Type
- EasyPostObject | Array.<EasyPostObject> | Promise.<never>
_convertToEasyPostObject(response, params) → {*}
Converts a JSON response and all its nested elements to associated EasyPostObject-based class instances.
Parameters:
Name | Type | Description |
---|---|---|
response |
* | The JSON response to convert (usually a `Map` or `Array`). |
params |
* | The parameters passed when fetching the response |
- Source:
Returns:
An EasyPostObject-based class instance or an `Array` of EasyPostObject-based class instances.
- Type
- *
(async) _create(url, params) → {EasyPostObject|Promise.<never>}
Creates an EasyPost Object via the API.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | The URL to send the API request to. |
params |
Object | The parameters to send with the API request. |
- Source:
Returns:
The created EasyPostObject-based class instance, or a `Promise` that rejects with an error.
- Type
- EasyPostObject | Promise.<never>
(async) _getNextPage(url, collection, pageSize, optionalParams) → {EasyPostObject|Promise.<never>}
Retrieve the next page of specific collection of object
Parameters:
Name | Type | Default | Description |
---|---|---|---|
url |
string | The URL to send the API request to. | |
collection |
Object | The collection of a specific object. | |
pageSize |
Number | null | The number of records to return on each page. |
optionalParams |
Object | The optional param for additional value in the query string. |
- Source:
Returns:
The retrieved EasyPostObject-based class instance, or a `Promise` that rejects with an error.
TODO: Implement this function in EndShippers and Batches once the API supports them properly.
- Type
- EasyPostObject | Promise.<never>
(async) _retrieve(url) → {EasyPostObject|Promise.<never>}
Retrieve a record from the API.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | The URL to send the API request to. |
- Source:
Returns:
The retrieved EasyPostObject-based class instance, or a `Promise` that rejects with an error.
- Type
- EasyPostObject | Promise.<never>
(async) addCreditCard(referralApiKey, number, expirationMonth, expirationYear, cvc, priority) → {Object}
Add a credit card to a referral customer's account.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
referralApiKey |
string | The referral customer's production API key. | |
number |
string | The credit card number. | |
expirationMonth |
string | The credit card expiration month. | |
expirationYear |
string | The credit card expiration year. | |
cvc |
string | The credit card CVC. | |
priority |
string | primary | Whether to add the card as 'primary' or 'secondary' payment method (defaults to 'primary'). |
Returns:
- An object representing the newly-added credit card.
- Type
- Object
(async) addPaymentMethod(stripeCustomerId, paymentMethodReference, priorityopt) → {Object}
Add an existing Stripe payment method to a referral customer's account.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
stripeCustomerId |
string | The Stripe account's ID. | ||
paymentMethodReference |
string | Reference of Stripe payment method. | ||
priority |
string |
<optional> |
primary | Which priority to set the payment method to ('primary' or 'secondary'). |
Returns:
- A JSON object representing the payment method.
- Type
- Object
(async) addShipments(id, shipmentIds) → {Batch}
Add shipments to a batch.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The id of the batch to add shipments to. |
shipmentIds |
Array | The ids of the shipments to add to the batch. |
- Source:
Returns:
- The updated batch.
- Type
- Batch
(async) all(paramsopt) → {Object}
Retrieve all addresses associated with the current authenticated user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
Object |
<optional> |
Parameters to filter the list of addresses. |
- Source:
Returns:
- An object containing a list of addresses and pagination information.
- Type
- Object
(async) all() → {Object}
Retrieve all API keys associated with the current authenticated user.
See EasyPost API Documentation for more information.
- Source:
Returns:
- An object containing the API keys associated with the current authenticated user and its child users.
- Type
- Object
(async) all(paramsopt) → {Object}
Retrieve all batches associated with the current authenticated user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
Object |
<optional> |
Parameters to filter the list of batches. |
- Source:
Returns:
- An object containing a list of batches and pagination information.
- Type
- Object
(async) all(paramsopt) → {Object}
Retrieve all carrier accounts associated with the current authenticated user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
Object |
<optional> |
Parameters to filter the list of carrier accounts. |
Returns:
- An object containing a list of carrier accounts and pagination information.
- Type
- Object
(async) all(paramsopt) → {Array.<CarrierType>}
Retrieve all carrier types available to the current authenticated user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
Object |
<optional> |
Parameters to filter the list of carrier types. |
- Source:
Returns:
- A list of carrier types.
- Type
- Array.<CarrierType>
(async) all(paramsopt) → {Object}
Retrieve all Claim records associated with the current authenticated user.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
Object |
<optional> |
Parameters to filter the claim records. |
- Source:
Returns:
- An object containing the list of claim records and pagination information.
- Type
- Object
(async) all(paramsopt) → {Object}
Retrieve all end shippers associated with the current authenticated user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
Object |
<optional> |
Parameters to filter the list of end shippers. |
- Source:
Returns:
- An object containing a list of end shippers and pagination information.
- Type
- Object
(async) all(paramsopt) → {Object}
Retrieve all events associated with the current authenticated user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
Object |
<optional> |
Parameters to filter the list of events. |
- Source:
Returns:
- An object containing the list of events and pagination information.
- Type
- Object
(async) all(paramsopt) → {Object}
Retrieve all Insurance records associated with the current authenticated user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
Object |
<optional> |
Parameters to filter the insurance records. |
- Source:
Returns:
- An object containing the list of insurance records and pagination information.
- Type
- Object
(async) all(paramsopt) → {Object}
Retrieve all pickups associated with the current authenticated user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
Object |
<optional> |
The parameters to filter the pickups by. |
- Source:
Returns:
- An object containing a list of pickups and pagination information.
- Type
- Object
(async) all(paramsopt) → {Object}
Retrieve all referral customers associated with the current authenticated user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
Object |
<optional> |
Parameters to filter the referral customers by. |
Returns:
- An object containing a list of referral customers and pagination information.
- Type
- Object
(async) all(paramsopt) → {Object}
Retrieve all refunds associated with the current authenticated user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
Object |
<optional> |
The parameters to filter the refunds by. |
- Source:
Returns:
- An object containing the list of refunds and pagination information.
- Type
- Object
(async) all(paramsopt) → {Object}
Retrieve all reports associated with the current authenticated user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
Object |
<optional> |
The parameters to filter the reports by. |
- Source:
Returns:
- An object containing the list of reports and pagination information.
- Type
- Object
(async) all(paramsopt) → {Object}
Retrieve all scan forms associated with the current authenticated user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
Object |
<optional> |
The parameters to filter the scan forms by. |
- Source:
Returns:
- An object containing the list of scan forms and pagination information.
- Type
- Object
(async) all(paramsopt) → {Object}
Retrieve all shipments associated with the current authenticated user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
Object |
<optional> |
Parameters to filter the shipments by. |
- Source:
Returns:
- An object containing a list of shipments and pagination information.
- Type
- Object
(async) all(paramsopt) → {Object}
Retrieve all trackers associated with the current authenticated user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
Object |
<optional> |
The parameters to filter the trackers by. |
- Source:
Returns:
- An object containing the list of trackers and pagination information.
- Type
- Object
(async) all(paramsopt) → {Array.<Webhook>}
Retrieve all webhooks associated with the current authenticated user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
Object |
<optional> |
- Source:
Returns:
- Type
- Array.<Webhook>
(async) allChildren(params) → {Object}
Retrieve a paginated list of children user user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters to filter the list of children users. |
- Source:
Returns:
- An object containing a list of User and pagination information.
- Type
- Object
(async) buy(id) → {Batch}
Purchase a batch.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The id of the batch to purchase. |
- Source:
Returns:
- The purchased batch.
- Type
- Batch
(async) buy(id, carrier, service) → {Order}
Purchase an order.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the order to buy. |
carrier |
string | The carrier to use for the order purchase. |
service |
string | The service to use for the order purchase. |
- Source:
Returns:
- The purchased order.
- Type
- Order
(async) buy(id, carrier, service) → {Pickup}
Purchase a pickup.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the pickup to purchase. |
carrier |
string | The carrier to purchase the pickup with. |
service |
string | The service to purchase the pickup with. |
- Source:
Returns:
- The purchased pickup.
- Type
- Pickup
(async) buy(id, rate, insuranceAmountopt, endShipperIdopt) → {Shipment}
Purchase a shipment.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
id |
string | The ID of the shipment to purchase. | ||
rate |
Rate | The rate to purchase the shipment with. | ||
insuranceAmount |
number | null |
<optional> |
null | The amount of insurance to purchase for the shipment. |
endShipperId |
string | null |
<optional> |
null | The ID of the end shipper to purchase the shipment with. |
- Source:
Returns:
- The purchased shipment.
- Type
- Shipment
(async) cancel(id) → {Claim}
Cancel a claim record by its ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the claim to be canceled. |
- Source:
Returns:
- The canceled claim.
- Type
- Claim
(async) cancel(id) → {Pickup}
Cancel a pickup.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the pickup to cancel. |
- Source:
Returns:
- The cancelled pickup.
- Type
- Pickup
(async) convertLabelFormat(id, format) → {Shipment}
Convert the label format of a shipment.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the shipment to convert the label format of. |
format |
string | The format to convert the label to. |
- Source:
Returns:
- The shipment with the converted label format.
- Type
- Shipment
(async) create(params) → {Address}
Create an address.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters for the address to be created. |
- Source:
Returns:
- The created address.
- Type
- Address
(async) create(params) → {Batch}
Create a batch.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters for the batch to be created. |
- Source:
Returns:
- The created batch.
- Type
- Batch
(async) create(params) → {CarrierAccount}
Create a carrier account.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters for the carrier account to be created. |
Returns:
- The created carrier account.
- Type
- CarrierAccount
(async) create(params) → {Claim}
Create a claim record.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters for the claim to be created. |
- Source:
Returns:
- The created claim.
- Type
- Claim
(async) create(params) → {CustomsInfo}
Create a customs info record.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters for the customs info to be created. |
- Source:
Returns:
- The created customs info.
- Type
- CustomsInfo
(async) create(params) → {CustomsItem}
Create a customs item.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters for the customs item to be created. |
- Source:
Returns:
- The created customs item.
- Type
- CustomsItem
(async) create(params) → {EndShipper}
Create an end shipper.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters for the end shipper to be created. |
- Source:
Returns:
- The created end shipper.
- Type
- EndShipper
(async) create(params) → {Insurance}
Create an insurance record.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters for the insurance to be created. |
- Source:
Returns:
- The created insurance.
- Type
- Insurance
(async) create(params) → {Order}
Create an order.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | The parameters to create an order with. |
- Source:
Returns:
- The created order.
- Type
- Order
(async) create(params) → {Parcel}
Create a parcel.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | The parameters to create a parcel with. |
- Source:
Returns:
- The created parcel.
- Type
- Parcel
(async) create(params) → {Pickup}
Create a pickup.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | The parameters to create a pickup with. |
- Source:
Returns:
- The created pickup.
- Type
- Pickup
(async) create(params) → {User}
Create a referral customer.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | The referral customer's information. |
Returns:
- The newly created referral customer.
- Type
- User
(async) create(params) → {Refund}
Create a refund.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | The parameters to create a refund with. |
- Source:
Returns:
- The created refund.
- Type
- Refund
(async) create(params) → {Report}
Create a report.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | The parameters to create a report with. |
- Source:
Returns:
- The created report.
- Type
- Report
(async) create(params) → {ScanForm}
Create a scan form.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | The parameters to create a scan form with. |
- Source:
Returns:
- The created scan form.
- Type
- ScanForm
(async) create(params) → {Shipment}
Create a shipment.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | The parameters to create a shipment with. |
- Source:
Returns:
- The created shipment.
- Type
- Shipment
(async) create(params) → {Tracker}
Create a tracker.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | The parameters to create a tracker with. |
- Source:
Returns:
- The created tracker.
- Type
- Tracker
(async) create(params) → {User}
Create a child user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | The parameters to create a child user with. |
- Source:
Returns:
- The created child user.
- Type
- User
(async) create(params) → {Webhook}
Create a webhook.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | The parameters to create a webhook with. |
- Source:
Returns:
- The created webhook.
- Type
- Webhook
(async) createAndVerify(params) → {Address}
Create and verify an address in a single request.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters for the address to be created. |
- Source:
Returns:
- The created and verified address.
- Type
- Address
(async) createScanForm(id) → {Batch}
Create a scan form for a batch.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The id of the batch to create a scan form for. |
- Source:
Returns:
- The updated batch.
- Type
- Batch
(async) delete(id) → {Promise|Promise.<never>}
Delete a carrier account.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The id of the carrier account to be deleted. |
Returns:
- A promise that resolves when the carrier account has been deleted.
- Type
- Promise | Promise.<never>
(async) delete(id) → {Promise|Promise.<never>}
Delete a child user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the child user to delete. |
- Source:
Returns:
- A promise that resolves when the child user is deleted successfully.
- Type
- Promise | Promise.<never>
(async) delete(id) → {Promise|Promise.<never>}
Delete a webhook.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the webhook to delete. |
- Source:
Returns:
- A promise that resolves if the webhook was successfully deleted.
- Type
- Promise | Promise.<never>
(async) deletePaymentMethod(priority)
Delete a payment method from the current authenticated user's account.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
priority |
String | The priority of the payment method to delete. Can be either 'primary' or 'secondary'. |
- Source:
(async) estimateDeliveryDate(params) → {Object}
Retrieve the estimated delivery date of each carrier-service level combination via the Smart Deliver By API, based on a specific ship date and origin-destination postal code pair.
Parameters:
Name | Type | Description |
---|---|---|
params |
The parameters to estimate the delivery date with. |
- Source:
Returns:
- Estimates and related metadata.
- Type
- Object
(async) fundWallet(amount, priority)
Fund your EasyPost wallet by charging your primary or secondary payment method on file.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
amount |
String | The amount to charge to your payment method. | |
priority |
String | primary | The priority of the payment method to charge. Can be either 'primary' or 'secondary'. |
- Source:
(async) generateForm(id, formType, formOptionsopt) → {Shipment}
Generate a form for a shipment.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
string | The ID of the shipment to generate a form for. | |
formType |
string | The type of form to generate. | |
formOptions |
Map |
<optional> |
Options for the form. |
- Source:
Returns:
- The shipment with the generated form attached.
- Type
- Shipment
(async) generateLabel(id, fileFormat) → {Batch}
Generate a label for a batch.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The id of the batch to generate a label for. |
fileFormat |
string | The format of the label to generate. Defaults to 'pdf'. |
- Source:
Returns:
- The updated batch.
- Type
- Batch
getLowestRate(rates, carriersopt, servicesopt) → {Rate}
Get the lowest rate from a provided list of rates.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
rates |
Array.<Rate> | List of rates to filter through | ||
carriers |
Array.<string> |
<optional> |
null | List of allowed carriers to filter by |
services |
Array.<string> |
<optional> |
null | List of allowed services to filter by |
- Source:
Throws:
-
- If no applicable rates are found
- Type
- FilteringError
Returns:
- The lowest rate
- Type
- Rate
getLowestSmartRate(smartrates, deliveryDays, deliveryAccuracy) → {Rate}
Get the lowest SmartRate from a provided list of SmartRates.
Parameters:
Name | Type | Description |
---|---|---|
smartrates |
Array.<Rate> | List of SmartRates to filter through |
deliveryDays |
number | The maximum number of days allowed for delivery |
deliveryAccuracy |
string | The target level of accuracy for the delivery days (e.g. 'percentile_50') |
- Source:
Throws:
-
-
- If no applicable rates are found
- Type
- FilteringError
-
-
-
- If the deliveryAccuracy value is invalid
- Type
- InvalidParameterError
-
Returns:
- The lowest SmartRate
- Type
- Rate
(async) getNextPage(addresses, pageSize) → {EasyPostObject|Promise.<never>}
Retrieve the next page of Address collection.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
addresses |
Object | An object containing a list of addresses and pagination information. | |
pageSize |
Number | null | The number of records to return on each page |
- Source:
Returns:
The retrieved EasyPostObject-based class instance, or a `Promise` that rejects with an error.
- Type
- EasyPostObject | Promise.<never>
(async) getNextPage(claims, pageSize) → {EasyPostObject|Promise.<never>}
Retrieve the next page of Claim collection.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
claims |
Object | An object containing a list of claims and pagination information. | |
pageSize |
Number | null | The number of records to return on each page |
- Source:
Returns:
The retrieved EasyPostObject-based class instance, or a `Promise` that rejects with an error.
- Type
- EasyPostObject | Promise.<never>
(async) getNextPage(events, pageSize) → {EasyPostObject|Promise.<never>}
Retrieve the next page of Event collection.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
events |
Object | An object containing a list of events and pagination information. | |
pageSize |
Number | null | The number of records to return on each page |
- Source:
Returns:
The retrieved EasyPostObject-based class instance, or a `Promise` that rejects with an error.
- Type
- EasyPostObject | Promise.<never>
(async) getNextPage(insurances, pageSize) → {EasyPostObject|Promise.<never>}
Retrieve the next page of Insurance collection.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
insurances |
Object | An object containing a list of insurances and pagination information. | |
pageSize |
Number | null | The number of records to return on each page |
- Source:
Returns:
The retrieved EasyPostObject-based class instance, or a `Promise` that rejects with an error.
- Type
- EasyPostObject | Promise.<never>
(async) getNextPage(pickups, pageSize) → {EasyPostObject|Promise.<never>}
Retrieve the next page of Pickup collection.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
pickups |
Object | An object containing a list of pickups and pagination information. | |
pageSize |
Number | null | The number of records to return on each page |
- Source:
Returns:
The retrieved EasyPostObject-based class instance, or a `Promise` that rejects with an error.
- Type
- EasyPostObject | Promise.<never>
(async) getNextPage(referralCustomers, pageSize) → {EasyPostObject|Promise.<never>}
Retrieve the next page of Referral Customer collection.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
referralCustomers |
Object | An object containing a list of referralCustomers and pagination information. | |
pageSize |
Number | null | The number of records to return on each page |
Returns:
The retrieved EasyPostObject-based class instance, or a `Promise` that rejects with an error.
- Type
- EasyPostObject | Promise.<never>
(async) getNextPage(refunds, pageSize) → {EasyPostObject|Promise.<never>}
Retrieve the next page of Refund collection.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
refunds |
Object | An object containing a list of refunds and pagination information. | |
pageSize |
Number | null | The number of records to return on each page |
- Source:
Returns:
The retrieved EasyPostObject-based class instance, or a `Promise` that rejects with an error.
- Type
- EasyPostObject | Promise.<never>
(async) getNextPage(reports, pageSize) → {EasyPostObject|Promise.<never>}
Retrieve the next page of Report collection.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
reports |
Object | An object containing a list of reports and pagination information. | |
pageSize |
Number | null | The number of records to return on each page |
- Source:
Returns:
The retrieved EasyPostObject-based class instance, or a `Promise` that rejects with an error.
- Type
- EasyPostObject | Promise.<never>
(async) getNextPage(scanforms, pageSize) → {EasyPostObject|Promise.<never>}
Retrieve the next page of ScanForm collection.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
scanforms |
Object | An object containing a list of scanforms and pagination information. | |
pageSize |
Number | null | The number of records to return on each page |
- Source:
Returns:
The retrieved EasyPostObject-based class instance, or a `Promise` that rejects with an error.
- Type
- EasyPostObject | Promise.<never>
(async) getNextPage(shipments, pageSize) → {EasyPostObject|Promise.<never>}
Retrieve the next page of Shipment collection.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
shipments |
Object | An object containing a list of shipments and pagination information. | |
pageSize |
Number | null | The number of records to return on each page |
- Source:
Returns:
The retrieved EasyPostObject-based class instance, or a `Promise` that rejects with an error.
- Type
- EasyPostObject | Promise.<never>
(async) getNextPage(trackers, pageSize) → {EasyPostObject|Promise.<never>}
Retrieve the next page of Tracker collection.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
trackers |
Object | An object containing a list of trackers and pagination information. | |
pageSize |
Number | null | The number of records to return on each page |
- Source:
Returns:
The retrieved EasyPostObject-based class instance, or a `Promise` that rejects with an error.
- Type
- EasyPostObject | Promise.<never>
(async) getNextPage(children, pageSize) → {EasyPostObject|Promise.<never>}
Retrieve the next page of children collection.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
children |
Object | An object containing a list of children and pagination information. | |
pageSize |
Number | null | The number of records to return on each page |
- Source:
Returns:
The retrieved EasyPostObject-based class instance, or a `Promise` that rejects with an error.
- Type
- EasyPostObject | Promise.<never>
(async) getRates(id) → {Order}
Get updated rates for an order.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the order to get rates for. |
- Source:
Returns:
- The order with rates.
- Type
- Order
(async) getSmartRates(id) → {Array.<Rate>}
Get SmartRates for a shipment.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the shipment to get SmartRates for. |
- Source:
Returns:
- The SmartRates for the shipment.
- Type
- Array.<Rate>
handleApiError(error) → {ApiError}
Calculate and generate the appropriate ApiError based on a received HTTP response error.
Parameters:
Name | Type | Description |
---|---|---|
error |
* | The errored HTTP response. |
- Source:
Returns:
The `ApiError`-based error corresponding to the HTTP status code.
- Type
- ApiError
(async) insure(id, amount) → {Shipment}
Insure a shipment.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the shipment to insure. |
amount |
number | string | The amount to insure the shipment for. |
- Source:
Returns:
- The insured shipment.
- Type
- Shipment
lowestRate(carriersopt, servicesopt) → {Rate}
Get the lowest rate for this Order.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
carriers |
Array.<string> |
<optional> |
List of allowed carriers to filter by |
services |
Array.<string> |
<optional> |
List of allowed services to filter by |
- Source:
Throws:
-
- If no applicable rates are found
- Type
- FilteringError
Returns:
- The lowest rate
- Type
- Rate
lowestRate(carriersopt, servicesopt) → {Rate}
Get the lowest rate for this Pickup.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
carriers |
Array.<string> |
<optional> |
List of allowed carriers to filter by |
services |
Array.<string> |
<optional> |
List of allowed services to filter by |
- Source:
Throws:
-
- If no applicable rates are found
- Type
- FilteringError
Returns:
- The lowest rate
- Type
- Rate
lowestRate(carriersopt, servicesopt) → {Rate}
Get the lowest rate for this Shipment.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
carriers |
Array.<string> |
<optional> |
List of allowed carriers to filter by |
services |
Array.<string> |
<optional> |
List of allowed services to filter by |
- Source:
Throws:
-
- If no applicable rates are found
- Type
- FilteringError
Returns:
- The lowest rate
- Type
- Rate
(async) lowestSmartRate(id, deliveryDays, deliveryAccuracy) → {Rate}
Get the lowest SmartRate of a shipment.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the shipment to get the lowest SmartRate of. |
deliveryDays |
number | The number of days the shipment will take to deliver. |
deliveryAccuracy |
string | The accuracy of the delivery days. |
- Source:
Returns:
- The lowest SmartRate of the shipment.
- Type
- Rate
(async) recommendShipDate(id, desiredDeliveryDate) → {Array}
Retrieve a recommended ship date for a shipment via the Precision Shipping API, based on a specific desired delivery date.
Parameters:
Name | Type | Description |
---|---|---|
id |
The ID of the shipment to retrieve the recommended ship date for. | |
desiredDeliveryDate |
The desired delivery date for the shipment. |
- Source:
Returns:
- An array of the recommended ship date and rates.
- Type
- Array
(async) recommendShipDate(params) → {Object}
Retrieve a recommended ship date for each carrier-service level combination via the Smart Deliver On API, based on a specific delivery date and origin-destination postal code pair.
Parameters:
Name | Type | Description |
---|---|---|
params |
The parameters to recommend the ship date with. |
- Source:
Returns:
- Recommendation and related metadata.
- Type
- Object
(async) refund(id) → {Insurance}
Refund an insurance record by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the insurance to be refunded. |
- Source:
Returns:
- The refunded insurance.
- Type
- Insurance
(async) refund(id) → {Shipment}
Refund a shipment.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the shipment to refund. |
- Source:
Returns:
- The refunded shipment.
- Type
- Shipment
(async) refundByAmount(refundAmount) → {Object}
Refund by amount for a recent payment.
Parameters:
Name | Type | Description |
---|---|---|
refundAmount |
number | Amount to be refunded by cents. |
Returns:
- A JSON object representing the refund.
- Type
- Object
(async) refundByPaymentLog(paymentLogId) → {object}
Refund a payment by a payment log ID.
Parameters:
Name | Type | Description |
---|---|---|
paymentLogId |
string | ID of the payment log. |
Returns:
- Returns BetaPaymentRefund object.
- Type
- object
(async) regenerateRates(id) → {Shipment}
Regenerate rates for a shipment.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the shipment to regenerate rates for. |
- Source:
Returns:
- The shipment with regenerated rates.
- Type
- Shipment
(async) removeShipments(id, shipmentIds) → {Batch}
Removes shipments from a batch.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The id of the batch to remove shipments from. |
shipmentIds |
Array | The ids of the shipments to remove from the batch. |
- Source:
Returns:
- The updated batch.
- Type
- Batch
(async) retrieve(id) → {Address}
Retrieve an address by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the address to retrieve. |
- Source:
Returns:
- The retrieved address.
- Type
- Address
(async) retrieve(id) → {Batch}
Retrieve a batch by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the batch to retrieve. |
- Source:
Returns:
- The retrieved batch.
- Type
- Batch
(async) retrieve(id) → {CarrierAccount}
Retrieve a carrier account by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the carrier account to retrieve. |
Returns:
- The retrieved carrier account.
- Type
- CarrierAccount
(async) retrieve(carriers, type) → {Array.<Object>}
Retrieve a list of carrier metadata based on the provided parameters.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
carriers |
Array | null | List of carrier in string |
type |
Array | List of types in string |
Returns:
- List of carrier metadata
- Type
- Array.<Object>
(async) retrieve(id) → {Claim}
Retrieve a claim record by its ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the claim to retrieve. |
- Source:
Returns:
- The retrieved claim.
- Type
- Claim
(async) retrieve(id) → {CustomsInfo}
Retrieve a customs info record by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the customs info to retrieve. |
- Source:
Returns:
- The retrieved customs info.
- Type
- CustomsInfo
(async) retrieve(id) → {CustomsItem}
Retrieve a customs item by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the customs item to retrieve. |
- Source:
Returns:
- The retrieved customs item.
- Type
- CustomsItem
(async) retrieve(id) → {EndShipper}
Retrieve an end shipper by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the end shipper to retrieve. |
- Source:
Returns:
- The retrieved end shipper.
- Type
- EndShipper
(async) retrieve(id) → {Event}
Retrieve an event by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the event to retrieve. |
- Source:
Returns:
- The retrieved event.
- Type
- Event
(async) retrieve(id) → {Insurance}
Retrieve an insurance record by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the insurance to retrieve. |
- Source:
Returns:
- The retrieved insurance.
- Type
- Insurance
(async) retrieve(id) → {Order}
Retrieve an order by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the order to retrieve. |
- Source:
Returns:
- The retrieved order.
- Type
- Order
(async) retrieve(id) → {Parcel}
Retrieve a parcel by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the parcel to retrieve. |
- Source:
Returns:
- The retrieved parcel.
- Type
- Parcel
(async) retrieve(id) → {Pickup}
Retrieve a pickup by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the pickup to retrieve. |
- Source:
Returns:
- The retrieved pickup.
- Type
- Pickup
(async) retrieve(id) → {Rate}
Retrieve a rate by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the rate to retrieve. |
- Source:
Returns:
- The retrieved rate.
- Type
- Rate
(async) retrieve(id) → {Refund}
Retrieve a refund by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the refund to retrieve. |
- Source:
Returns:
- The retrieved refund.
- Type
- Refund
(async) retrieve(id) → {Report}
Retrieve a report by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the report to retrieve. |
- Source:
Returns:
- The retrieved report.
- Type
- Report
(async) retrieve(id) → {ScanForm}
Retrieve a scan form by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the scan form to retrieve. |
- Source:
Returns:
- The retrieved scan form.
- Type
- ScanForm
(async) retrieve(id) → {Shipment}
Retrieve a shipment by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the shipment to retrieve. |
- Source:
Returns:
- The shipment with the given ID.
- Type
- Shipment
(async) retrieve(id) → {Tracker}
Retrieve a tracker by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the tracker to retrieve. |
- Source:
Returns:
- The retrieved tracker.
- Type
- Tracker
(async) retrieve(id) → {User}
Retrieve a child user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the child user to retrieve. |
- Source:
Returns:
- The retrieved child user.
- Type
- User
(async) retrieve(id) → {Webhook}
Retrieve a webhook by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the webhook to retrieve. |
- Source:
Returns:
- The retrieved webhook.
- Type
- Webhook
(async) retrieveAllPayloads(id) → {Array.<Payload>}
Retrieve all payloads for an event.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the event to retrieve payloads for. |
- Source:
Returns:
- A list of payloads for the event.
- Type
- Array.<Payload>
(async) retrieveApiKeysForUser(id) → {Array}
Retrieve API Keys for a specified user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the user to retrieve keys for. |
- Source:
Throws:
-
If user or API Keys are not found.
- Type
- FilteringError
Returns:
- List of associated API Keys.
- Type
- Array
(async) retrieveEstimatedDeliveryDate(id, plannedShipDate) → {Array}
Retrieve the estimated delivery date of each Rate via SmartRate.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the shipment to retrieve the estimated delivery date for. |
plannedShipDate |
string | The planned ship date of the shipment. |
- Source:
Returns:
- An array of the estimated delivery date and rates.
- Type
- Array
(async) retrieveMe() → {User}
Retrieve the current authenticated user.
See EasyPost API Documentation for more information.
- Source:
Returns:
- The retrieved user.
- Type
- User
(async) retrievePayload(id, payloadId) → {Payload}
Retrieve a specific payload for an event.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the event to retrieve the payload for. |
payloadId |
string | The ID of the payload to retrieve. |
- Source:
Returns:
- The payload for the event.
- Type
- Payload
(async) retrievePaymentMethods() → {Object}
Retrieve all payment methods associated with the current authenticated user.
See EasyPost API Documentation for more information.
- Source:
Returns:
- An object containing the payment methods associated with the current authenticated user.
- Type
- Object
(async) retrieveStatelessRates(params) → {Array.<Rate>}
Retrieve a list of stateless rates based on the provided parameters.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Map of parameters for the API call |
- Source:
Returns:
- List of stateless rates
- Type
- Array.<Rate>
traverseJsonElement(errorMessage, messagesList)
Recursively traverses a JSON object or array and extracts error messages
as strings. Adds the extracted messages to the specified messagesList array.
Parameters:
Name | Type | Description |
---|---|---|
errorMessage |
object | array | string | The JSON object or array to traverse. |
messagesList |
array | The array to which extracted error messages will be added. |
- Source:
(async) update(id, params) → {CarrierAccount}
Update a carrier account.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The id of the carrier account to be updated. |
params |
Object | Parameters for the carrier account to be updated. |
Returns:
- The updated carrier account.
- Type
- CarrierAccount
(async) update(id, params) → {EndShipper}
Update an end shipper.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the end shipper to update. |
params |
Object | Parameters for the end shipper to be updated. |
- Source:
Returns:
- The updated end shipper.
- Type
- EndShipper
(async) update(id, params) → {User}
Update a user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the user to update (either the current authenticated user or a child user). |
params |
Object | The parameters to update the user with. |
- Source:
Returns:
- The updated user.
- Type
- User
(async) update(id, params) → {Webhook}
Update a webhook.
A disabled webhook will be re-enabled if it is updated.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the webhook to update. |
params |
Object | The parameters to update the webhook with. |
- Source:
Returns:
- The updated webhook.
- Type
- Webhook
(async) updateBrand(id, params) → {Brand}
Update the brand of a user.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the user to update the brand of. |
params |
Object | The parameters to update the brand with. |
- Source:
Returns:
- The updated brand.
- Type
- Brand
(async) updateEmail(referralUserId, email) → {boolean}
Update a referral customer's email address.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
referralUserId |
string | The ID of the referral customer to update. |
email |
string | The new email address. |
Returns:
- Returns true if the referral was updated successfully, false otherwise.
- Type
- boolean
validateWebhook(eventBody, headers, webhookSecret) → {object}
Validate a webhook by comparing the HMAC signature header sent from EasyPost to your shared secret.
If the signatures do not match, an error will be raised signifying the webhook either did not originate
from EasyPost or the secrets do not match. If the signatures do match, the `event_body` will be returned
as JSON.
Parameters:
Name | Type | Description |
---|---|---|
eventBody |
buffer | The raw body of the webhook event |
headers |
Object | The headers of the webhook HTTP request |
webhookSecret |
string | The webhook secret shared between EasyPost and your application |
- Source:
Throws:
-
- If the signature could not be verified
- Type
- SignatureVerificationError
Returns:
- The JSON-parsed webhook event body if the signature could be verified
- Type
- object
(async) verifyAddress(id) → {Address}
Verify an address by its ID.
See EasyPost API Documentation for more information.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the address to verify. |
- Source:
Returns:
- The verified address.
- Type
- Address