Skip to content

Tracking

The /tracks endpoint is used to retrieve the status of a shipment. This is usefull to provide great user experience as to inform them of the current progression of the shipment. You need to provide a carrier shipment number.

Get a package current status

Make a simple GET /v1/tracks/[carrier]/[tracking_number]

curl --request GET \
  --url 'https://api.purplship.com/v1/tracks/ups/1Z12345E1305277940?=' \
  --header 'authorization: Token <your api token>'
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.purplship.com/v1/tracks/ups/1Z12345E1305277940',
  qs: { '': '' },
  headers: { authorization: 'Token <your api token>' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
import requests

url = "https://api.purplship.com/v1/tracks/ups/1Z12345E1305277940"

querystring = {"":""}

payload = ""
headers = {'authorization': 'Token <your api token>'}

response = requests.request("GET", url, data=payload, headers=headers, params=querystring)

print(response.text)
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.purplship.com/v1/tracks/ups/1Z12345E1305277940');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString(array(
  '' => ''
)));

$request->setHeaders(array(
  'authorization' => 'Token <your api token>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Response

{
    "errors": [],
    "tracking": {
        "carrier": "UPS",
        "events": [
            {
                "code": "OR",
                "date": "20100505",
                "description": "ORIGIN SCAN",
                "location": "GRAND JUNCTION AIR S",
                "signatory": null,
                "time": "010000"
            }
        ],
        "shipment_date": null,
        "tracking_number": "1Z12345E1305277940"
    }
}

Get multiple packages current statuses

Make a simple POST /v1/tracks/[carrier]

curl --request POST \
  --url https://api.purplship.com/v1/tracks \
  --header 'authorization: Token <your api token>' \
  --header 'content-type: application/json' \
  --data '{
    "tracking_numbers": [
        "1Z12345E1305277940",
        "1Z12345E1505270452",
        "1Z12345E6205277936"
    ],
    "carriers": ["fedex", "ups"]
}'
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.purplship.com/v1/tracks',
  headers: 
   { authorization: 'Token <your api token>',
     'content-type': 'application/json' },
  body: 
   { tracking_numbers: 
      [ '1Z12345E1305277940',
        '1Z12345E1505270452',
        '1Z12345E6205277936' ],
     carriers: [ 'fedex', 'ups' ] },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
import requests

url = "https://api.purplship.com/v1/tracks"

payload = """{
    tracking_numbers: [
        '1Z12345E1305277940',
        '1Z12345E1505270452',
        '1Z12345E6205277936'
    ],
    carriers: [ 'fedex', 'ups' ]
}
"""
headers = {
    'content-type': "application/json",
    'authorization': "Token <your api token>"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
    "tracking_numbers": [
        "1Z12345E1305277940",
        "1Z12345E1505270452",
        "1Z12345E6205277936"
    ],
    "carriers": ["fedex", "ups"]
}');

$request->setRequestUrl('https://api.purplship.com/v1/tracks');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Token <your api token>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Retrieve a shipment from unknown carrier

Make a simple POST /v1/tracks

curl --request POST \
  --url https://api.purplship.com/v1/tracks \
  --header 'authorization: Token <your api token>' \
  --header 'content-type: application/json' \
  --data '{
    "tracking_numbers": [
        "1Z12345E1305277940",
        "1Z12345E1505270452",
        "1Z12345E6205277936"
    ]
}'
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.purplship.com/v1/tracks',
  headers: 
   { authorization: 'Token <your api token>',
     'content-type': 'application/json' },
  body: 
   { tracking_numbers: 
      [ '1Z12345E1305277940',
        '1Z12345E1505270452',
        '1Z12345E6205277936' ] },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
import requests

url = "https://api.purplship.com/v1/tracks"

payload = """{
    tracking_numbers: [
        '1Z12345E1305277940',
        '1Z12345E1505270452',
        '1Z12345E6205277936'
    ]
}
"""
headers = {
    'content-type': "application/json",
    'authorization': "Token <your api token>"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
    "tracking_numbers": [
        "1Z12345E1305277940",
        "1Z12345E1505270452",
        "1Z12345E6205277936"
    ]
}');

$request->setRequestUrl('https://api.purplship.com/v1/tracks');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Token <your api token>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Multi track response

{
    "errors": [
        {
            "carrier": "UPS",
            "code": "151044",
            "message": "No tracking information available"
        }
    ],
    "trackings": [
        {
            "carrier": "UPS",
            "events": [
                {
                    "code": "KB",
                    "date": "20100830",
                    "description": "UPS INTERNAL ACTIVITY CODE",
                    "location": "BONN",
                    "signatory": null,
                    "time": "103900"
                },
                {
                    "code": "DJ",
                    "date": "20100830",
                    "description": "ADVERSE WEATHER CONDITIONS CAUSED THIS DELAY",
                    "location": "BONN",
                    "signatory": null,
                    "time": "103200"
                },
                {
                    "code": "X",
                    "date": "20100910",
                    "description": "THE RECEIVER'S LOCATION WAS CLOSED ON THE 2ND DELIVERY ATTEMPT. A 3RD DELIVERY ATTEMPT WILL BE MADE",
                    "location": "ANYTOWN",
                    "signatory": null,
                    "time": "180300"
                },
                {
                    "code": "FS",
                    "date": "20100912",
                    "description": "DELIVERED",
                    "location": "ANYTOWN",
                    "signatory": null,
                    "time": "115700"
                },
                {
                    "code": "PU",
                    "date": "20100404",
                    "description": "PICKUP SCAN",
                    "location": "WEST CHESTER-MALVERN",
                    "signatory": null,
                    "time": "144000"
                },
                {
                    "code": "KB",
                    "date": "20100830",
                    "description": "UPS INTERNAL ACTIVITY CODE",
                    "location": "BONN",
                    "signatory": null,
                    "time": "131300"
                }
            ],
            "shipment_date": null,
            "tracking_number": "1Z12345E6205277936"
        },
        {
            "carrier": "UPS",
            "events": [
                {
                    "code": "OR",
                    "date": "20100505",
                    "description": "ORIGIN SCAN",
                    "location": "GRAND JUNCTION AIR S",
                    "signatory": null,
                    "time": "010000"
                }
            ],
            "shipment_date": null,
            "tracking_number": "1Z12345E1305277940"
        }
    ]
}

Tip

Visit the API reference for further details about the request parameters.