E-Commerce Shipping APIs
Uses include:
- Freight forwarders securely accessing their own buy or sell rates.
- E-commerce web sites providing buyers with a shipping estimate (to help buyers arrange their own shipping)
- E-commerce web sites providing shipping as a service which is added to the shopping cart and then arranged by the vendor
Shipping Estimates API for marketplace
Freightos has a single API at /api/shippingCalculator
for obtaining quotes and/or a summary of quote estimates.
The API supports GET using simple URL parameters, or POST of an XML for more sophisticated quote requests.
It may be accessed at https://ship.freightos.com/api/shippingCalculator
for public marketplace rates or at https://yourCustomFreightosSite.freightos.com/api/shippingCalculator
using an appropriate secure API key for private rates from Custom Sites.
GET public quote estimates from the Freighots marketplace
Here are some live links to GET freight estimates from the Freightos marketplace. No API key is required to get this price range data, but you must use this data in accordance with Freightos terms of service including a clearly visible credit for Freightos and link to https://ship.freightos.com.
GET public rate estimates with JSON response example: door-to-door boxes
GET public rate estimates with XML response example: port-to-port container
XML/JSON responses for price estimates from the marketplace
<?xml version="1.0" encoding="UTF-8"?><response> <!--© Tradeos Ltd ("Freightos"), all rights reserved except those explicitly granted in the publically posted terms of service. This API is in beta.--> <estimatedFreightRates numQuotes="1"> <mode mode="FCL"> <price> <min> <moneyAmount amount="3262" currency="USD"/> </min> <max> <moneyAmount amount="3554" currency="USD"/> </max> </price> <transitTimes unit="days"> <min>17</min> <max>21</max> </transitTimes> </mode> </estimatedFreightRates> </response>
{"response": { "estimatedFreightRates": { "numQuotes": "1", "mode": { "price": { "min": {"moneyAmount": { "amount": "3262", "currency": "USD" }}, "max": {"moneyAmount": { "amount": "3554", "currency": "USD" }} }, "transitTimes": { "min": "17", "unit": "days", "max": "21" }, "mode": "FCL" } } }}
XML public estimator quote requests
The XML POST provides more options in the quote request compared to the GET
Generate your own XML Quote Request
Private quote requests from your Custom Site
This section is only for Freightos SaaS subscribers with their own site yourCustomDomain.freightos.com
.
Obtaining an API key
Business admins with their own Freightos Custom Site may obtain an API key and manage API keys here.
Keep your API key safe and attach it to API GET and POST requests using the key
parameter. Always submit over HTTPS only.
If you feel your API key could have been compromised, immediately ask your business admin to revoke it and create a new one.
Shipping quotes API for Custom Sites
Private GET request
GET: JSON Response Example (add your API key)
GET: XML Response Example (add your API key)
Limitations of the GET
For now GET does not support accessorials, future pickup dates etc.
XML POST request
XML schema for quote requestXML quote request generator
You can also use the XML quote request generator tool to create valid XML quote requests using the familiar Freightos quote request web user interface.
Test XML Post quote request
Generate your own XML sample
Parameters Details
Parameter Name | Type | Description | More Infor |
request | String | Body string parameters that represents the quote request xml | Quote request xml string should be validated by the QuoteRequest XML Schema.
or can be generated using the tool at https://yourdomain.freightos.com/#!freightTrade/FreightRFQOnBehalfOfCustomerXMLer/new
|
apiKey | String | apiKey used for authentication | A key that can be generated to grant access for the API |
XML response
Errors
If the call is successful but there are some error messages or warnings, these will be placed in an
<errors>
element immediately within the <response>
e.g.
<?xml version="1.0" encoding="UTF-8"?> <response> <quotes number="0"/> <errors>Some services have per-unit fees - to see more quotes please specify the exact load (not just the total weight and volume). </errors> </response>
JSON response
Shipping estimates widget
The shipping estimate widget allows buyers on your e-commerce site to get an estimate for shipping the goods to buyer's own location. A couple of lines in your web page, next to each product, tell Freightos the dimensions of the product, and where it is shipped from, and Freightos does the rest.
Custom HTML element for button and popup
The custom html element is the simplest wayPlace the following once anywhere in your page, can be at the end (if you already have JQuery 1.11 or better, skip that line).
<script src="https://ship.freightos.com/js/jquery-1.11.1.min.js"></script>
<script src="https://ship.freightos.com/api1/freightosShippingCalculator.js"></script>
For default styling, place the following in <head>
:
Place this after each product which should have a shipping calculator button, adding XML attributes instead of URL parameters.
IFrame
Another way to embed shipping estimates is via an iframe. In the following example a button opens a popup which contains the following code for estimating shipping from Shanghai, China to the user's location
E-commerce integration
Magento - coming soon
URL and custom XML element parameters
URL Parameters used in estimator and calculator GET (Case sensitive)
estimate | Set to true for a super-fast rate estimate with coverage of most of the world | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
currency | Used only with estimate=true . Set to a three letter currency code like CNY, GBP. Default is USD. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
origin | Any address recognized by Google maps / three letter airport code / 5 letter UN seaport code (for FOB). Required. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
destination | Any address recognized by Google maps e.g. a zip code "10002" or street address / three letter IATA airport code / 5 letter UN seaport code. Optional - if omitted, Freightos will use GEO-IP to use a city near the caller as destination (useful for e-commerce). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
weight | Weight per load unit (or total weight if no quantity specified). Double. Optional for containers, otherwise required. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
width | Width in cm. Optional for containers, for standardized pallets, or if volume is specified. Otherwise required. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
length | Length. See not below on lengths. Optional for containers, for standardized pallets, or if volume is specified. Otherwise required. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
height | Height in cm. Optional for containers, or if volume is specified. Otherwise required. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
volume | Volume in CBM. Optional for containers, or if w, l, h, all specified (also for a standardized pallet if h specified). Otherwise required. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
quantity | Number of load units. Integer. Optional, default 1. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
hazardCode | If hazardous, specify the 4-digit UN Number, or multiple comma-separated UN Numbers (or can use hazardCode=xxxx if hazardous but unknown code) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mode | Restrict searches to a specific mode. Values: air, LCL, FCL, LTL, FTL, express. Optional. Note that full containers will automatically only match FTL and FCL. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
format | xml orjson . Default is JSON for GET and XML for POST. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
priceLevel | For custom sites only, the Price Level defined by pricing managers here. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
resultSet | all (default) or cheapestEachMode . cheapestEachMode is recommended - only with this option do you received binding quote with a quote ID and URL | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
saveThisQuote | saves a specific quote to your site and equires resultSet=cheapestEachMode and mode=(e.g LTL) to be included in the request params. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rFQType |
NETWORK for marketplace rates (this is the only option on ship.freightos.com )
ON_BEHALF_OF_CUSTOMER for private sell rates on Custom SitesBUY_PRICE_LOOK_UP to look up buy rates on a Custom Site
BUY_FROM_TENANT To look up web site ready sell rates on a Custom Site.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
apiKey | Valid API Key. Keep your API key safe and never embed it in any way in your web site/client. Send over HTTPS only. Required for Calculator, optional for Estimator. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
loadtype |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
displayorigin | The origin to show the customer. E.g. origin might be a specific address in Shanghai, China, while displayorigin can be "China". Optional - defaults to origin. Blank to show no origin. For Widget only |
General
- Numbers always use
.
as a decimal point and never contain any comma,
- Lengths are by default in centimeters
cm
. You may append any of[cm, inch, m, km, mile]
e.g.width=30inch
. - Volumes are by default in cubic centimeters (ccm also known as cc or ml). You may append any of
[ccm, liter, cbm, cft, cbi, wm]
e.g.width=30inch
. - Weights are by default in kilograms
kg
. You may append any of[kg, ton, lb, oz, wm]
e.g.width=30inch
.
Quotas
Any given IP address may only call any Freightos API 100 times in any hour. Contact Freightos if you need a higher quota.