Skip to content
You're viewing the API v4 documentation, recommended for new integrations.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Promise Dates

Use the Promise API to get an estimated delivery date to display during conversion and checkout to reduce uncertainty that leads to cart abandonment and improve customer delivery satisfaction.

Overview

parcelLab provides an API you can call to get forecasted delivery dates. This date can be used to display a delivery date promise on the product details page or at checkout. It can be shown in a format you want on your website so customers can see when a product should arrive before buying it.

For more information on the scope and requirements of this feature, please contact your parcelLab representative.

For an embeddable storefront widget, see Promise UI Plugin.

Get Promise Date

You can retrieve the forecasted delivery date of an order using the v4/promise/prediction/predict endpoint.

Generate prediction

get

If IP lookup fails or no delivery methods match, Backend uses fallback_country_iso3 when supplied. Matching IP methods take priority, even in another country. An empty prediction list after method selection does not trigger a fallback.

IP requests are limited to 60 per minute per caller IP. Excess requests return HTTP 429 with Retry-After. Country and postal code requests do not use this limit.

Authorizations
AuthorizationstringOptional

Send Authorization: Parcellab-API-Token <encoded-token>.

<encoded-token> = base64(account_id:token) as provided in the portal.

Query parameters
accountintegerRequired

Account ID

calibrationstring,null · enum · nullableOptional

Set to true, to indicate that the prediction should be done based on the current, not yet published, promise configuration

  • conservative - conservative
  • balanced - balanced
  • aggressive - aggressive
Possible values:
courierstring · min: 1 · max: 40 · nullableOptional

The logistics courier to be used. Defaults to returning all configured couriers.

destination_country_iso3string · nullableOptional

ISO 3166-1 alpha-3 code of the destination country. Supply either this field or destination_ip_address.

destination_ip_addressstring · min: 1 · nullableOptional

Shopper IPv4 or IPv6 address for an estimated delivery location. Do not combine with destination_country_iso3 or destination_postal_code. IP lookup does not confirm a delivery address.

destination_postal_codestring · min: 1 · max: 10 · nullableOptional

Postal code of the destination. Requires destination_country_iso3.

dispatch_nowbooleanOptional

Forces the forecasted delivery date to skip any warehouse calculation and generate a prediction if the parcel is shipped at the moment of the API call, if set to 'true'

Default: false
draftboolean · nullableOptional

Set to true, to indicate that the prediction should be done based on the current, not yet published, promise configuration

fallback_country_iso3string · nullableOptional

Optional ISO 3166-1 alpha-3 country for IP destinations. Used when IP lookup fails or no delivery methods match. Matching IP delivery methods take priority. The fallback uses no IP postal code or region.

global_courier_service_levelstring,null · enum · nullableOptional

Filter by the parcelLab global service level: standard, expedited, express, or unused. Combined with service_level when both are supplied. Requires Backend support for globalCourierServiceLevel.

  • standard - standard
  • unused - unused
  • express - express
  • expedited - expedited
Possible values:
language_iso2string · min: 2 · max: 5 · nullableOptional

Language code to use for localization. Plain language codes such as en or es are supported. Locale codes with country suffixes such as es_US or es-US are also accepted.

Pattern: ^[a-zA-Z]{2}(?:[-_][a-zA-Z]{2})?$
now_overridestring · nullableOptional

Locks the prediction for a specified request date as a ISO 8601 date and time in UTC format like 2022-06-10T06:42:00Z. Defaults now to the current time if omitted, which is required for production usage.

service_levelstring · min: 1 · max: 40 · nullableOptional

The courier service level mapped in your Promise configuration (for example: express delivery). Defaults to returning all courier service levels.

tagstring · min: 1 · max: 40 · nullableOptional

Tag to target prediction adjustment rule

warehousestring · min: 1 · max: 40 · nullableOptional

The warehouse the delivery shipped from (input field: key). Defaults to the default warehouse for the destination.

Responses
200Success
application/json
request_idstringRequired
successbooleanRequired
get/v4/promise/prediction/predict/
GET /v4/promise/prediction/predict/?account=1 HTTP/1.1
Host: api.parcellab.com
Authorization: Parcellab-API-Token YOUR_BASE64_ENCODED_API_TOKEN
Accept: */*
{
  "request_id": "text",
  "success": true,
  "prediction": [
    {
      "id": "text",
      "warehouse": "text",
      "courier": "text",
      "courier_name": "text",
      "courier_alias": [
        "text"
      ],
      "courier_service_level": [
        "text"
      ],
      "global_courier_service_level": "standard",
      "prediction": {
        "min": 1,
        "max": 1,
        "likely": 1,
        "send_date": "2026-01-01",
        "earliest_date": "2026-01-01",
        "latest_date": "2026-01-01",
        "most_likely_date": "2026-01-01",
        "earliest_locale": "text",
        "latest_locale": "text",
        "most_likely_locale": "text",
        "cutoff": 1,
        "cutoff_locale": "text"
      }
    }
  ],
  "location": {
    "country": "text",
    "region": "text",
    "zip": "text"
  }
}

Integration Flow: Send, Read, and Save

Use the confirmed checkout address first. Before checkout, use a shopper's saved country and postal code when available; otherwise, use an IP estimate with a country fallback. A saved country-only choice should also take priority over a new IP lookup.

Stage
Send or read
What your integration does

Estimate before an address is known

Send account, destination_ip_address, and optionally fallback_country_iso3.

Read location.country and location.zip to label an approximate destination. Keep it separate from the delivery address.

Shopper enters or changes a destination

Send destination_country_iso3 and, if available, destination_postal_code. Remove destination_ip_address and fallback_country_iso3.

Save the shopper's country and postal code together if you want to reuse their choice. Clear the old postal code when the country changes. Request a new prediction.

Select the shipping option

Read a matching entry from prediction[], using its id, warehouse, courier, and service-level fields.

Select the method offered at checkout. Do not assume the first entry is the right method.

Display the date

Read the selected entry's prediction.earliest_date, latest_date, or most_likely_date.

For "delivery by", use latest_date; for a range, use earliest_date and latest_date from the same entry. Check the HTTP status, success, and a nonempty matching prediction first.

Shopper places the order

Save the displayed ISO date or range, selected method, confirmed destination, and top-level request_id with the order in your system.

Keep the promise shown at checkout. A later prediction must not silently replace that saved promise.

Send the order or tracking to parcelLab

Send a saved single date in mutations[].tracking.announced_delivery_date. For a range, send announced_delivery_date_min and announced_delivery_date_max at the top level of the order payload.

Put the saved request ID in mutations[].tracking.additional_fields.requestID if this custom field is configured for your integration.

The Promise GET request does not save the shopper's selection or attach a promise to an order. Your integration must do this. See Create Orders/Trackings for the authenticated write request and the product flow for a complete field example.

Keep automatic IP locations in temporary page state. Save manual destination choices separately from order data, with an expiry that fits your storefront. A raw API integration does not get the reference widget's automatic 30-day storage. Treat location.zip values of null or "0" as no postal code, and do not infer a confirmed address from location.

Request a new prediction when the destination or selected shipping method changes and before the order is placed. Save ISO dates, not localized display text or the cutoff duration. If no matching prediction is available, let the shopper correct the destination and omit the delivery date.

Choose a Destination

Supply your account ID and exactly one destination: a country with an optional postal code, or the shopper's IPv4 or IPv6 address.

Parameter
Use

account

Required. Your parcelLab account ID. The account must have Promise enabled.

destination_country_iso3

ISO 3166-1 alpha-3 country code, such as DEU. Required unless you supply destination_ip_address.

destination_postal_code

Optional postal code. Requires destination_country_iso3. Keep leading zeros.

destination_ip_address

Shopper's IPv4 or IPv6 address. Do not combine with destination_country_iso3 or destination_postal_code.

fallback_country_iso3

Optional ISO 3166-1 alpha-3 country code, such as USA. Only valid with destination_ip_address.

The existing courier, service_level, warehouse, tag, draft, language_iso2, calibration, dispatch_now, and now_override parameters also apply to IP requests.

Use an IP Address

Before the shopper supplies a delivery address, send their IP address in destination_ip_address. The API does not use request headers to select the destination IP.

For IPv6, use your HTTP client's query-parameter encoder. For example:

Replace YOUR_ACCOUNT_ID with your Promise-enabled account ID and the example IP with the shopper's IP address. Supply an IP address without a hostname, network prefix, or IPv6 scope ID.

IP lookup estimates a location. It does not confirm the delivery address. When the shopper supplies an address, use its country and postal code for the next request and remove the IP and fallback parameters.

Set a Fallback Country

Add fallback_country_iso3 to use a country-level location when the IP cannot resolve or has no matching delivery methods:

The API selects the location as follows:

  1. If the IP location has matching delivery methods, the API uses that location, even when its country differs from the fallback country.

  2. If IP lookup fails or no delivery methods match, the API tries the fallback country. It does not use the IP location's postal code or region for the fallback.

  3. The API generates predictions for the selected methods. If they produce no predictions, the API keeps the selected location and returns an empty prediction array. This does not trigger another fallback.

Account access checks and delivery method filters also apply to the fallback. A fallback country does not guarantee a prediction.

Rate Limits for IP Requests

IP requests have two limits: 60 requests per minute per caller IP, and 60 requests per minute per account and caller IP combination. The caller IP is the address that sends the API request, which can differ from destination_ip_address. Requests from your server can share the same caller limit.

If either limit is exceeded, the API returns HTTP 429 with a Retry-After header. Wait for the specified number of seconds before retrying. Changing the destination IP or account does not bypass the caller-IP limit. Country and postal code requests do not use these IP-specific limits.

Result Structure

For HTTP 200 responses, prediction contains the applicable predictions and location identifies the destination used. The request_id is for tracing and troubleshooting.

For example, if a US fallback location has no matching delivery methods:

Selected Location

The location object applies to both IP and explicit destinations. When the API uses a fallback country, this object contains the country-level fallback location. A selected location can remain present when prediction is empty, including when success is false.

Field
Description

country

Three-letter country code used for prediction. Kosovo uses XKX.

region

Resolved region, such as DE-BY, or the two-letter country code, such as US, for a country-level location.

zip

Postal code as a string. Can be null or "0" for a country-level location.

location is null if no location is available. Clients must accept null.

Predictions

Each entry in the prediction array represents one delivery method, including a delivery prediction like the following structure:

Delivery Prediction Details

The details included in a delivery prediction are described in the following table.

Key
Type
Description

min

Integer

The minimum number of expected courier working days until delivery. Note: The value for minimum and maximum can be equal.

max

Integer

The maximum number of expected courier working days until delivery.

Note: The value for minimum and maximum can be equal.

likely

Integer

The most likely number of expected courier working days until delivery.

send_date

The date of dispatch as per warehouse configuration.

earliest_date

The earliest expected delivery date taking into consideration working days of the courier, holidays in the destination, and warehouse cut-off and handling times.

latest_date

The latest expected delivery date taking into consideration working days of the courier, holidays in the destination, and warehouse cut-off and handling times.

most_likely_date

The most likely individual date of delivery.

earliest_locale

Defaults to dddd, MMM DDD, YYYY

Localized representations of the earliest expected delivery date in the specified format.

latest_locale

Defaults to dddd, MMM DDD, YYYY

Localized representations of the latest expected delivery date in the specified format.

most_likely_locale

Defaults to dddd, MMM DDD, YYYY

Localized representations of the most likely delivery date in the specified format.

cutoff

Integer

The time in minutes until cut-off for the estimated delivery dates.

cutoff_locale

String

Localized representations of the cut-off. Can be used within a sentence like "Order within [2 hours | an hour | 20 minutes] to receive your order by [Saturday, Mar 23rd, 2022]".

Sample Calls

The sample API calls below show different information in the request (for example: home delivery as the courier service type) for the delivery prediction.

Request: GET https://api.parcellab.com/v4/promise/prediction/predict/?account=1612197&destination_country_iso3=DEU

Example response:

Request: GET https://api.parcellab.com/v4/promise/prediction/predict/?account=1612197&destination_country_iso3=DEU&destination_postal_code=80469

Example response:

Request: GET https://api.parcellab.com/v4/promise/prediction/predict/?account=1612197&destination_country_iso3=USA&service_level=home-delivery

Example response:

Errors and Empty Results

HTTP status
Meaning

400

Invalid request. Examples include a missing or invalid destination, both country and IP destinations, a postal code without a country, an invalid fallback country, or a fallback without an IP destination.

404

IP lookup could not resolve a valid location and no fallback country was supplied.

429

An IP request rate limit was exceeded. Follow the Retry-After header.

200 with an empty prediction array

A location was selected, but no delivery methods matched or the selected methods produced no predictions. Do not display a delivery date.

Validation and rate-limit errors use the v4 errors array. Errors from the prediction service retain their original HTTP status and JSON fields. These responses can use requestId instead of request_id. For example, an unresolved IP request can return HTTP 404 with:

Calculating Delivery Dates for Orders with Known Dispatch Date

For orders where you know the actual dispatch date, you can calculate accurate delivery dates based on when the order will ship. This is useful for scenarios where:

  • An order's dispatch date is confirmed after placement

  • You need to provide customers with updated delivery expectations based on actual shipment dates

  • Customer service agents need to communicate accurate timelines for existing orders

How It Works

To calculate a delivery date for an already placed order when you know the dispatch date, use these two parameters together:

  1. now_override=<date> - set this to the known dispatch date/time in ISO 8601 UTC format (for example: 2025-07-01T16:00:00.000Z)

  2. dispatch_now=true - this forces the API to skip warehouse cutoff calculations and calculate the delivery date as if the parcel ships at the exact time specified in now_override

When using dispatch_now=true with a specific now_override value for already placed orders, the cutoff will be 0 as you're bypassing warehouse calculations and calculating delivery based on the known dispatch time.

Testing Your Promise Configuration

To preview saved but unpublished changes to your Promise configuration in a staging environment:

  1. Integrate the Promise API call to your staging environment.

  2. Add the query parameter &draft=true to your Promise API call.

This will generate a promise date based on your unpublished Promise configuration, that can be used to review the effect of any configuration updates on the frontend of your staging environment.

Last updated

Was this helpful?