Quick start

Installation

You can include ShipupETA in your website by adding the following code snippet in the <head> tag of your page. You can also add it in the <body> tag in case you don't have access to the <head> tag.

<script src="https://cdn.shipup.co/shipup-eta/latest/shipup-eta.js"></script>

Once this snippet is added, you will gain access to the ShipupETA module.
Let's test it with a minimalistic configuration.

Getting your first predictions

The ShipupETA module exposes two main methods, the init one to pass global options and the fetchPredictions one that fetches delivery estimates from the Shipup API.
The return type and options of both methods can be found in the API Reference section.

This section shows a minimalistic configuration to fetch your first predictions. We will specify the only mandatory initialization parameter: your public API key. You can find it here in the Settings section of your Shipup account.
Keep in mind that this simplistic configuration comes with many default behaviors that may not suit your needs.

By adding the snippet below:

<script>
  // Global initialisation of the module
	ShipupETA.init({ publicApiKey: 'xxxx-xxxxxxx-xxx' });
  
  // Returns a promise with all predictions
  ShipupETA.fetchPredictions()
    .then(response => console.log(response));
</script>

you will receive and output your first predictions:

{
  "delivery_date_estimations": [
    {
      "carrier_code": "dhl",
      "service_code": "base",
      "delivery_date": "2024-04-22",
      "safe_delivery_date": "2024-04-23",
      "cutoff_datetime_utc": "2024-04-19T13:00:00.000Z"
    },
    {
      "carrier_code": "royal_mail",
      "service_code": "base",
      "delivery_date": "2024-04-20",
      "safe_delivery_date": "2024-04-22",
      "cutoff_datetime_utc": "2024-04-19T13:00:00.000Z"
    }
  ],
  "best_estimation": {
      "carrier_code": "royal_mail",
      "service_code": "base",
      "delivery_date": "2024-04-20",
      "safe_delivery_date": "2024-04-22",
      "cutoff_datetime_utc": "2024-04-19T13:00:00.000Z"
  }
}
      

🚧

Important Defaults

If no other configuration is specified, ShipupETA is configured with defaults that may not suit your needs.

A non-exhaustive list of such defaults is that:

  • when computing predictions, the algorithm will use
    • your default warehouse settings such as your open/closed days
    • the country of your default warehouse as both the origin and the destination country
  • the response will contain a prediction for each carrier service enabled on your account

This is a perfectly good configuration if you only have one warehouse and don't do any international shipping.
If that is not the case, you will need to configure the module a bit more. The next section of this documentation gives a step-by-step explanation of how to do this..