# Track Shipment

The `track shipment` endpoint allows you to check the current status of your shipment and provides a detailed breakdown of its journey, including timestamps for each stage of the shipping process. This helps you monitor the progress and stay informed about the delivery timeline.

## Requests

### Parameter

The request includes a parameter called `reference`, where you specify the reference of the shipment you wish to track. For example, use the following endpoint format:

`https://delivery-staging.apiideraos.com/api/v2/token/shipment/track/{reference}`

Replace `{reference}` with the actual shipment reference you received after booking the shipment. This reference is required to accurately identify and track your shipment.

### Request Sample

{% tabs %}
{% tab title="Curl" %}

```javascript
curl --location 'https://delivery-staging.apiideraos.com/api/v2/token/shipment/track/epbiphgvo0' \
--header 'Authorization: Bearer Secret Key'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://delivery-staging.apiideraos.com/api/v2/token/shipment/track/epbiphgvo0"

payload = {}
headers = {
  'Authorization': 'Bearer Secret Key'
}

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

print(response.text)

```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require "uri"
require "net/http"

url = URI("https://delivery-staging.apiideraos.com/api/v2/token/shipment/track/epbiphgvo0")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer Secret Key"

response = https.request(request)
puts response.read_body

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://delivery-staging.apiideraos.com/api/v2/token/shipment/track/epbiphgvo0',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer Secret Key'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Javascript" %}

```javascript
const myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer Secret Key");

const requestOptions = {
  method: "GET",
  headers: myHeaders,
  redirect: "follow"
};

fetch("https://delivery-staging.apiideraos.com/api/v2/token/shipment/track/epbiphgvo0", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

{% endtab %}

{% tab title="Golang" %}

```go
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://delivery-staging.apiideraos.com/api/v2/token/shipment/track/epbiphgvo0"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "Bearer Secret Key")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}
{% endtabs %}

### Response Sample

{% tabs %}
{% tab title="404" %}

```json
{
    "data": null,
    "status": false,
    "message": "Shipment with reference - epbiphgvo0 not found",
    "status_code": 404
}
```

{% endtab %}

{% tab title="200" %}

```json
{
    "data": {
        "current_status": "In Progress",
        "status_history": [
            {
                "status": "Picked Up",
                "timestamp": "2024-09-18 14:24:43"
            },
            {
                "status": "In Progress",
                "timestamp": "2024-09-18 14:25:13"
            }
        ]
    },
    "status": true,
    "message": "Shipment Status Retrieved",
    "status_code": 200
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.goshiip.com/api-references/track-shipment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
