# How to Import Tracking Codes

**URL:** <https://community.shiphero.com/t/how-to-import-tracking-codes/245>\
**Category:** GraphQL API\
**Created:** [November 26, 2019, 11:35pm UTC](https://community.shiphero.com/t/how-to-import-tracking-codes/245 "2019-11-26T23:35:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazdamx](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/mazdamx/32/73_2.png) [@mazdamx](https://community.shiphero.com/u/mazdamx)\
**Post date:** [November 26, 2019, 11:35pm UTC](https://community.shiphero.com/t/how-to-import-tracking-codes/245/1 "2019-11-26T23:35:41Z")

</div>

Hi Everyone:

Is there a way in the API to import the tracking URL? [https://www.screencast.com/t/QaX8qscoXcJK](https://www.screencast.com/t/QaX8qscoXcJK)

Thanks,  
Brad

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [November 27, 2019, 1:55pm UTC](https://community.shiphero.com/t/how-to-import-tracking-codes/245/2 "2019-11-27T13:55:08Z")

</div>

HI @mazdamx!  
If you use a valid carrier (for example UPS) and with the shipment\_create mutation, in the label, you can specify the tracking number and it should be linked to UPS URL.  
For example, I used this mutation and it worked:

```
mutation {
  shipment_create(
    data: {
      address: {
        name: "Tom Test"
        address1: "add1"
        city: "NY"
        zip: "10920"
        country: "US"
        state: "NY"
      }
      line_items: { line_item_id: "<LINE ITEM ID>", quantity: 1 }
      order_id: "<ORDER ID>"
      warehouse_id: "<WAREHOUSE ID>"
      labels: {
        dimensions: {
          weight: "1.00"
          height: "1.00"
          width: "1.00"
          length: "1.00"
        }
        carrier: "UPS"
        shipping_name: "Custom Status"
        shipping_method: "UPS Ground"
        cost: "0.00"
        line_item_ids: "<LINE ITEM ID>"
        address: {
          name: "Tom Test"
          address1: "add1"
          city: "NY"
          zip: "10920"
          country: "US"
          state: "NY"
        }
        label: {
          pdf_location: "<PDF OF THE LABEL>"
        }
        tracking_number: "123456789"
      }
    }
  ) {
    request_id
    complexity
  }
}

```

And when I did this, the tracking number got linked to the USP Tracking site.  
Let me know if this works for you,  
Thanks!  
Tom

---

<div class="post-metadata">

**Author:** ![mazdamx](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/mazdamx/32/73_2.png) [@mazdamx](https://community.shiphero.com/u/mazdamx)\
**Post date:** [November 27, 2019, 6:18pm UTC](https://community.shiphero.com/t/how-to-import-tracking-codes/245/3 "2019-11-27T18:18:22Z")

</div>

OK we will give it a shot. Thank you Tom!!

---

<div class="post-metadata">

**Author:** ![mazdamx](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/mazdamx/32/73_2.png) [@mazdamx](https://community.shiphero.com/u/mazdamx)\
**Post date:** [November 28, 2019, 8:28am UTC](https://community.shiphero.com/t/how-to-import-tracking-codes/245/4 "2019-11-28T08:28:12Z")

</div>

Tom, what we actually want is send a customer his shipment tracking URL. So how can we query that URL via API. Is it possible to query only tracking number (and we have to compose URL depending on the carrier we use) or you can query also URL?

---

<div class="post-metadata">

**Author:** ![seba](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@seba](https://community.shiphero.com/u/seba)\
**Post date:** [November 28, 2019, 5:03pm UTC](https://community.shiphero.com/t/how-to-import-tracking-codes/245/5 "2019-11-28T17:03:46Z")

</div>

@mazdamx you can only get the tracking number by querying for the desired shipment.

```auto
query {
  shipment(id: "xxx") {
     request_id
     complexity
     data {
         order_id
         shipping_labels {
             carrier
             tracking_number
         }
     }
  }
}

```

---

<div class="post-metadata">

**Author:** ![mazdamx](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/mazdamx/32/73_2.png) [@mazdamx](https://community.shiphero.com/u/mazdamx)\
**Post date:** [November 28, 2019, 5:49pm UTC](https://community.shiphero.com/t/how-to-import-tracking-codes/245/6 "2019-11-28T17:49:17Z")

</div>

OK we will try that. Thank you for the quick response!
