API Documentation



Rates

The Rates API will provide you with the Carrier's published rate (as well as the Secureship shipping rates if applicable) for a variety of carriers such as: FedEx, UPS, PTC, CanadaPost, Purolator, etc.

Quick Links
POST /webship/api/rates

Get the shipping rates for a variety of carriers
ApiKey
{ "ApiKey": "APIKEY" }

The API key for your account.
 
AccountNumber
{ "AccountNumber": "ZZZZZ" }

Your Secureship account number.
 
Username
{ "Username": "user@mycompany.com" }

The username you use to log into your Secureship account.
 
ReturnSampleData
{ "ReturnSampleData": "true" }

Sample data is returned (significantly faster and best for testing).
 
ShipDateTime
{ "ShipDateTime": "2015-08-13T15:59:00"}

Date and time the package will ship.
 
CurrencyCode
{ "CurrencyCode": "CAD" }

The three letter code (ISO 4217) for the currency used for insurance and other fields requiring a monetary value.
 
FromAddress
{ "PostalCode": "K2B8S6" }
{ "City": "Ottawa" }
{ "CountryCode":"CA" }
{ "Residential": false }

The partial ship from address of your shipment

CountryCode: The ISO 3166-1 alpha-2 two-letter country code for the country.
 
ToAddress
{ "PostalCode": "90210" }
{ "City": "Beverly Hills" }
{ "CountryCode":"US" }
{ "Residential": true }

The partial destination address of your shipment.

CountryCode: The ISO 3166-1 alpha-2 two-letter country code for the country.

PostalCode: For destinations that do not have a postal code, you may need to enter '0000' or '00000' depending on the requested number of digits.
 
PackageType
{ "PackageType": "MyPackage" }

The type of package being used.
  • MyPackage: Selected when you use your own box
  • Envelope: When the package type used is an envelope provided by the carrier. It will say 'UPS Envelope' or 'FedEx Envelope' on it.
  • Pak: When the package type used is a Pak provided by the carrier. It will say 'UPS Pak' or 'FedEx Pak' on it.
 
Packages
{ "Packages": [
{
  "Weight": 1.5,
  "WeightUnits": "KGS"
},
{
  "Weight": 5,
  "WeightUnits": "LBS",
  "Length": 1,
  "Width": 1,
  "Height": 1,
 "DimensionUnits": "INCHES",
 "Insurance": 100,
  "AdditionalHandling": true,
  "SignatureOption": "SignatureRequired"
} ]
}

List of packages containing the weights, sizes, and additional package options.

WeighUnits: The weight units used.
  • LBS
  • KGS
DimensionUnits: The dimensional units used.
  • INCHES
  • CM
Insurance: The requested amount of insurance for this package and is based on the currency specified in CurrencyCode above.

To ensure proper coverage, insurance is specified at the package level and not the shipment level.

Note: Every carrier has different insurance limitations. Please be sure to verify the insurance limitations prior to insuring and shipping your packages.

AdditionalHandling: Specify if the package requires additional handling. Additional handling normally applies to packages not encased in a cardboard box.
  • True
  • False
SignatureOption: Specify if the package requires a signature.
  • None
  • SignatureRequired
  • AdultSignatureRequired - This option is not always available and will vary by carrier and destination.
 
AdditionalHandling
{ "AdditionalHandling": 4.5 }

The additional handling surcharge applied to the shipment.
 
BaseRate
{ "BaseRate": 290.84 }

The carrier's base shipping rate.
 
CarrierCode
{ "CarrierCode": 0 }

Indicates which carrier is associated to the returned shipping rates.
  • 0 - UPS
  • 1 - FedEx
  • 8 - Personal Touch Courier
  • 9 - CanadaPost
 
CurrencyCode
{ "CurrencyCode": "CAD" }

The three letter currency code (ISO 4217) for all monetary values.
 
CutoffTime
{ "CutoffTime": "2015-08-02T12:00:00.0000000" }

The latest time at which a carrier must be told that you need a pickup in order to get a same day pickup. If no pickup time is returned, it means that the carrier does not provide pickups at that location.
 
EAS
{ "EAS": {
{
  "BeyondOrigin": 0,
  "BeyondDestination":10
}
}

The extended area surcharge (EAS) applicable to the shipment. It could be based on the ship from location (BeyondOrigin) or the destination (BeyondDestination)
 
FuelPercentage
{ "FuelPercentage": 14.50 }

The fuel surcharge percentage applicable to this shipment.
 
FuelSurcharge
{ "FuelSurcharge": 42.54 }

The fuel surcharge that is applicable to this shipment.
 
Insurance
{ "Insurance":
{
  "PricePerUnit": 2.10,
  "UnitAmount":100
  "FreeAmount":100
  "TotalCost":4.20
  "Minimum":0
}
}

A detailed breakdown of the insurance cost that is applicable to this shipment.
 
LargePackage
{ "LargePackage": 0}

The large package surcharge that is applicable to this shipment.
 
LongTNT
{ "LongTNT": "Fri Aug 02 2015 by 12:00 PM" }

A more user friendly version of the TNT.
 
PickupCharge
{ "PickupCharge": 0 }

If the carrier charges extra for a pickup, the amount will be shown here.
 
Residential
{ "Residential": 2.10 }

The residential surcharge applied to the shipment.
 
ServiceCode
{ "ServiceCode": 0 }

Indicates which service level is associated to the returned shipping rates.
  • 0 - UPS Express Early A.M. / UPS Express Plus
  • 1 - UPS Express
  • 2 - UPS Express Saver
  • 3 - UPS Expedited
  • 4 - UPS 3 Day Select
  • 5 - UPS Standard / UPS Ground
  • 6 - UPS 2nd Day Air AM
  • 7 - UPS 2nd Day Air
  • 10 - FedEx First Overnight / FedEx Priority First
  • 11 - FedEx Priority Overnight / FedEx Priority
  • 12 - FedEx 2Day
  • 13 - FedEx Ground
  • 80 - PTC Personal
  • 81 - PTC Rush
  • 82 - PTC Non-Rush
  • 83 - PTC Direct Drive
  • 90 - CanadaPost Priority
  • 91 - CanadaPost XpressPost
  • 92 - CanadaPost Expedited Parcel
  • 93 - CanadaPost Parcel
  • 94 - CanadaPost International Parcel Air
  • 95 - CanadaPost International Parcel Surface
 
ServiceName
{ "ServiceName": "UPS Express Early AM " }

Indicates the carrier friendly service name.
 
Signature
{ "Signature": 4.5 }

The signature surcharge applied to the shipment.
 
SubTotal
{ "SubTotal": 347.98 }

The shipping rate before local taxes ie. before GST/HST
 
Tax
{ "Tax": 10.00 }

The tax amount for the shipment ie. GST/HST. Duty amount for international orders are not available through Secureship and are not included in this amount.
 
TCW
{ "TCW": {
{
  "Weight": 15,
  "WeightUnits": 0
}
}

TCW is the Total Chargeable Weight (TCW) or Billable Weight that the carrier will charge based on the weight and size of your packages.
 
Total
{ "Total": 347.98 }

The total shipment cost including local taxes ie. GST/HST. Duty amount for international orders are not available through Secureship and are not included in this amount.
 
TNT
{ "TNT": "2015-08-02T12:00:00.0000000" }

TNT is the time in transit (TNT) and is the estimated delivery date based on the shipment information provided.
 
TypeOfRate
{ "TypeOfRate": 0 }

Indicates which type of shipping rate is being returned.
  • 0 - Published Rates
  • 1 - Secureship Rates
 
POST
/webship/api/rates
Get the shipping rates for a variety of carrier
Sample
POST /webship/api/rates
{
"ApiKey": "api123",
"CurrencyCode":"CAD",
"AccountNumber": "123456",
"Username": "user@mycompany.com",
"ReturnSampleData": "true",
"ShipDateTime": "2015-08-13T15:59:00",
"BillingPostalCode": "K2B8S6",
"FromAddress": {
"PostalCode": "K2B8S6",
"City": "Ottawa",
"CountryCode":"CA",
"Residential": false
},
"ToAddress": {
"PostalCode": "90210",
"City": "Toronto",
"CountryCode":"US",
"Residential": true
},
"PackageType":"MyPackage",
"Packages": [
{
"Weight":1.5,"WeightUnits":"KGS"
},
{
"Weight":"5",
"WeightUnits":"LBS",
"Length":1,
"Width":1,
"Height":1,
"DimensionUnits":"INCHES",
"Insurance":100,
"AdditionalHandling":true,
"SignatureOption":"SignatureRequired"
}
]
}

Response:
{
"Rates": [
{
"CarrierCode": 0,
"ServiceCode": 1,
"ServiceName": "UPS Express Saver",
"TypeOfRate": 0,
"BaseRate": 40,
"SubTotal": 53.1,
"Tax": 0,
"Total": 53.1,
"FuelSurcharge": 4,
"FuelPercentage": 10,
"RateZone": "400",
"EAS": {
"BeyondOrigin": 0,
"BeyondDestination": 10
},
"TNT": "2015-08-02T12:00:00.0000000",
"CutoffTime": "2015-08-01T17:00:00.0000000",
"LongTNT": "Fri Aug 02 2015 by 12:00 PM",
"TCW": {
"Weight": 10,
"WeightUnits": 0
},
"PickupCharge": 0,
"CurrencyCode": "USD",
"Residential": 1.8,
"Signature": 3.1,
"AdditionalHandling": 8,
"LargePackage": 0,
"Insurance": {
"PricePerUnit": 2.1,
"UnitAmount": 100,
"FreeAmount": 100,
"TotalCost": 4.2,
"Minimum": 0
}
},
{
"CarrierCode": 1,
"ServiceCode": 11,
"ServiceName": "FedEx Priority Overnight",
"TypeOfRate": 0,
"BaseRate": 40,
"SubTotal": 53.1,
"Tax": 0,
"Total": 53.1,
"FuelSurcharge": 4,
"FuelPercentage": 10,
"RateZone": "1",
"EAS": {
"BeyondOrigin": 0,
"BeyondDestination": 10
},
"TNT": "2015-08-02T12:00:00.0000000",
"CutoffTime": "2015-08-01T17:00:00.0000000",
"LongTNT": "Fri Aug 02 2015 by 12:00 PM",
"TCW": {
"Weight": 10,
"WeightUnits": 0
},
"PickupCharge": 0,
"CurrencyCode": "CAD",
"Residential": 1.8,
"Signature": 3.1,
"AdditionalHandling": 8,
"LargePackage": 0,
"Insurance": {
"PricePerUnit": 2.1,
"UnitAmount": 100,
"FreeAmount": 100,
"TotalCost": 4.2,
"Minimum": 0
}
},
{
"CarrierCode": 8,
"ServiceCode": 82,
"ServiceName": "PTC Non rush",
"TypeOfRate": 0,
"BaseRate": 40,
"SubTotal": 53.1,
"Tax": 0,
"Total": 53.1,
"FuelSurcharge": 4,
"FuelPercentage": 10,
"RateZone": "5",
"EAS": {
"BeyondOrigin": 0,
"BeyondDestination": 10
},
"TNT": "2015-08-02T12:00:00.0000000",
"CutoffTime": "2015-08-01T17:00:00.0000000",
"LongTNT": "Fri Aug 02 2015 by 12:00 PM",
"TCW": {
"Weight": 10,
"WeightUnits": 0
},
"PickupCharge": 0,
"CurrencyCode": "CAD",
"Residential": 1.8,
"Signature": 3.1,
"AdditionalHandling": 8,
"LargePackage": 0,
"Insurance": {
"PricePerUnit": 2.1,
"UnitAmount": 100,
"FreeAmount": 100,
"TotalCost": 4.2,
"Minimum": 0
}
},
{
"CarrierCode": 9,
"ServiceCode": 92,
"ServiceName": "Canadapost Expedited",
"TypeOfRate": 0,
"BaseRate": 40,
"SubTotal": 53.1,
"Tax": 0,
"Total": 53.1,
"FuelSurcharge": 4,
"FuelPercentage": 10,
"RateZone": "5",
"EAS": {
"BeyondOrigin": 0,
"BeyondDestination": 10
},
"TNT": "2015-08-02T12:00:00.0000000",
"CutoffTime": "2015-08-01T17:00:00.0000000",
"LongTNT": "Fri Aug 02 2015 by 12:00 PM",
"TCW": {
"Weight": 5,
"WeightUnits": 1
},
"PickupCharge": 0,
"CurrencyCode": "CAD",
"Residential": 1.8,
"Signature": 3.1,
"AdditionalHandling": 8,
"LargePackage": 0,
"Insurance": {
"PricePerUnit": 2.1,
"UnitAmount": 100,
"FreeAmount": 100,
"TotalCost": 4.2,
"Minimum": 0
}
}
],
"Status": "OK",
"Messages": [ "Successful" ]
}
 
> curl -X POST https://secureship.ca/webship/api/rates --data "[insert your json here]"
>
or
> curl -X POST https://secureship.ca/webship/api/rates --data @datafile.json
>
string jsonData = "...";
WebClient request = new WebClient();
request.Encoding = System.Text.Encoding.UTF8;
var results = request.UploadString(new Uri(RATING_URL), "POST",jsonData);
System.Diagnostics.Debug.WriteLine(results);
// Create the web request
HttpWebRequest request = WebRequest.Create(RATING_URL) as HttpWebRequest;

// Set type to POST
request.Method = "POST";
request.ContentType = "application/x‐www‐form‐urlencoded";

System.Text.StringBuilder data = new System.Text.StringBuilder();
data.Append(System.IO.File.ReadAllText(@"yourfile.json"));

byte[] byteData = System.Text.UTF8Encoding.UTF8.GetBytes(data.ToString());

// Set the content length in the request headers
request.ContentLength = byteData.Length;

// Write data
using (System.IO.Stream postStream = request.GetRequestStream())
{
postStream.Write(byteData, 0, byteData.Length);
}

// Get response
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
// Get the response stream
System.IO.StreamReader reader = new
System.IO.StreamReader(response.GetResponseStream());

// Console application output
System.Diagnostics.Debug.WriteLine(reader.ReadToEnd());
}
<?php
$username = ' ';
$apikey = ' ';
$json = “insert your json code here”;
$ch = curl_init($RATING_URL);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$json");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Basic " .
base64_encode($username . ":" . $apikey)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
echo $output;
curl_close($ch);
?>
Click for the BBB Business Review of Secureship, an Online Shipping Broker in Ottawa ON
© 2007-2017 Secureship Inc. - An Easier Way to Ship