Welcome to the Weels API

Weels allows you to create same-day or next-day delivery orders quickly and affordably. No volume commitments and ultra-reliability. Get your free account today and wow your customers.

Our shipping API allows you to instantly obtain a rate quote and to create labels. Follow the instructions below and get started now!

Authentication

  • The API expects the API token to be included in all API requests as the X-Weels-Access-Token header. You can obtain your API Token by navigating to www.weels.ca/account/settings
1594
$headers = array(
	'Content-Type: application/json',
 	'X-Weels-Access-Token: [API Token]'
);

📘

You must replace [API Token] with your personal API Token

Get a rate with PHP

$url = "https://www.weels.ca/api/rates";
$fields = array(
	"postal_code" => $postalCode,
); 
 $fi = json_encode($fields);

$headers = array(
          'Content-Type: application/json',
          'X-Weels-Access-Token: [API TOKEN]'
);
    
$req = curl_init();    
    
curl_setopt($req,CURLOPT_POST, true);
curl_setopt($req,CURLOPT_HTTPHEADER, $headers);
curl_setopt($req,CURLOPT_RETURNTRANSFER, true);
curl_setopt($req,CURLOPT_FAILONERROR, false);
curl_setopt($req, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($req, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
curl_setopt($req, CURLOPT_URL,$url);
curl_setopt($req, CURLOPT_POSTFIELDS, $fi);

$server_output = curl_exec($req);

$str = json_decode($server_output);

Mapping the response to variables in PHP

$response = json_decode($str);

$expected = $response->rates[0]->expected;
$service_type = $response->rates[0]->{'service_type'};
$base = $response->rates[0]->price->base;
$hst = $response->rates[0]->price->hst;
$pst = $response->rates[0]->price->pst;
$total = $response->rates[0]->price->total;

Have questions? email [email protected]!