NAV Navbar
cURL Ruby Python Java

Overview

You'll see examples over here.

We show examples using curl, a universal tool for getting and
sending data using the URL syntax. We also show examples in Ruby,
Python, and Java.

The ShipHawk API provides a simple way to integrate our shipping services into your existing systems. You can call the API from your online shopping cart, customer relationship management system, ERP, or order management system.

The API supports standalone use cases such as parcel label printing, as well as more powerful functions to enable shipping process automation from rating to delivery, and beyond. Access endpoints that enable rating, booking, dispatch, tracking, and reconciliation to automate eCommerce workflows as well as more traditional offline sales channels. Intro statement here.

API Principles

Our API design incorporates REST principles. Each endpoint corresponds to a resource.

The standard HTTP verbs GET, POST, and DELETE are used to retrieve, create, update, and delete these resources. We forgo the use of the HTTP PUT and PATCH verbs and use POST for both creating and updating resources. If you POST to the endpoint for a specific resource (rather than the collection), the existing resource will be updated with any attributes sent in the request. Attributes not specified in the request will retain their existing values.

All API endpoints output and consume JSON data. The API documentation lists the JSON data type for each attribute (number, string, boolean, array, object, or null).

Make sure to set your Content-Type header to 'application/json' when sending in POST requests with JSON data. The API will also accept 'application/x-www-form-urlencoded' data with no content header by default.

HTTPS

Authentication

ShipHawk uses key-based authentication. Pass your API Key in the X-Api-Key Header.

API Integration

The following is intended to provide an example of an end-to-end implementation of the ShipHawk API along with some helpful considerations to guide your ultimate implementation.

Integration Example

We'll see how various ShipHawk API endpoints are used together to provide a complete solution for common use cases.

Aviato is a fast-growing, nimble E-commerce company. Aviato sells products ranging from small shims to large widgets. Some of Aviato's products are prepackaged and only require shipping documentation; others are loose and need packing or palleting before shipping.

Aviato wants to achieve the following business objectives with ShipHawk:

Aviato will use the ShipHawk API to accomplish these objectives.

1. Synchronize Product Data For Shipping

First, Aviato will load its products into the ShipHawk PMS (Product Management System). You can store product data in the ShipHawk PMS for customer-facing rates, to use as line items or SKUs in orders, or in packages when making shipments.

Each product is associated with an item type, indicating how ShipHawk needs to treat them when rating or shipping. Items that must ship with a parcel carrier (FedEx, UPS, etc.) are parcels. Items that must ship with a freight carrier are handling units. And, when you don't know how a product should ship, they are unpacked items.

Aviato will need to provide as much information as possible for each product to streamline their shipping process. This includes length, width, height, weight, freight class, and harmonization codes (HS codes).

Note: For International shipments, Country of Origin is also required.

Additionally, Aviato needs to keep their product catalog up to date. As changes occur, Aviato will need to update their product catalog in the ShipHawk PMS to ensure ShipHawk has accurate data.

Products

2. Configure Policies

Now that products are synchronized, Aviato is ready to set up their business automation rules. ShipHawk's business automation rules are Rating Rules and Shipping Policies.

Scenario: Aviato makes good margins on their products and are able to subsidize shipping for any order over $100.00. They want their customers to receive free shipping when cart values are over $100.00. They also want to show transparent pricing when orders are less than $100.00.

Aviato creates a Rating Rule that uses an 'Order Criteria' of 'Order Value' and an 'Action' of 'Create Table Rate' to create a flat rate of $0.00. This will present itself as 'Free Shipping' to the end user.

Rules 1

Regardless of what the customer pays, Aviato always wants to use the cheapest service available to fulfill orders. This is the default behavior for ShipHawk. At order creation, ShipHawk will always attempt to use the cheapest available carrier and service.

If Aviato wants to change this scenario, they can add another Rating Rule. For example, they might give customers the option to select one of two flat rates: 'Standard Shipping' or 'White Glove'. They would then create a new Shipping Policy that would use the selected option to decide which carrier and service level should be used to fulfill this order.

Shipment 1

3. Display Rates To End Users

Aviato is building an improved eCommerce workflow. The most common implementation gives them the ability to access and display rates from ShipHawk on their product details page, shopping cart, and at checkout. To do this, Aviato need to decide how and where they capture their customer’s shipping destination zip code. It's important to think of a non-intrusive way of capturing this information.

After determining the appropriate user experience, Aviato will use their product SKU along with their customer's destination zip to access rates in real time from ShipHawk. Aviato will set the apply_rules API parameter in their rate request to true so that all of their Rules apply to every rating request. This allows them to change Rules on demand to improve the user experience or test new shipping options.

4. Synchronize Order Data

Rates are fantastic. But in the end commerce is about shipping Orders. Once live on ShipHawk, Aviato will book all Orders allowing their warehouse or fulfillment team to process Orders from the ShipHawk web portal. Once processed, ShipHawk begins post-order optimization and queues Shipments for fulfillment.

5. Create Shipments For Orders (Fulfillment)

Once Aviato has their orders successfully added to ShipHawk, the next step is to create a Shipment from those Orders. With ShipHawk it's incredibly easy. Aviato has the choice of using ShipHawk's API endpoints or using the ShipHawk web portal. Via the web portal, they'd confirm that product dimensions and other information is correct. Then, they'd select carrier and service level. Then, they'd select the green "SHIP" button in the upper right corner of the screen.

Shipment 2

If Aviato is using ShipHawk's API, they would utilize the Create Shipment endpoint to create their shipments. All process can be automated using our simple REST-style APIs.

Once booked, Aviato can navigate to the shipment details page and confirm the details of their successfully booked shipment.

Shipment 3

Next, Aviato will want to track the status and progress of their shipments.

6. Track And Trace Shipments

Once a shipment is booked and ready for pickup, customers will want to know where their order is: Has it shipped, is it in transit, etc. ShipHawk has multiple options for accessing tracking information. First, use of our Track Shipment API endpoint and webhooks allow for complete automation to send tracking updates to your customers as they take place.

ShipHawk also provides a branded tracking page, allowing customers to keep their buyers completely up to date. If desired, we automatically send custom, branded tracking emails that include a link to our tracking page.

History 1

Every customer is different. And while not everyone is like Aviato, ShipHawk has a solution for you. If you have a unique use case, custom ERP, or home built shopping cart solution, ShipHawk can make your shipping channel run smoothly.

Common Rating Use Cases

The following describes some common use cases for shipping rates and some helpful considerations for your API implementation.

Multi-carrier rating lets you find the right carrier and service level, whether you need to optimize for cost, time, service level, carrier type, or even limit rates to a specific carrier. ShipHawk lets you make these decisions in real-time.

It starts with the right information. Rates are most accurate when complete product details are provided. Whether your products can be shipped parcel or freight, domestic or international, you'll want to make sure that you have the right information available to rate (and ultimately book) your shipments.

While you can often access rates from carriers with weight or dimensions, we highly recommend that you store as much information as possible with your products, including: length, width, height, weight, freight class and harmonization codes (HTC) and country of origin (manufacture) for international shipments.

Before making rate requests, you will want to address the following:

When implementing rating, make sure to consider the following:

Case 1. Rating For eCommerce: PDP, Cart, Checkout

Every business has a different approach to presenting shipping rates to customers. Some show costs transparently; some subsidize shipping through margin; and some use shipping as a way to increase revenue.

ShipHawk helps businesses present rates to their customers however desired:

Case 2. Rating For Sales Teams: Rates For POs

Whether B2C or B2B, providing your customers shipping rates for offline orders (telephone, mail order, manual, chat, etc.) is always necessary. ShipHawk allows your team to leverage the Web Portal to shop rates manually. The ShipHawk API can be used to streamline this process with your internal business systems - ERP, CRM, etc.

Customers expect information quickly; ShipHawk provides you information rapidly so you can:

Case 3. Rating For The Back Office: Order Processing

ShipHawk uses the Proposed Shipment to rate orders as they are processed. While Rating Rules are only applicable for the Rate Request object, Shipping Policies are used to rate orders as they flow in from your customers. Shipping Policies allow you to configure business logic around order processing so that you can restrict carriers, carrier types, or service levels used for processing specific orders or products; or, you can let ShipHawk figure it out for you.

Your Account

This guide is designed to help provide a basic overview of your ShipHawk account, the use of the ShipHawk Sandbox testing environment, your API keys, and security.

Sandbox And Production Environments

In addition to the Production ShipHawk environment, customers may use our shared Sandbox environment. These two environments are in many cases identical; however, the Sandbox environment may have newer, less thoroughly tested functionality installed. The ShipHawk Sandbox environment is shared by multiple ShipHawk customers.

The Sandbox and Production environments can be accessed via API endpoints, as well as via the ShipHawk Web Portal so that you can test and validate from all user perspectives.

To access the Sandbox web portal, go to: https://sandbox.shiphawk.com/login
To access the Production web portal, go to: https://shiphawk.com/login

API Keys

Your ShipHawk account has two unique API Keys: one for the ShipHawk Sandbox environment, and one for the ShipHawk Production environment. These keys are unique to their environments, and will result in authentication failures (403 Forbidden) if used in the incorrect environment.

Sandbox uses the Sandbox subdomain for its API calls: https://sandbox.shiphawk.com/api
Production uses the primary ShipHawk domain for its API calls: https://shiphawk.com/api

Account Security

Questions

If you have any questions, please contact your account manager, send us an email, or contact our sales team.

Going Live Checklist

We want everyone using using ShipHawk to be successful. That's why we've put together this high level checklist to ensure that you get off to a great start. Use the following information to properly set up your account, validate your implementation and prepare your operation for a successful launch.

Account Checklist

The following section provides a general overview for setting up your ShipHawk account. The steps are the same you are using ShipHawk via our API, Web Portal or a platform extension:

Integration Checklist

The following section provides a general overview for making sure that your ShipHawk integration is complete and functioning properly:

Launch Checklist

The following section gives a general overview for getting your team ready to launch with the ShipHawk system:

Orders

Order Resources

Order Request Object

Used when creating or updating Orders. Parameters are optional unless noted.

Parameter Type Description, Defaults
order_number String required
source_system String Source system ("NetSuite", "Shopify", "Magento", etc.)
source_system_id String
source_system_domain String
source_system_meta Hash Source System Meta Request object
source String
source_system_processed_at DateTime
unbundle_kits Boolean
origin_address Hash Order Address Request object
destination_address Hash Order Address Request object
billing_address Hash Order Address Request object
order_line_items array List of Order Line item request objects.
total_price Float
tax_price Float
items_price Float
status String
requested_shipping_details String
requested_rate_id String or Array[String]
self_packed Boolean Default: true
include_return_label Boolean Default: false
reference_numbers Array List of Reference Number Request objects
proposed_shipments Array List of Proposed Shipment Request objects
tags Array[String]
warehouse_id String
warehouse_code String
notes Array List of Note Request objects
integration_id Integer
instant_proposed_shipment_generation Boolean Default: false
billing_details Hash Shipment Billing Details Request object
duties_taxes_billing_details hash Shipment Billing Details Request object

Order Reference Numbers Request Object

Attribute Type Description
id String
name String Use other_id to name your own reference number
value String An invoice number, purchase number, etc
code String Mapped according to the following:
invoice_id: SO
customer_id: CO
reference_id: CR
purchase_id: PO
bol_id: BM
other_id: ZZ

Order Line Item Request Object

Parameters are optional unless noted.

Parameter Type Description, Defaults
source_system_id String
name String
sku String
upc String
quantity Integer Default: 1
value Float
price Float
length Float Length dimension.
width Float Width dimension.
height Float Height dimension.
weight Float Line item weight.
item_type String
unpacked_item_type_id String
handling_unit_type String One of: pallet carton box crate bag drum
hs_code String
country_of_origin String
freight_class String
nmfc String
package_type String
package_quantity Integer
volume_cubic_ft Float
warehouse_id String
warehouse_code String
line_number Integer
description String
lot_number String
ship_individually Boolean
orm_id Boolean
commodity_description String
meta Hash
origin_address Hash Order Address Request object
reference_numbers Array List of Order Line Reference Number Request objects.
hazmat_data Hash List of Hazmat Data Request objects.

Order Address Request Object

Attribute Type Description
name String
company String
street1 String
street2 String
phone_number String
city String
state String
country String Default: US
zip String
email String
code String
is_residential Boolean Default: false

Order Line Reference Numbers Request Object

Attribute Type Description
id string
name string If our codes don't support your needs. Use other_id and then you can name your own reference number.
value string An invoice number, purchase number, etc
code string Mapped according to the following:
invoice_id: SO
customer_id: CO
reference_id: CR
purchase_id: PO
bol_id: BM
other_id: ZZ
external_code string

Hazmat Data Request Object

Parameter Type Description, Defaults
un_or_na_number String
proper_shipping_name String
technical_name String
hazard_class_or_division String
packing_group String
emergency_response_phone_number String
emergency_contact_name String
emergency_contact_phone_number String
regulation_level String
container String
amount Float
amount_unit String One of: kg lbs oz l
transportation_mode String ground passenger_aircraft cargo_aircraft_only
additional_description String

Source System Meta Request Object

Parameter Type Description, Defaults
status String
channel String

Order Response Object

{
    "id": "ord_K3JZv43A",
    "order_number": "ORD10100111",
    "combined_order_numbers": [],
    "source_system": "ShipHawk eComm",
    "source_system_id": "SH123",
    "source": "Proprietary",
    "source_system_meta": {},
    "integration_name": null,
    "source_system_processed_at": "2016-03-01T00:00:00+00:00",
    "origin_address": {
        "name": "Mike Richardson",
        "company": "ShipHawk",
        "street1": "1234 Main St.",
        "street2": null,
        "city": "Virginia Beach",
        "state": "VA",
        "zip": "23454",
        "country": "US",
        "phone_number": "805-335-2432",
        "email": "mikel@shiphawk.com",
        "is_residential": false
    },
    "destination_address": {
        "name": "George Chapman",
        "company": "Hawk Apps",
        "street1": "1234 Main St.",
        "street2": null,
        "city": "Ventura",
        "state": "CA",
        "zip": "93001",
        "country": "US",
        "phone_number": "805-770-1642",
        "email": "george@shiphawk.com",
        "is_residential": false,
        "is_po_box": false
    },
    "billing_address": {
        "name": "John Doe",
        "company": "Hawk Apps",
        "street1": "1234 Main St.",
        "street2": null,
        "city": "New York",
        "state": "NY",
        "zip": "10029",
        "country": "US",
        "phone_number": "805-888-1234",
        "email": "john@shiphawk.com",
        "is_residential": false,
    },
    "reference_numbers": [
        {
            "id": "shpr_q1BB1hVy",
            "code": "purchase_id",
            "value": "191919",
            "name": "Purchase Order #"
        },
        {
            "id": "shpr_G7JQn8Q5",
            "code": "reference_id",
            "value": "787878",
            "name": "Shipper's Order #"
        }
    ],
    "total_price": 1000,
    "shipping_price": 800,
    "tax_price": 50,
    "items_price": 150,
    "order_line_items": [],
    "requested_shipping_details": "FedEx Ground",
    "requested_rate_id": "01004c4c-da3c-48ff-b2e7-2f44389077e8",
    "status": "new",
    "include_return_label": false,
    "cancelled_at": null,
    "created_at": "2019-01-24T23:16:34+00:00",
    "updated_at": "2019-01-24T23:16:34+00:00",
    "error_message": [],
    "batch_id": null,
    "batch_name": null,
    "requested_billing_details": null,
    "tags": [],
    "warehouse": null,
    "packing_slip_template": null,
    "single_sku": "1234",
    "single_sku_name": "(None)",
    "skus_count": null,
    "hold_until": null,
    "integration_id": null,
    "shipments": [],
    "proposed_shipments": [],
    "notes": [],
    "documents": [
        {
            "id": "doc_haEz8ker",
            "customer_uploaded": false,
            "type": "Pick Ticket",
            "extension": "PDF",
            "code": "pick_ticket",
            "url": "https://shiphawk-assets-qa.s3.amazonaws.com/uploads/pick_ticket_646acda37ccd1341b8579a59bdd62730.pdf?AWSAccessKeyId=AKIAIGBEYNQ6VGNFN2GQ&Signature=sPF6%2B5MVtbvxzOAPdoStKg%2Bu8Kk%3D&Expires=1864013115",
            "meta_data": {},
            "created_at": "2019-01-24T23:16:37.349+00:00",
            "filename": "pick_ticket_646acda37ccd1341b8579a59bdd62730.pdf"
        }
    ],
    "shipped_order_line_items": [],
    "not_shipped_order_line_items": [
        {
            "id": "ordi_QdFvV0J7",
            "source_system_id": "SH123",
            "origin_order_source_system_id": null,
            "origin_order_number": null,
            "name": null,
            "description": null,
            "sku": "1234",
            "upc": null,
            "quantity": 1,
            "value": 251,
            "length": 11,
            "width": 11,
            "height": 11,
            "weight": 0.938,
            "freight_class": null,
            "package_quantity": null,
            "package_type": null,
            "item_type": "parcel",
            "unpacked_item_type_id": null,
            "handling_unit_type": null,
            "hs_code": null,
            "country_of_origin": null,
            "lot_number": null,
            "serial_number": null,
            "line_number": null,
            "warehouse_id": null,
            "warehouse_code": null,
            "origin_address": null,
            "error_message": null,
            "reference_numbers": [],
            "nmfc": null,
            "hazmat_data": null,
            "orm_d": null
        }
    ]
}

Returned from Order creation, updating, retrieval, etc.

Attributes Type Description
id string ShipHawk Order identifier.
order_number string
combined_order_numbers array[string] List of Order Line Item origin order numbers.
source_system string Source system ("NetSuite", "Shopify", "Magento", etc.)
source_system_id string
source string Source represents where the order came from. It can be as simple as "API" or "Manual" or "John Smith" as a way to tag how this order was triggered.
source_system_meta hash
integration_name string
source_system_processed_at DateTime
origin_address hash Address object.
destination_address hash Address object.
billing_address hash Address object.
reference_numbers array List of Order Reference Number Response objects
total_price float
shipping_price float
tax_price float
items_price float
order_line_items array List of Order Line Item Response objects
requested_shipping_details string
requested_rate_id string
status string
include_return_label boolean
cancelled_at DateTime
created_at DateTime
updated_at DateTime
error_message array[string]
batch_id string Order batch identifier
batch_name string Order batch name
requested_billing_details hash Shipment Billing Details Response object
tags array[string]
warehouse hash Warehouse object
packing_slip_template hash Packing Slip Template object
single_sku string One of: (None) (Multiple Items) a single SKU (if the order has a single Order Line Item with a SKU)
single_sku_name string One of: (None) (Multiple Items) a single SKU (if the order has a single Order Line Item with a SKU)
hold_until DateTime
integration_id integer
shipments array List of Shipment objects
proposed_shipments array List of Proposed Shipment objects
notes array List of Note objects
documents array List of Document objects
shipped_order_line_items array List of Order Line Item objects
not_shipped_order_line_items array List of Order Line Item objects

Order Line Item Response Object

{
    "id": "ordi_QdFvV0J7",
    "source_system_id": "SH123",
    "origin_order_source_system_id": null,
    "origin_order_number": null,
    "name": null,
    "description": null,
    "sku": "1234",
    "upc": null,
    "quantity": 1,
    "value": 251,
    "length": 11,
    "width": 11,
    "height": 11,
    "weight": 0.938,
    "freight_class": null,
    "package_quantity": null,
    "package_type": null,
    "item_type": "parcel",
    "unpacked_item_type_id": null,
    "handling_unit_type": null,
    "hs_code": null,
    "country_of_origin": null,
    "lot_number": null,
    "serial_number": null,
    "line_number": null,
    "warehouse_id": null,
    "warehouse_code": null,
    "origin_address": null,
    "error_message": null,
    "reference_numbers": [],
    "nmfc": null,
    "hazmat_data": null,
    "orm_d": null
}
Attributes Type Description
id string
source_system_id string
origin_order_source_system_id string In the case of combined shipments, this line item's original order source system
origin_order_number string In the case of combined shipments, this line item's original order number
name string
description string
sku string
upc string
quantity float
value float
length float
width float
height float
weight float
freight_class string
package_quantity integer
package_type string
item_type string
unpacked_item_type_id string
handling_unit_type string
hs_code string
country_of_origin string
lot_number string
serial_number string
line_number integer
warehouse_id string
warehouse_code string
origin_address hash Address Object
error_message string
reference_numbers array list of Order Reference Numbers Response Object
nmfc string
hazmat_data Object Order Line Item Hazmat Data Response Object
orm_d boolean

Hazmat Data Response Object

Attribute Type Description
un_or_na_number string
proper_shipping_name string
technical_name string
hazard_class_or_division string
packing_group string
emergency_response_phone_number string
emergency_contact_name string
emergency_contact_phone_number string
regulation_level string
container string
amount float
amount_unit string One of: kg lbs oz l
transportation_mode string
additional_description string

Order Reference Numbers Response Object

Attribute Type Description
id string
code string Refer to the code mapping above to determine which code to use
value string An invoice number, purchase number, etc
name string If our codes don't support your needs. Use other_id and then you can name your own reference number.

Order API Endpoints

Create an Order

curl -H "Content-Type: application/json" -X POST -d '
{
    "order_number": "ORD10100111",
    "source_system": "ShipHawk eComm",
    "source_system_id": "SH123",
    "source": "Proprietary",
    "source_system_processed_at": "2016-03-01",
    "origin_address": {
      "name": "Mike Richardson",
      "company": "ShipHawk",
      "street1": "1234 Main St.",
      "city": "Virginia Beach",
      "state": "VA",
      "zip": "234545",
        "phone_number":"805-335-2432",
      "email":"mikel@shiphawk.com"
    },
    "destination_address": {
      "name": "George Chapman",
      "company": "Hawk Apps",
      "street1": "1234 Main St.",
      "city": "Ventura",
      "state": "California",
      "zip": "93001",
      "phone_number":"805-770-1642",
      "email":"george@shiphawk.com"

    },
    "billing_address": {
      "name": "John Doe",
      "company": "Hawk Apps",
      "street1": "1234 Main St.",
      "city": "New York",
      "state": "NY",
      "zip": "10029",
      "country": "US",
      "phone_number": "805-888-1234",
      "email": "john@shiphawk.com"
    },
    "order_line_items": [{
      "source_system_id": "SH123",
      "name": "",
      "sku": "1234",
      "quantity": 1,
      "value": 251.00,
      "length": 11.0,
      "width": 11.0,
      "height": 11.0,
      "weight": 15.0,
      "item_type": "parcel"
    }],
    "reference_numbers": [{
      "code":  "reference_id",
      "name":  "Shipper's Order #",
      "value": "787878"
      },
      {
      "code": "purchase_id",
      "name":  "Purchase Order #",
      "value": "191919"
      }],
    "total_price": 1000,
    "shipping_price": 800,
    "tax_price": 50,
    "items_price": 150,
    "status": "new",
    "requested_shipping_details": "FedEx Ground",
    "requested_rate_id": "01004c4c-da3c-48ff-b2e7-2f44389077e8"
}' 'https://sandbox.shiphawk.com/api/v4/orders?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/?api_key=YOUR_API_KEY')

order =
'{
    "order_number": "ORD10100111",
    "source_system": "ShipHawk eComm",
    "source_system_id": "SH123",
    "source": "Proprietary",
    "source_system_processed_at": "2016-03-01",
    "origin_address": {
      "name": "Mike Richardson",
      "company": "ShipHawk",
      "street1": "1234 Main St.",
      "city": "Virginia Beach",
      "state": "VA",
      "zip": "234545",
        "phone_number":"805-335-2432",
      "email":"mikel@shiphawk.com"
    },
    "destination_address": {
      "name": "George Chapman",
      "company": "Hawk Apps",
      "street1": "1234 Main St.",
      "city": "Ventura",
      "state": "California",
      "zip": "93001",
      "phone_number":"805-770-1642",
      "email":"george@shiphawk.com"

    },
    "billing_address": {
      "name": "John Doe",
      "company": "Hawk Apps",
      "street1": "1234 Main St.",
      "city": "New York",
      "state": "NY",
      "zip": "10029",
      "country": "US",
      "phone_number": "805-888-1234",
      "email": "john@shiphawk.com"
    },
    "order_line_items": [{
      "source_system_id": "SH123",
      "name": "",
      "sku": "1234",
      "quantity": 1,
      "value": 251.00,
      "length": 11.0,
      "width": 11.0,
      "height": 11.0,
      "weight": 15.0,
      "item_type": "parcel"
    }],
    "reference_numbers": [{
      "code":  "reference_id",
      "name":  "Shippers Order #",
      "value": "787878"
      },
      {
      "code": "purchase_id",
      "name":  "Purchase Order #",
      "value": "191919"
      }],
    "total_price": 1000,
    "shipping_price": 800,
    "tax_price": 50,
    "items_price": 150,
    "status": "new",
    "requested_shipping_details": "FedEx Ground",
    "requested_rate_id": "01004c4c-da3c-48ff-b2e7-2f44389077e8"
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = order

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/orders'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "order_number": "ORD10100111",
    "source_system": "ShipHawk eComm",
    "source_system_id": "SH123",
    "source": "Proprietary",
    "source_system_processed_at": "2016-03-01",
    "origin_address": {
      "name": "Mike Richardson",
      "company": "ShipHawk",
      "street1": "1234 Main St.",
      "city": "Virginia Beach",
      "state": "VA",
      "zip": "234545",
        "phone_number":"805-335-2432",
      "email":"mikel@shiphawk.com"
    },
    "destination_address": {
      "name": "George Chapman",
      "company": "Hawk Apps",
      "street1": "1234 Main St.",
      "city": "Ventura",
      "state": "California",
      "zip": "93001",
      "phone_number":"805-770-1642",
      "email":"george@shiphawk.com"

    },
    "billing_address": {
      "name": "John Doe",
      "company": "Hawk Apps",
      "street1": "1234 Main St.",
      "city": "New York",
      "state": "NY",
      "zip": "10029",
      "country": "US",
      "phone_number": "805-888-1234",
      "email": "john@shiphawk.com"
    },
    "order_line_items": [{
      "source_system_id": "SH123",
      "name": "",
      "sku": "1234",
      "quantity": 1,
      "value": 251.00,
      "length": 11.0,
      "width": 11.0,
      "height": 11.0,
      "weight": 15.0,
      "item_type": "parcel"
    }],
    "reference_numbers": [{
      "code":  "reference_id",
      "name":  "Shippers Order #",
      "value": "787878"
      },
      {
      "code": "purchase_id",
      "name":  "Purchase Order #",
      "value": "191919"
      }],
    "total_price": 1000,
    "shipping_price": 800,
    "tax_price": 50,
    "items_price": 150,
    "status": "new",
    "requested_shipping_details": "FedEx Ground",
    "requested_rate_id": "01004c4c-da3c-48ff-b2e7-2f44389077e8"
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("order_number", "ORD10100111")
                .add("source_system", "ShipHawk eComm")
                .add("source_system_id", "SH123")
                .add("source", "Proprietary")
                .add("source_system_processed_at", "2016-03-01")
                .add("origin_address", Json.createObjectBuilder()
                    .add("name", "Mike Richardson")
                    .add("company", "ShipHawk")
                    .add("street1", "1234 Main St.")
                    .add("city", "Virginia Beach")
                    .add("state", "VA")
                    .add("zip", "234545")
                    .add("phone_number", "805-335-2432")
                    .add("email", "mikel@shiphawk.com")
                    )
                .add("destination_address", Json.createObjectBuilder()
                    .add("name", "George Chapman")
                    .add("company", "Hawk Apps")
                    .add("street1", "1234 Main St.")
                    .add("city", "Ventura")
                    .add("state", "California")
                    .add("zip", "93001")
                    .add("phone_number", "805-770-1642")
                    .add("email", "george@shiphawk.com")
                    )
                .add("order_line_items", Json.createArrayBuilder()
                    .add(Json.createObjectBuilder()
                        .add("source_system_id", "SH123")
                        .add("name", "")
                        .add("sku", "1234")
                        .add("quantity", 1)
                        .add("value", 251.00)
                        .add("length", 11.0)
                        .add("width", 11.0)
                        .add("height", 11.0)
                        .add("weight", 15.0)
                        .add("item_type", "parcel")
                        )
                    )
                .add("reference_numbers", Json.createArrayBuilder()
                    .add(Json.createObjectBuilder()
                        .add("code", "reference_id")
                        .add("name", "Shippers Order #")
                        .add("value", "787878")
                        )
                    .add(Json.createObjectBuilder()
                        .add("code", "purchase_id")
                        .add("name", "Purchase Order #")
                        .add("value", "191919")
                        )
                    )
                .add("total_price", "1000")
                .add("shipping_price", "800")
                .add("tax_price", "50")
                .add("items_price", "150")
                .add("status", "new")
                .add("requested_shipping_details", "FedEx Ground")
                .add("requested_rate_id", "01004c4c-da3c-48ff-b2e7-2f44389077e8")
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/orders

Update an Order

#'ord_DqKvSb9M' is an example order id.
curl -H "Content-Type: application/json" -X POST -d '
{
    "order_number": "ORD10100111",
    "source_system": "ShipHawk eComm",
    "source_system_id": "SH123",
    "source": "Proprietary",
    "source_system_processed_at": "2016-03-01",
    "origin_address": {
      "name": "Mike Richardson",
      "company": "ShipHawk",
      "street1": "1234 Main St.",
      "city": "Virginia Beach",
      "state": "VA",
      "zip": "234545",
        "phone_number":"805-335-2432",
      "email":"mikel@shiphawk.com"
    },
    "destination_address": {
      "name": "George Chapman",
      "company": "Hawk Apps",
      "street1": "1234 Main St.",
      "city": "Ventura",
      "state": "California",
      "zip": "93001",
      "phone_number":"805-770-1642",
      "email":"george@shiphawk.com"

    },
    "billing_address": {
      "name": "John Doe",
      "company": "Hawk Apps",
      "street1": "1234 Main St.",
      "city": "New York",
      "state": "NY",
      "zip": "10029",
      "country": "US",
      "phone_number": "805-888-1234",
      "email": "john@shiphawk.com"
    },
    "order_line_items": [{
      "source_system_id": "SH123",
      "name": "",
      "sku": "1234",
      "quantity": 1,
      "value": 251.00,
      "length": 11.0,
      "width": 11.0,
      "height": 11.0,
      "weight": 15.0,
      "item_type": "parcel"
    }],
    "reference_numbers": [{
      "code":  "reference_id",
      "name":  "Shipper's Order #",
      "value": "787878"
      },
      {
      "code": "purchase_id",
      "name":  "Purchase Order #",
      "value": "191919"
      }],
    "total_price": 1000,
    "shipping_price": 800,
    "tax_price": 50,
    "items_price": 150,
    "status": "new",
    "requested_shipping_details": "FedEx Ground",
    "requested_rate_id": "01004c4c-da3c-48ff-b2e7-2f44389077e8"
}' 'https://sandbox.shiphawk.com/api/v4/orders/ord_DqKvSb9M?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

#'ord_c5Py82JD' is an example order id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/ord_c5Py82JD?api_key=YOUR_API_KEY')

order =
'{
    "order_number": "ORD101001111",
    "source_system": "ShipHawk eComm",
    "source_system_id": "SH123",
    "source": "Proprietary",
    "source_system_processed_at": "2016-03-01",
    "origin_address": {
      "name": "Mike Richardson",
      "company": "ShipHawk",
      "street1": "1234 Main St.",
      "city": "Virginia Beach",
      "state": "VA",
      "zip": "234545",
        "phone_number":"805-335-2432",
      "email":"mikel@shiphawk.com"
    },
    "destination_address": {
      "name": "George Chapman",
      "company": "Hawk Apps",
      "street1": "1234 Main St.",
      "city": "Ventura",
      "state": "California",
      "zip": "93001",
      "phone_number":"805-770-1642",
      "email":"george@shiphawk.com"
    },
    "billing_address": {
      "name": "John Doe",
      "company": "Hawk Apps",
      "street1": "1234 Main St.",
      "city": "New York",
      "state": "NY",
      "zip": "10029",
      "country": "US",
      "phone_number": "805-888-1234",
      "email": "john@shiphawk.com"
    },
    "order_line_items": [{
      "source_system_id": "SH123",
      "name": "",
      "sku": "1234",
      "quantity": 1,
      "value": 251.00,
      "length": 11.0,
      "width": 11.0,
      "height": 11.0,
      "weight": 15.0,
      "item_type": "parcel"
    }],
    "reference_numbers": [{
      "code":  "reference_id",
      "name":  "Shippers Order #",
      "value": "787878"
      },
      {
      "code": "purchase_id",
      "name":  "Purchase Order #",
      "value": "191919"
      }],
    "total_price": 1000,
    "shipping_price": 800,
    "tax_price": 50,
    "items_price": 150,
    "status": "new",
    "requested_shipping_details": "FedEx Ground",
    "requested_rate_id": "01004c4c-da3c-48ff-b2e7-2f44389077e8"
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = order

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

#'ord_mSCP9was' is an example order id.
url = 'https://sandbox.shiphawk.com/api/v4/orders/ord_mSCP9was'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "order_number": "ORD101001111",
    "source_system": "ShipHawk eComm",
    "source_system_id": "SH123",
    "source": "Proprietary",
    "source_system_processed_at": "2016-03-01",
    "origin_address": {
      "name": "Mike Richardson",
      "company": "ShipHawk",
      "street1": "1234 Main St.",
      "city": "Virginia Beach",
      "state": "VA",
      "zip": "234545",
        "phone_number":"805-335-2432",
      "email":"mikel@shiphawk.com"
    },
    "destination_address": {
      "name": "George Chapman",
      "company": "Hawk Apps",
      "street1": "1234 Main St.",
      "city": "Ventura",
      "state": "California",
      "zip": "93001",
      "phone_number":"805-770-1642",
      "email":"george@shiphawk.com"
    },
    "billing_address": {
      "name": "John Doe",
      "company": "Hawk Apps",
      "street1": "1234 Main St.",
      "city": "New York",
      "state": "NY",
      "zip": "10029",
      "country": "US",
      "phone_number": "805-888-1234",
      "email": "john@shiphawk.com"
    },
    "order_line_items": [{
      "source_system_id": "SH123",
      "name": "",
      "sku": "1234",
      "quantity": 1,
      "value": 251.00,
      "length": 11.0,
      "width": 11.0,
      "height": 11.0,
      "weight": 15.0,
      "item_type": "parcel"
    }],
    "reference_numbers": [{
      "code":  "reference_id",
      "name":  "Shippers Order #",
      "value": "787878"
      },
      {
      "code": "purchase_id",
      "name":  "Purchase Order #",
      "value": "191919"
      }],
    "total_price": 1000,
    "shipping_price": 800,
    "tax_price": 50,
    "items_price": 150,
    "status": "new",
    "requested_shipping_details": "FedEx Ground",
    "requested_rate_id": "01004c4c-da3c-48ff-b2e7-2f44389077e8"
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("order_number", "ORD101001111")
                .add("source_system", "ShipHawk eComm")
                .add("source_system_id", "SH123")
                .add("source", "Proprietary")
                .add("source_system_processed_at", "2016-03-01")
                .add("origin_address", Json.createObjectBuilder()
                    .add("name", "Mike Richardson")
                    .add("company", "ShipHawk")
                    .add("street1", "1234 Main St.")
                    .add("city", "Virginia Beach")
                    .add("state", "VA")
                    .add("zip", "234545")
                    .add("phone_number", "805-335-2432")
                    .add("email", "mikel@shiphawk.com")
                    )
                .add("destination_address", Json.createObjectBuilder()
                    .add("name", "George Chapman")
                    .add("company", "Hawk Apps")
                    .add("street1", "1234 Main St.")
                    .add("city", "Ventura")
                    .add("state", "California")
                    .add("zip", "93001")
                    .add("phone_number", "805-770-1642")
                    .add("email", "george@shiphawk.com")
                    )
                .add("order_line_items", Json.createArrayBuilder()
                    .add(Json.createObjectBuilder()
                        .add("source_system_id", "SH123")
                        .add("name", "")
                        .add("sku", "1234")
                        .add("quantity", 1)
                        .add("value", 251.00)
                        .add("length", 11.0)
                        .add("width", 11.0)
                        .add("height", 11.0)
                        .add("weight", 15.0)
                        .add("item_type", "parcel")
                        )
                    )
                .add("reference_numbers", Json.createArrayBuilder()
                    .add(Json.createObjectBuilder()
                        .add("code", "reference_id")
                        .add("name", "Shippers Order #")
                        .add("value", "787878")
                        )
                    .add(Json.createObjectBuilder()
                        .add("code", "purchase_id")
                        .add("name", "Purchase Order #")
                        .add("value", "191919")
                        )
                    )
                .add("total_price", "1000")
                .add("shipping_price", "800")
                .add("tax_price", "50")
                .add("items_price", "150")
                .add("status", "new")
                .add("requested_shipping_details", "FedEx Ground")
                .add("requested_rate_id", "01004c4c-da3c-48ff-b2e7-2f44389077e8")
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            // 'ord_JKAyGya4' is an example order id.
            URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/ord_JKAyGya4?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/orders/:id

Retrieve an Order

#'ord_DqKvSb9M' is an example order id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/orders/ord_DqKvSb9M?api_key=YOUR_API_KEY'
require 'net/http'

#'ord_c5Py82JD' is an example order id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/ord_c5Py82JD?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/orders/ord_mSCP9was'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        //'ord_mbX920Mg' is an example order id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/ord_mbX920Mg?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed.");
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/orders/:id

Retrieve Pick Ticket for an Order

//'ord_DqKvSb9M' is an example order id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/orders/ord_DqKvSb9M/pick_ticket?api_key=YOUR_API_KEY'
require 'net/http'

#'ord_c5Py82JD' is an example order id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/ord_c5Py82JD/pick_ticket?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/orders/ord_mSCP9was/pick_ticket'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'ord_mbX920Mg' is an example order id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/ord_mbX920Mg/pick_ticket?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed.");
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/orders/:id/pick_ticket

List all Orders

curl -X GET 'https://sandbox.shiphawk.com/api/v4/orders?api_key=YOUR_API_KEY'
require 'net/http'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/orders/'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed.");
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/orders

Cancel an Order

### `ORD10100111` is an example order number.
curl -X POST 'https://sandbox.shiphawk.com/api/v4/orders/ORD10100111/cancelled?api_key=YOUR_API_KEY'
require 'net/http'
#'1253' is an example order number.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/1253/cancelled?api_key=YOUR_API_KEY')

# Create the HTTP objects
request = Net::HTTP::Post.new(uri.request_uri)

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/orders/1253/cancelled'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.post(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        // 'ord_mbX920Mg' is an example order id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/ORD101001111/cancelled?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Content-Type", "application/json");

        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_CREATED){
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("POST request failed. Code was " + responseCode);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/orders/:order_number/cancelled

Combine One or More Orders

# Example includes list of order ids.
curl -H "Content-Type: application/json" -X POST -d '
{
    "master_order_id": "1231241",
    "ids": ["ord_DqKvSb9M", "ord_2E1pWGRh"],
    "all_items": "true"
}' 'https://sandbox.shiphawk.com/api/v4/orders/combine?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

# Example includes list of order ids.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/combine?api_key=YOUR_API_KEY')

order =
'{
    "master_order_id": "1231241",
    "ids": ["ord_DqKvSb9M", "ord_2E1pWGRh"],
    "all_items": "true"
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = order

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/orders/combine'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "master_order_id": "1231241",
    "ids": ["ord_DqKvSb9M", "ord_2E1pWGRh"],
    "all_items": "true"
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("master_order_id", "1231241")
                .add("ids", Json.createArrayBuilder()
                        .add("ord_DqKvSb9M")
                        .add("ord_2E1pWGRh")
                    )
                .add("all_items", "true")
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/combine?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/orders/combine

Split Orders

#`ord_2E1pWGRh` is an example order id
curl -H "Content-Type: application/json" -X POST -d '
{
    "id": "ord_2E1pWGRh",
    "order_number": "ORD10100112",
    "order_line_items": [
        {
            "id": "ordi_NmDJkZWj",
            "quantity": 1
        }
    ]
}' 'https://sandbox.shiphawk.com/api/v4/orders/ord_2E1pWGRh/split?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

#'ord_c5Py82JD' is an example order id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/ord_c5Py82JD/split?api_key=YOUR_API_KEY')

order =
'{
    "id": "ord_c5Py82JD",
    "order_number": "ORD10100112",
    "order_line_items": [
        {
            "id": "ordi_NmDJkZWj",
            "quantity": 1
        }
    ]
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = order

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

url = 'https://sanbox.shiphawk.com/api/v4/orders/ord_c5Py82JD/split'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "id": "ord_c5Py82JD",
    "order_number": "ORD10100112",
    "order_line_items": [
        {
            "id": "ordi_NmDJkZWj",
            "quantity": 1
        }
    ]
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("id", "ord_JKAyGya4")
                .add("order_number", "ORD101001111")
                .add("order_line_items", Json.createArrayBuilder())
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            // 'ord_JKAyGya4' is an example order id.
            URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/ord_JKAyGya4/split?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/orders/:id/split

Hold One or More Orders

# Example includes list of order ids and a specific date to hold the orders until that time.
curl -H "Content-Type: application/json" -X POST -d '
{
    "ids": ["ord_2E1pWGRh","ord_DqKvSb9M"],
    "hold_until": "2019-01-30T23:16:34+00:00"
}' 'https://sandbox.shiphawk.com/api/v4/orders/hold?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

# Example includes list of order ids and a specific date to hold the orders until that time.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/hold?api_key=YOUR_API_KEY')

order =
'{
    "ids": ["ord_2E1pWGRh","ord_DqKvSb9M"],
    "hold_until": "2019-01-30T23:16:34+00:00"
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = order

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/orders/hold'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "ids": ["ord_2E1pWGRh","ord_DqKvSb9M"],
    "hold_until": "2019-01-30T23:16:34+00:00"
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("ids", Json.createArrayBuilder()
                        .add("ord_2E1pWGRh")
                        .add("ord_DqKvSb9M")
                    )
                .add("hold_until", "2019-01-30T23:16:34+00:00")
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/hold?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/orders/hold

Remove Hold on Orders

# Example includes list of order ids.
curl -H "Content-Type: application/json" -X POST -d '
{
    "ids": ["ord_2E1pWGRh","ord_DqKvSb9M"]
}' 'https://sandbox.shiphawk.com/api/v4/orders/restore?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

# Example includes list of order ids.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/restore?api_key=YOUR_API_KEY')

order =
'{
    "ids": ["ord_2E1pWGRh","ord_DqKvSb9M"]
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = order

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/orders/restore'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "ids": ["ord_2E1pWGRh","ord_DqKvSb9M"]
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("ids", Json.createArrayBuilder()
                        .add("ord_2E1pWGRh")
                        .add("ord_DqKvSb9M")
                    )
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/restore?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/orders/restore

Retrieve Aggregated Document for Orders

curl -H "Content-Type: application/json" -X POST -d '
{
    "ids": ["ord_2E1pWGRh","ord_DqKvSb9M"],
    "document_type": "pdf"
}' 'https://sandbox.shiphawk.com/api/v4/orders/aggregated_documents?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

# Example includes list of order ids.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/aggregated_documents?api_key=YOUR_API_KEY')

order =
'{
    "ids": ["ord_Y68t9B9n","ord_DhJG8xMb"],
    "document_type": "pdf"
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = order

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/orders/aggregated_documents'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "ids": ["ord_Y68t9B9n","ord_DhJG8xMb"],
    "document_type": "pdf"
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("ids", Json.createArrayBuilder()
                        .add("ord_2E1pWGRh")
                        .add("ord_DqKvSb9M")
                    )
                .add("document_type", "pdf")
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/aggregated_documents?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/orders/aggregated_documents

Search Orders

# Example is searching for NetSuite as the source system.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/orders/simple?api_key=YOUR_API_KEY&source_system=NetSuite'
require 'net/http'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/simple?api_key=YOUR_API_KEY&source_system=NetSuite')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/orders/simple?source_system=NetSuite'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/simple?api_key=YOUR_API_KEY&source_system=NetSuite");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed.");
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/orders/simple?source_system=NetSuite

Delete an Order

#'ord_DqKvSb9M' is an example order id.
curl -X DELETE 'https://sandbox.shiphawk.com/api/v4/orders/ord_DqKvSb9M?api_key=YOUR_API_KEY'
require 'net/http'

#'ord_Sq9Q39fx' is an example order id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx?api_key=YOUR_API_KEY')

# Create the HTTP objects
request = Net::HTTP::Delete.new(uri.request_uri)

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests

url = 'https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.delete(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class DeleteRequests {
    public static void main(String [] args)
    {
        try{
            sendDelete();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendDelete() throws IOException {
        // 'ord_YeZgVnBQ' is an example order id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/ord_YeZgVnBQ?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("DELETE");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_NO_CONTENT){
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("DELETE request failed. Code was " + responseCode);
        }
    }
}

DELETE https://sandbox.shiphawk.com/api/v4/orders/:id

Shipments

Shipment Resources

Shipment Request Object

Parameters are optional unless noted.

Parameter Type Description, Defaults
proposed_shipment_id String
rate_id String required
origin_address Hash required
Shipment Address Request object
destination_address hash required
Shipment Address Request object
pickup array[hash] List of:
{
start_time: DateTime
end_time: DateTime
}
accessorials Array[Hash] List of:
{
type: String
value: String
optional_value: String
}
reference_numbers Array[Hash] List of:
{
id: String
name: String
value: String
code: String
}
origin_instructions String
destination_instructions String
assignee_id String Default: nil
origin_network_location_id String
destination_network_location_id String
order_id String
order_number String
carrier String
service_name String
carrier_service_code String
label_format String Default: PDF values: ZPL, PDF
include_return_label Boolean Default: false
is_external Boolean
shipping_price Float Default: 0.0
tracking_number String
packages Array[Hash] List of Shipment Packages Without Rate Request objects.
eei Hash Object:
{
compliance: String, One of: itn, exemption_code
compliance_code: String (X20160406131357, NO EEI 30.37(a))
}

Allowed Exemption Codes:
NO EEI 30.02(d), NO EEI 30.36, NO EEI 30.37(a), NO EEI 30.37(b), NO EEI 30.37(f), NO EEI 30.37(g), NO EEI 30.37(h), NO EEI 30.37(i), NO EEI 30.37(j), NO EEI 30.37(k), NO EEI 30.37(l), NO EEI 30.37(p), NO EEI 30.39, NO EEI 30.40(a), NO EEI 30.40(b), NO EEI 30.40(c), NO EEI 30.40(d)

Shipment Address Request object

Parameter Type Description, Defaults
first_name String
last_name String
name String
street1 String
street2 String
country String
city String
state String
zip String
phone_number String
email String
company String
location_type String
code String
is_residential Boolean

Shipment Billing Details Request Object

Parameter Type Description, Defaults
bill_to string Required: One of: sender third_party recipient
carrier_code string
service_code string
account_number string
name string
company string
phone_number string
street1 string
street2 string
city string
state string
zip string
country string

Shipment Packages Without Rate Request Object

Parameter Type Description, Defaults
id String
length Float
width Float
height Float
weight Float
dry_ice_weight Float
value Float
freight_class String
tracking_number String
packing_type String
package_quantity Integer
package_type String
quantity Integer Default: 1
commidity_description String
carrier_container String
hazmat Boolean Default: false
orm_d Boolean Default: false
nmfc String
number_of_units Integer Default: 1
hazmat_data Hash Shipment Hazmat Data Request object
package_items Array List Of:
{
product_sku: String
id: String
value: String
hs_code: String
country_of_origin: String
description: String
}
handling_unit_packages Array Shipment Handling Unit Packages Request object

Shipment Handling Unit Packages Request Object

Attribute Type Description
package_type String
package_quantity Integer
weight Float
dry_ice_weight Float
nmfc String
freight_class String
hazmat Boolean Default: false
orm_d Boolean Default: false
number_of_units Integer
commodity_description String
hazmat_data Hash Shipment Hazmat Data Request object
package_items Array Proposed Shipment Package Item Request object

Shipment Hazmat Data Request Object

Attribute Type Description
un_or_na_number String
proper_shipping_name String
technical_name String
hazard_class_or_division String
packing_group String
emergency_response_phone_number String
emergency_contact_name String
emergency_contact_phone_number String
regulation_level String
container String
amount Float
amount_unit String
transportation_mode String ground passenger_aircraft cargo_aircraft_only (Can be left blank)
additional_description String

Proposed Shipment Package Item Request Object

Attribute Type Description
freight_class String
nmfc String
product_sku String
hs_code String
country_of_origin String
xid String
weight Float
value String
description String
order_line_item_id String
quantity Integer Default: 1

Shipment Response Object

{
    "id": "shp_8Wskd61X",
    "shid": 6395133,
    "status": "ordered",
    "origin_address": {
        "id": "badr_816JMXka",
        "name": "Parcel Origin",
        "company": "Example, Inc",
        "street1": "465 Hillview Ave",
        "street2": "Apt 5",
        "city": "GOLETA",
        "state": "CA",
        "zip": "93116",
        "country": "US",
        "phone_number": "",
        "email": null,
        "is_residential": false,
        "is_warehouse": false,
        "address_type": "commercial",
        "code": null
    },
    "destination_address": {
        "id": "badr_xVMhBK9j",
        "name": "Parcel Destination",
        "company": "Example, Inc",
        "street1": "925 De La Vina St",
        "street2": "Suite 8",
        "city": "SANTA BARBARA",
        "state": "CA",
        "zip": "93101",
        "country": "US",
        "phone_number": "",
        "email": null,
        "is_residential": false,
        "is_warehouse": false,
        "address_type": "commercial",
        "code": null
    },
    "carrier": "USPS",
    "carrier_code": "usps",
    "carrier_scac": "USPS",
    "carrier_type_code": "small_parcel",
    "is_external": false,
    "is_customer_tariff": true,
    "is_international": false,
    "service_name": "First-Class Mail",
    "service_level": null,
    "insurance_type": "no_insurance",
    "total_price": 4.94,
    "tracking_number": "9400110200864380488444",
    "documents": [
        {
            "id": "doc_BGT54Etg",
            "customer_uploaded": false,
            "type": "Package Labels Combined",
            "extension": "PDF",
            "code": "package_labels_combined",
            "url": "https://sandbox.shiphawk.com/api/v4/public/documents/files/edf8ce54b1f161d0f7ba21acb059aee7.pdf",
            "meta_data": {},
            "created_at": "2019-01-29T23:35:32.559+00:00"
        },
        {
            "id": "doc_kwDvXGHZ",
            "customer_uploaded": false,
            "type": "Package Labels Combined",
            "extension": "ZPL",
            "code": "package_labels_combined",
            "url": "https://sandbox.shiphawk.com/api/v4/public/documents/files/70c8f6d157a95aa10c0c60eef9ebf424.zpl",
            "meta_data": {},
            "created_at": "2019-01-29T23:35:32.379+00:00"
        },
        {
            "id": "doc_7M7nnvbt",
            "customer_uploaded": false,
            "type": "label for a package",
            "extension": "ZPL",
            "code": "package_label",
            "url": "https://sandbox.shiphawk.com/api/v4/public/documents/files/8bb792044ba47aa5119bb6c6870f2379.zpl",
            "meta_data": {},
            "created_at": "2019-01-29T23:35:31.941+00:00"
        }
    ],
    "price_details": {
        "shipping": 4.94,
        "packing": 0,
        "insurance": 0,
        "pickup": 0,
        "delivery": 0,
        "accessorials": 0,
        "duty": null,
        "taxes": null
    },
    "dispatch": null,
    "final_mile": null,
    "packages": [
        {
            "id": "pkg_MKWXs4X8",
            "tracking_number": "9400110200864380488444",
            "tracking_url": "https://tools.usps.com/go/TrackConfirmAction.action?tRef=fullpage&tLc=1&text28777=&tLabels=9400110200864380488444",
            "freight_class": null,
            "nmfc": null,
            "packing_type": "boxed",
            "package_type": null,
            "handling_unit_type": null,
            "quantity": 1,
            "package_quantity": 1,
            "length": 10,
            "width": 10,
            "height": 11,
            "weight": 0.9375,
            "dry_ice_weight": null,
            "value": 100,
            "volume": 0.64,
            "commodity_description": "",
            "label_document_id": "doc_7M7nnvbt",
            "orm_d": false,
            "hazmat": false,
            "carrier_container": null,
            "number_of_units": 1,
            "accessorials": [],
            "hazmat_data": {
                "un_or_na_number": null,
                "proper_shipping_name": null,
                "technical_name": null,
                "hazard_class_or_division": null,
                "packing_group": null,
                "emergency_response_phone_number": null,
                "emergency_contact_name": null,
                "emergency_contact_phone_number": null,
                "regulation_level": null,
                "container": null,
                "amount": null,
                "amount_unit": null,
                "transportation_mode": null,
                "additional_description": null
            },
            "package_items": [
                {
                    "id": "pkgi_YjcRjjjd",
                    "product_sku": null,
                    "product_upc": null,
                    "product_sku_packing_code": null,
                    "item_name": "Small Parcel",
                    "length": 10,
                    "width": 10,
                    "height": 11,
                    "weight": 0.9375,
                    "volume": 0.64,
                    "freight_class": null,
                    "nmfc": null,
                    "hs_code": null,
                    "country_of_origin": null,
                    "xid": null,
                    "value": 100,
                    "description": "",
                    "order_line_item_id": null,
                    "quantity": 1,
                    "order_line_item_source_system_id": null,
                    "order_line_item_source_system_line_number": null
                }
            ],
            "handling_unit_packages": [],
            "materials": [],
            "labors": [],
            "license_plate_number": null
        }
    ],
    "shipment_line_items": [
        {
            "order_line_item_id": null,
            "quantity": 1,
            "name": null,
            "description": null,
            "sku": null,
            "upc": null,
            "value": 100,
            "weight": 0.9375,
            "hs_code": null,
            "country_of_origin": null,
            "child_sku": null,
            "child_sku_quantity": null,
            "line_number": null,
            "origin_order_number": null,
            "is_kit": false,
            "kit_id": null
        }
    ],
    "assignee_id": null,
    "origin_network_location_id": null,
    "destination_network_location_id": null,
    "reference_numbers": [],
    "origin_instructions": null,
    "destination_instructions": null,
    "shiphawk_managed": false,
    "print_package_labels_enabled": true,
    "exceptions": [],
    "est_delivery_date": "2019-01-30T00:00:00.000+00:00",
    "service_days": null,
    "order_id": null,
    "order_number": null,
    "combined_order_numbers": [],
    "label_url": "https://sandbox.shiphawk.com/api/v4/public/documents/files/edf8ce54b1f161d0f7ba21acb059aee7.pdf",
    "label_format": "PDF",
    "label_document_id": "doc_BGT54Etg",
    "label_pdf_url": "https://sandbox.shiphawk.com/api/v4/public/documents/files/edf8ce54b1f161d0f7ba21acb059aee7.pdf",
    "label_pdf_document_id": "doc_BGT54Etg",
    "label_zpl_url": "https://sandbox.shiphawk.com/api/v4/public/documents/files/70c8f6d157a95aa10c0c60eef9ebf424.zpl",
    "label_zpl_document_id": "doc_kwDvXGHZ",
    "carrier_report_date": null,
    "created_at": "2019-01-29T23:35:31.073+00:00",
    "created_by": {
        "type": "api",
        "name": "API"
    },
    "updated_at": "2019-01-29T23:35:32.272+00:00",
    "actual_pickup_time": null,
    "xid": null,
    "shipment_billing": null,
    "duties_taxes_billing": null,
    "packing_slip_template": null,
    "can_attach_bol": false,
    "cannot_attach_bol_reason": "Carrier does not support printing of BOL",
    "accessorials": [],
    "is_generate_commercial_invoice": false,
    "can_dispatch": false,
    "ship_date": "2019-01-29T23:35:31.012+00:00",
    "eei": {
        "compliance": null,
        "compliance_code": null
    }
}
Attribute Type Description
id string
shid integer
origin_address hash Booking Address object
destination_address hash Booking Address object
carrier string
carrier_code string
carrier_scac string
carrier_type_code string
is_external boolean
is_customer_tariff boolean
is_international boolean
service_name string
service_level string
insurance_type string
total_price string
tracking_number string
documents array[hash] {
id: string
customer_uploaded :boolean
type: string
extension: string
code: string
url: string
meta_data: hash
created_at: float
}
price_details hash Price Details Response object
dispatch_details hash {
id: string
pickup_date: date
pickup_start_time: date
pickup_end_time: date
dispatch_instructions: string
sent_at: date
sent_type: string
confirmed_at: date
confirmation_number: string
bol_number: string
status: string
shipment_id: string
error_message: string
}
final_mile string
packages array[hash] List of Package Response Objects
shipment_line_items array[hash] List of:
{
order_line_item_id: integer
quantity: integer
name: string
description: string
sku: string
upc: string
value: float
weight: float
hs_code: string
country_of_origin: string
child_sku: string
child_sku_quantity: integer
line_number: integer
origin_order_number: string
}
assignee_id string
origin_network_location_id string
destination_network_location_id string
reference_numbers array[object] List Of:
{
id: string
code: string
value: string
name: string
}
origin_instruction string
destination_instructions string
shiphawk_managed boolean
is_external boolean
print_package_labels_enabled boolean
exceptions array[hash] List of:
{
id: string
is_resolved: boolean
resolved_at: date
created_at: date
}
est_delivery_date datetime
service_days integer
order_id string
order_number string
combined_order_numbers array[string]
label_url string
label_format string
label_document_id string
label_pdf_url string
label_pdf_document_id string
label_zpl_url string
label_zpl_document_id string
carrier_report_date string
label_source string
created_at datetime
created_by hash {
type: string
name: string
}
updated_at datetime
actual_pickup_time datetime
shipment_billing hash Shipment Billing Details Response object
duties_taxes_billing hash Shipment Billing Details Response object
packing_slip_template hash {
size: string
advanced_size: string
}
can_attach_bol boolean
cannot_attach_bol_reason string
accessorials array[object] List of Shipment Accessorial Response objects
is_generate_commercial_invoice boolean
can_dispatch boolean
ship_date boolean
eei Hash Object:
{
compliance: String
compliance_code: String
}

Shipment Billing Details Response Object

Attribute Type Description
shortcut_account_number string
account_number string
name string
company string
phone_number string
street1 string
street2 string
city string
state string
country string
zip string
country string
bill_to string Required: One of: sender third_party recipient
carrier_code string
service_code string
service_name string

Shipment Accessorial Response Object

Attribute Type Description
accessorial_type string
cod_amount string Present if accessorial is collect on delivery
payment_types array[string]
remittance_address hash Booking Address object
add_freight_charges boolean
price float

Shipment API Endpoints

Cancel a Shipment

#'shp_Hcy0ZwR1' is an example shipment id.
curl -X DELETE 'https://sandbox.shiphawk.com/api/v4/shipments/shp_Hcy0ZwR1?api_key=YOUR_API_KEY'
require 'net/http'

#'shp_yYtFWAhc' is an example shipment id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/shp_yYtFWAhc?api_key=YOUR_API_KEY')

# Create the HTTP objects
request = Net::HTTP::Delete.new(uri.request_uri)

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests

url = 'https://sandbox.shiphawk.com/api/v4/shipments/shp_yYtFWAhc'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.delete(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class DeleteRequests {
    public static void main(String [] args)
    {
        try{
            sendDelete();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendDelete() throws IOException {
        // 'shp_Tsa5fTbk' is an example shipment id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/shp_Tsa5fTbk?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("DELETE");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_NO_CONTENT || responseCode == HttpURLConnection.HTTP_OK){     
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("DELETE request failed. Code was " + responseCode);
        }
    }
}

DELETE https://sandbox.shiphawk.com/api/v4/shipments/:id

Create a New Shipment

curl -H "Content-Type: application/json" -X POST -d '
{
    "rate_id":"rate_5SNcd9293WRhPdNBgqPRN4KG",
    "origin_address": {
        "name": "Parcel Origin",
        "company": "Example, Inc",
        "street1": "465 Hillview Ave",
        "street2": "Apt 5",
        "zip": "93116"
    },
    "destination_address": {
        "name": "Parcel Destination",
        "company": "Example, Inc",
        "street1": "925 De La Vina St",
        "street2": "Suite 8",
        "zip": "93101"
    }
}' 'https://sandbox.shiphawk.com/api/v4/shipments/?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments?api_key=YOUR_API_KEY')

shipment =
'{
    "rate_id":"rate_5SNcd9293WRhPdNBgqPRN4KG",
    "origin_address": {
        "name": "Parcel Origin",
        "company": "Example, Inc",
        "street1": "465 Hillview Ave",
        "street2": "Apt 5",
        "zip": "93116"
    },
    "destination_address": {
        "name": "Parcel Destination",
        "company": "Example, Inc",
        "street1": "925 De La Vina St",
        "street2": "Suite 8",
        "zip": "93101"
    }
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = shipment

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/shipments'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "rate_id":"rate_5SNcd9293WRhPdNBgqPRN4KG",
    "origin_address": {
        "name": "Parcel Origin",
        "company": "Example, Inc",
        "street1": "465 Hillview Ave",
        "street2": "Apt 5",
        "zip": "93116"
    },
    "destination_address": {
        "name": "Parcel Destination",
        "company": "Example, Inc",
        "street1": "925 De La Vina St",
        "street2": "Suite 8",
        "zip": "93101"
    }
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("rate_id", "rate_3FqhSS7eakakwn9TeFccRV89")
                .add("origin_address", Json.createObjectBuilder()
                    .add("name", "Parcel Origin")
                    .add("company", "Example, Inc")
                    .add("street1", "465 Hillview Ave")
                    .add("street2", "Apt 5")
                    .add("zip", "93116")
                    )
                .add("destination_address", Json.createObjectBuilder()
                    .add("name", "Parcel Destination")
                    .add("company", "Example, Inc")
                    .add("street1", "925 De La Vina St")
                    .add("street2", "Suite 8")
                    .add("zip", "93101")
                    )
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){     
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/shipments/?api_key=YOUR_API_KEY

Create a New External Shipment

curl -H "Content-Type: application/json" -X POST -d '
{
        "assignee_id": null,
        "origin_instructions": "Look for Patty Mayonaise she has the goods",
        "destination_instructions": "The secret knock is the Funky Town Beat",
        "reference_numbers": [
            {"code": "invoice_id", "value": "first_value"},
                        {"code": "other_id", "value": "second_value", "name": "if code ZZ"}],
        "origin_address": {
            "name": "Parcel Origin",
            "company": "Parcel Origin Company",
            "phone_number": "5555551212",
            "email": "parcel_origin@test.com",
            "street1": "123 Small Parcel Circle",
            "street2": "Apt 5",
            "city": "Chicago",
            "state": "IL",
            "zip": "60060",
            "country": "US"
        },
        "destination_address": {
            "name": "Parcel Destination",
            "company": "Parcel Destination Company",
            "phone_number": "8055557777",
            "email": "parcel_destination@email.com",
            "street1": "555 Small Parcel Delivered",
            "street2": "Suite 8",
            "city": "Santa Barbara",
            "state": "CA",
            "zip": "93105",
            "country": "US"
        },
        "carrier":"usps",
        "service_name":"Priority Mail"
    }' 'https://sandbox.shiphawk.com/api/v4/external_shipments?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/external_shipments?api_key=YOUR_API_KEY')

shipment =
'{
        "assignee_id": null,
        "origin_instructions": "Look for Patty Mayonaise she has the goods",
        "destination_instructions": "The secret knock is the Funky Town Beat",
        "reference_numbers": [
            {"code": "invoice_id", "value": "first_value"},
                        {"code": "other_id", "value": "second_value", "name": "if code ZZ"}],
        "origin_address": {
            "name": "Parcel Origin",
            "company": "Parcel Origin Company",
            "phone_number": "5555551212",
            "email": "parcel_origin@test.com",
            "street1": "123 Small Parcel Circle",
            "street2": "Apt 5",
            "city": "Chicago",
            "state": "IL",
            "zip": "60060",
            "country": "US"
        },
        "destination_address": {
            "name": "Parcel Destination",
            "company": "Parcel Destination Company",
            "phone_number": "8055557777",
            "email": "parcel_destination@email.com",
            "street1": "555 Small Parcel Delivered",
            "street2": "Suite 8",
            "city": "Santa Barbara",
            "state": "CA",
            "zip": "93105",
            "country": "US"
        },
        "carrier":"usps",
        "service_name":"Priority Mail"
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = shipment

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/external_shipments'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
        "assignee_id": null,
        "origin_instructions": "Look for Patty Mayonaise she has the goods",
        "destination_instructions": "The secret knock is the Funky Town Beat",
        "reference_numbers": [
            {"code": "invoice_id", "value": "first_value"},
                        {"code": "other_id", "value": "second_value", "name": "if code ZZ"}],
        "origin_address": {
            "name": "Parcel Origin",
            "company": "Parcel Origin Company",
            "phone_number": "5555551212",
            "email": "parcel_origin@test.com",
            "street1": "123 Small Parcel Circle",
            "street2": "Apt 5",
            "city": "Chicago",
            "state": "IL",
            "zip": "60060",
            "country": "US"
        },
        "destination_address": {
            "name": "Parcel Destination",
            "company": "Parcel Destination Company",
            "phone_number": "8055557777",
            "email": "parcel_destination@email.com",
            "street1": "555 Small Parcel Delivered",
            "street2": "Suite 8",
            "city": "Santa Barbara",
            "state": "CA",
            "zip": "93105",
            "country": "US"
        },
        "carrier":"usps",
        "service_name":"Priority Mail"
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("rate_id", "rate_3FqhSS7eakakwn9TeFccRV89")
                .add("origin_address", Json.createObjectBuilder()
                    .add("name", "Parcel Origin")
                    .add("company", "Parcel Origin Company")
                    .add("phone_number", "5555551212")
                    .add("email", "parcel_origin@test.com")
                    .add("street1", "123 Small Parcel Circle")
                    .add("street2", "Apt 5")
                    .add("city", "Chicago")
                    .add("state", "IL")
                    .add("zip", "60060")
                    .add("country", "US")
                    )
                .add("destination_address", Json.createObjectBuilder()
                    .add("name", "Parcel Destination")
                    .add("company", "Parcel Destination Company")
                    .add("phone_number", "8055557777")
                    .add("email", "parcel_destination@email.com")
                    .add("street1", "555 Small Parcel Delivered")
                    .add("street2", "Suite 8")
                    .add("city", "Santa Barbara")
                    .add("state", "CA")
                    .add("zip", "93105")
                    .add("country", "US")
                    )
                .add("carrier", "usps")
                .add("service_name", "Priority Mail")
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            URL url = new URL("https://sandbox.shiphawk.com/api/v4/external_shipments?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){     
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/external_shipments

List all Shipments

curl -X GET 'https://sandbox.shiphawk.com/api/v4/shipments?api_key=YOUR_API_KEY'
require 'net/http'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/shipments'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments?api_key=YOUR_API_KEY&source_system=NetSuite");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){      
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed.");
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/shipments

Retrieve a Shipment

#'shp_becFaAAj' is an example shipment external id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/shipments/shp_becFaAAj/?api_key=YOUR_API_KEY'
require 'net/http'

#'shp_8Wskd61X' is an example shipment id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/shp_8Wskd61X?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/shipments/shp_8Wskd61X'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'shp_xxP5vPQm' is an example shipment id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/shp_xxP5vPQm?api_key=YOUR_API_KEY&source_system=NetSuite");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){      
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed.");
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/shipments/:id

Retrieve the URL of a BOL PDF File

#`shp_CkSqDRPW` is an example shipment id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/shipments/shp_CkSqDRPW/bol?api_key=YOUR_API_KEY'
require 'net/http'

#'shp_8Wskd61X' is an example shipment id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/shp_8Wskd61X/bol?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/shipments/shp_8Wskd61X/bol'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'shp_xxP5vPQm' is an example shipment id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/shp_xxP5vPQm/bol?api_key=YOUR_API_KEY&source_system=NetSuite");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){      
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed.");
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/shipments/:id/bol

Retrieve the URL of a Commercial Invoice PDF file

#'shp_CkSqDRPW' is an example shipment id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/shipments/shp_CkSqDRPW/commercial_invoice?api_key=YOUR_API_KEY'
require 'net/http'

#'shp_8Wskd61X' is an example shipment id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/shp_8Wskd61X/commercial_invoice?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/shipments/shp_8Wskd61X/commercial_invoice'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'shp_xxP5vPQm' is an example shipment id, assuming commercial invoice is necessary for shipment.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/shp_xxP5vPQm/commercial_invoice?api_key=YOUR_API_KEY&source_system=NetSuite");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){      
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/shipments/:id/commercial_invoice

Retrieve the URL of an Address Label PDF File

#`shp_CkSqDRPW` is an example shipment id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/shipments/shp_CkSqDRPW/address_labels?api_key=YOUR_API_KEY'
require 'net/http'

#'shp_8Wskd61X' is an example shipment id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/shp_8Wskd61X/address_labels?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/shipments/shp_8Wskd61X/address_labels'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'shp_xxP5vPQm' is an example shipment id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/shp_xxP5vPQm/address_labels?api_key=YOUR_API_KEY&source_system=NetSuite");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){      
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/shipments/:id/address_labels

Retrieve the URL of the label(s) for a Parcel Shipment

#`shp_CkSqDRPW` is an example shipment id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/shipments/shp_CkSqDRPW/labels?api_key=YOUR_API_KEY'
require 'net/http'

#'shp_8Wskd61X' is an example shipment id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/shp_8Wskd61X/labels?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/shipments/shp_8Wskd61X/labels'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'shp_xxP5vPQm' is an example shipment id, assuming commercial invoice is necessary for shipment.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/shp_xxP5vPQm/labels?api_key=YOUR_API_KEY&source_system=NetSuite");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){      
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/shipments/:id/labels

Retrieve the Packing Slip of a shipment

#'shp_CkSqDRPW' is an example shipment id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/shipments/shp_CkSqDRPW/packing_slip?api_key=YOUR_API_KEY'
require 'net/http'

#'shp_8Wskd61X' is an example shipment id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/shp_8Wskd61X/packing_slip?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/shipments/shp_8Wskd61X/packing_slip'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'shp_xxP5vPQm' is an example shipment id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/shp_xxP5vPQm/packing_slip?api_key=YOUR_API_KEY&source_system=NetSuite");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){      
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/shipments/:id/packing_slip

Retrieve Count of Shipments Grouped By Status

curl -X GET 'https://sandbox.shiphawk.com/api/v4/shipments/search_count?api_key=YOUR_API_KEY'
require 'net/http'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/search_count?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/shipments/search_count'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/search_count?api_key=YOUR_API_KEY&source_system=NetSuite");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){      
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/shipments/search_count

Search Shipments

#`shp_CkSqDRPW` is an example shipment id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/shipments/?api_key=YOUR_API_KEY&id=shp_CkSqDRPW'
require 'net/http'

#'shp_8Wskd61X' is an example shipment id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/api_key=YOUR_API_KEY&id=shp_8Wskd61X')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/shipments/id=shp_8Wskd61X'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'shp_xxP5vPQm' is an example shipment id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments?api_key=YOUR_API_KEY&id=shp_xxP5vPQm");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){      
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/shipments?id=shp_CkSqDRPW

Track Shipment

#'shp_CkSqDRPW' is an example shipment id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/shipments/shp_CkSqDRPW/tracking?api_key=YOUR_API_KEY'
require 'net/http'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/shp_8Wskd61X/tracking?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/shipments/shp_8Wskd61X/tracking'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'shp_xxP5vPQm' is an example shipment id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/shp_xxP5vPQm/tracking?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){      
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/shipments/:id/tracking

Track Shipment Subscription

#`shp_CkSqDRPW` is an example shipment id.
curl -H "Content-Type: application/json" -X POST -d '
{
    "callback_url": "valid_url"
}' 'https://sandbox.shiphawk.com/api/v4/shipments/shp_CkSqDRPW/tracking?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

#'shp_XMMB707d' is an example shipment id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/shp_XMMB707d?api_key=YOUR_API_KEY')

shipment =
'{
    "callback_url": "valid_url"
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = shipment

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests

url = 'https://sandbox.shiphawk.com/api/v4/shipments/shp_XMMB707d/tracking'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.post(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("callback_url", "valid_url")
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            // 'shp_xxP5vPQm' is an example shipment id.
            URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/shp_xxP5vPQm/tracking?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){     
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/shipments/:id/tracking

Update an Existing Shipment

#`shp_becFaAAj` is an example external shipment id.
curl -H "Content-Type: application/json" -X POST -d '
{
    "status": "delivered",
    "tracking_number": "Track my ship",
    "origin_instructions": "Instructions for the man with the pickup truck",
    "destination_instructions": "Instructions for the man with the bigger pickup truck",
  "itn_confirmation_number": 1343,
  "origin_address": {
        "company": "Example, Inc",
        "street1": "465 Hillview Ave",
        "street2": null,
        "phone_number": "1234567890",
        "email": "order@example.org"
  },
  "destination_address": {
        "company": "Example, Inc",
        "street1": "465 Hillview Ave",
        "street2": null,
        "phone_number": "1234567890",
        "email": "order@example.org"
  }
}' 'https://sandbox.shiphawk.com/api/v4/shipments/shp_becFaAAj/?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

#include 'shp_XMMB707d' is an example shipment id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/shp_XMMB707d?api_key=YOUR_API_KEY')

shipment =
'{
    "status": "delivered",
    "tracking_number": "Track my ship",
    "origin_instructions": "Instructions for the man with the pickup truck",
    "destination_instructions": "Instructions for the man with the bigger pickup truck",
  "itn_confirmation_number": 1343,
  "origin_address": {
        "company": "Example, Inc",
        "street1": "465 Hillview Ave",
        "street2": null,
        "phone_number": "1234567890",
        "email": "order@example.org"
  },
  "destination_address": {
        "company": "Example, Inc",
        "street1": "465 Hillview Ave",
        "street2": null,
        "phone_number": "1234567890",
        "email": "order@example.org"
  }
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = shipment

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/shipments/shp_XMMB707d'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "status": "delivered",
    "tracking_number": "Track my ship",
    "origin_instructions": "Instructions for the man with the pickup truck",
    "destination_instructions": "Instructions for the man with the bigger pickup truck",
  "itn_confirmation_number": 1343,
  "origin_address": {
        "company": "Example, Inc",
        "street1": "465 Hillview Ave",
        "street2": null,
        "phone_number": "1234567890",
        "email": "order@example.org"
  },
  "destination_address": {
        "company": "Example, Inc",
        "street1": "465 Hillview Ave",
        "street2": null,
        "phone_number": "1234567890",
        "email": "order@example.org"
  }
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("status", "delivered")
                .add("tracking_number", "Track my ship")
                .add("origin_instructions", "Instructions for the man with the pickup truck")
                .add("destination_instructions", "Instructions for the man with the bigger pickup truck")
                .add("itn_confirmation_number", "1343")
                .add("origin_address", Json.createObjectBuilder()
                        .add("company", "Example, Inc")
                        .add("street1", "465 Hillview Ave")
                        .add("street2", "null")
                        .add("phone_number", "1234567890")
                        .add("email", "order@example.org")
                    )
                .add("destination_address", Json.createObjectBuilder()
                        .add("company", "Example, Inc")
                        .add("street1", "465 Hillview Ave")
                        .add("street2", "null")
                        .add("phone_number", "1234567890")
                        .add("email", "order@example.org")
                    )
                .add("destination_address", "valid_url")
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            // 'shp_xxP5vPQm' is an example shipment id.
            URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/shp_xxP5vPQm?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){     
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/shipments/:id

Proposed Shipments

Proposed Shipment Resources

Proposed Shipment Request Object

Parameters are optional unless specified.

Parameter Type Description, Defaults
rate_id String
ship_date Date
tracking_number String
service_name String
service_code String
carrier_code String
insurance_option String One of: add_insurance no_insurance
self_packed Boolean
license_plate_number
packages Array List of Proposed Shipment Package Request objects
pro_number String
origin_instructions String
destination_instructions String
origin_address Hash Object
{
first_name: String
last_name: String
name: String
street1: String
street2: String
country: String
city: String
state: String
zip: String
phone_number: String
email: String
company: String
location_type: String
code: String
is_residential: Boolean
}
destination_address Hash Object
{
first_name: String
last_name: String
name: String
street1: String
street2: String
country: String
city: String
state: String
zip: String
phone_number: String
email: String
company: String
location_type: String
code: String
is_residential: Boolean
is_po_box: Boolean (Optional)
}
alternate_return_address Hash Object
{
first_name: String
last_name: String
name: String
street1: String
street2: String
country: String
city: String
state: String
zip: String
phone_number: String
email: String
company: String
location_type: String
code: String
is_residential: Boolean
is_po_box: Boolean (Optional)
}
reference_numbers Array List of Reference Number Request objects
fees Hash Object:
{
insurance: Hash
{
active: Boolean (Default: false) required
}
}
origin_accessorials Array[Object] List of:
{
type: String required
value: String
option_value: String
}
destination_accessorials Array[Object] List of:
{
type: String required
value: String
option_value: String
}
include_return_label Boolean Default: false
shipment_billing Hash Shipment Billing Details Request object
duties_taxes_billing Hash Shipment Billing Details Request object
pickup Hash Object:
{
start_time: DateTime
end_time: DateTime
}
shipment_line_items Array[Hash] Array of hashes representing the shipment line items for this proposed shipment:
{
quantity: Integer
sku: String
name: String
value: Float
weight: Float
weight_uom: String (One of: lbs, oz)
description: String
hs_code: String
country_of_origin: String
upc: String
child_sku: String
child_sku_quantity: Integer
line_number: Integer
order_line_item_id: String
}
warehouse_code String
is_external Boolean
shipping_price Float Default: 0.0
carrier_name String
eei Hash Object:
{
compliance: String, One of: itn, exemption_code
compliance_code: String (X20160406131357, NO EEI 30.37(a))
}

Allowed Exemption Codes:
NO EEI 30.02(d), NO EEI 30.36, NO EEI 30.37(a), NO EEI 30.37(b), NO EEI 30.37(f), NO EEI 30.37(g), NO EEI 30.37(h), NO EEI 30.37(i), NO EEI 30.37(j), NO EEI 30.37(k), NO EEI 30.37(l), NO EEI 30.37(p), NO EEI 30.39, NO EEI 30.40(a), NO EEI 30.40(b), NO EEI 30.40(c), NO EEI 30.40(d)

Proposed Shipment Response Object

{
    "id": "pshp_pHVCw8qS",
    "carrier": "USPS",
    "carrier_code": "usps",
    "service_name": "Priority Mail",
    "estimated_delivery_date": null,
    "service_days": null,
    "standardized_service_name": "Ground",
    "carrier_type": "Small Parcel",
    "tariff_insurance_rule": null,
    "is_customer_tariff": null,
    "insurance_type": "no_insurance",
    "order_id": "ord_K3JZv43A",
    "total_price": 0,
    "final_mile": {
        "price": 0,
        "final_mile_service_name": null,
        "final_mile_service_days": null,
        "using_final_mile_carrier": null,
        "final_mile_carrier": null
    },
    "price_details": {
        "shipping": 0,
        "packing": 0,
        "insurance": 0,
        "accessorials": 0,
        "duties": 0,
        "taxes": 0
    },
    "origin_address": {
        "name": "Name",
        "company": "Test Company",
        "street1": "1 FIRST ST",
        "street2": null,
        "city": "SANTA BARBARA",
        "state": "CA",
        "zip": "93000",
        "country": "US",
        "phone_number": "5551234567",
        "email": "email@example.com",
        "is_residential": false,
        "is_po_box": false,
        "address_type": "commercial"
    },
    "destination_address": {
        "name": "Name",
        "company": "Test Company",
        "street1": "2 FIRST ST",
        "street2": null,
        "city": "Santa Barbara",
        "state": "CA",
        "zip": "93002",
        "country": "US",
        "phone_number": "5561234567",
        "email": "email@example.com",
        "is_residential": true,
        "is_po_box": false,
        "address_type": "residential"
    },
    "alternate_return_address": null,
    "origin_accessorials": [],
    "destination_accessorials": [],
    "origin_instructions": null,
    "destination_instructions": null,
    "packages": [
        {
            "id": "pkg_SEh6CF4d",
            "length": null,
            "width": null,
            "height": null,
            "weight": 2,
            "dry_ice_weight": null,
            "volume": null,
            "value": 425,
            "freight_class": null,
            "nmfc": null,
            "packing_type": "parcel",
            "package_type": null,
            "package_quantity": 0,
            "quantity": 1,
            "commodity_description": "",
            "hazmat": false,
            "carrier_container": null,
            "unpacked_item_type_id": null,
            "unpacked_item_type_name": null,
            "number_of_units": 1,
            "orm_d": false,
            "hazmat_data": {
                "un_or_na_number": null,
                "proper_shipping_name": null,
                "technical_name": null,
                "hazard_class_or_division": null,
                "packing_group": null,
                "emergency_response_phone_number": null,
                "emergency_contact_name": null,
                "emergency_contact_phone_number": null,
                "regulation_level": null,
                "container": null,
                "amount": null,
                "amount_unit": null,
                "transportation_mode": null,
                "additional_description": null
            },
            "materials": [],
            "labors": [],
            "package_items": [
                {
                    "id": null,
                    "product_sku": null,
                    "product_upc": null,
                    "product_sku_packing_code": null,
                    "product_child_sku": null,
                    "product_child_sku_quantity": null,
                    "item_name": "Small Parcel",
                    "description": null,
                    "length": 1,
                    "width": 1,
                    "height": 1,
                    "weight": 1,
                    "volume": 0,
                    "value": 1,
                    "unpacked_item_type_id": 0,
                    "require_crating": null,
                    "freight_class": null,
                    "nmfc": null,
                    "hs_code": null,
                    "country_of_origin": null,
                    "xid": null,
                    "quantity": 1,
                    "order_line_item_id": null,
                    "order_line_item_source_system_id": null,
                    "order_line_item_source_system_line_number": null
                },
                {
                    "id": null,
                    "product_sku": null,
                    "product_upc": null,
                    "product_sku_packing_code": null,
                    "product_child_sku": null,
                    "product_child_sku_quantity": null,
                    "item_name": "Small Parcel",
                    "description": null,
                    "length": 1,
                    "width": 1,
                    "height": 1,
                    "weight": 1,
                    "volume": 0,
                    "value": 1,
                    "unpacked_item_type_id": 0,
                    "require_crating": null,
                    "freight_class": null,
                    "nmfc": null,
                    "hs_code": null,
                    "country_of_origin": null,
                    "xid": null,
                    "quantity": 1,
                    "order_line_item_id": null,
                    "order_line_item_source_system_id": null,
                    "order_line_item_source_system_line_number": null
                }
            ],
            "handling_unit_packages": [],
            "accessorials": [],
            "license_plate_number": null
        }
    ],
    "shipment_line_items": [
        {
            "order_line_item_id": null,
            "quantity": 1,
            "name": "Sample",
            "description": "Description",
            "sku": "AAA",
            "upc": null,
            "value": 225,
            "weight": 1,
            "hs_code": null,
            "country_of_origin": null,
            "child_sku": null,
            "child_sku_quantity": null,
            "line_number": null,
            "origin_order_number": null,
            "is_kit": false,
            "kit_id": null
        },
        {
            "order_line_item_id": null,
            "quantity": 1,
            "name": "Sample2",
            "description": "Description",
            "sku": "BBB",
            "upc": null,
            "value": 200,
            "weight": 1,
            "hs_code": null,
            "country_of_origin": null,
            "child_sku": null,
            "child_sku_quantity": null,
            "line_number": null,
            "origin_order_number": null,
            "is_kit": false,
            "kit_id": null
        }
    ],
    "ship_date": "2019-01-25T09:00:00-06:00",
    "created_at": "2019-01-24T23:27:31+00:00",
    "policies_applied": [],
    "fees": {
        "insurance": {
            "active": false
        }
    },
    "include_return_label": false,
    "shipment_billing": null,
    "duties_taxes_billing": null,
    "reference_numbers": [],
    "warehouse_code": null,
    "warehouse_id": null,
    "error_message": "No Rates Available",
    "rate_id": null,
    "status": "unprocessed",
    "license_plate_number": null,
    "all_license_plate_numbers": [],
    "is_external": false,
    "carrier_name": null,
    "shipping_price": 0,
    "tracking_number": null,
    "is_dropship": null,
    "is_backordered": null,
    "eei": {
        "compliance": null,
        "compliance_code": null
    }
}

A proposed shipment is information describing a shipment that hasn't been created yet. You can use either a Rate or a Proposed Shipment in order to create a new shipment.

Attribute Type Description
id string
carrier string
carrier_code string
service_name string
estimated_delivery_date date ISO 8601 formatted estimated date of delivery, i.e., YYYY-MM-DD
service_days integer Estimated number of days required to complete the delivery service.
standardized_service_name string Specifies which standardized service is being used for the proposed shipment:
Ground Guaranteed Freight International Economy International Priority Local Delivery Next Day Restricted Ground Room of Choice Same-Day Freight Standard Courier Standard Freight Standard Vehicle Three-Day Threshold Two-Day White Glove
carrier_type string One of:
truckload blanket_wrap courier small_parcel ltl intermodal auto auto local_delivery home_delivery final_mile custom_carrier
tariff_insurance_rule string One of:
carrier third_party no_insurance
is_customer_tariff boolean Indicates whether this shipment will be booked using your tariff or ShipHawk's tariff
insurance_type string One of:
no_insurance carrier third_party shiphawk or declined
order_id string Public ID of related Order.
total_price float Sum of all of the prices in the price_details attribute
final_mile object Object:
{
price: float
final_mile_service_name: string
final_mile_service_days: integer
using_final_mile_carrier: boolean
final_mile_carrier: string
}
price_details object Object:
{
shipping: Float
packing: Float
insurance: Float
accessorials: Float
duties: Float
taxes: Float
}
origin_address object Optional:
{
name: String
company: String
street1: String
street2: String
city: String
state: String
zip: String
country: String
phone_number: String
email: String
is_residential: Boolean
is_po_box: Boolean
address_type: String
}
destination_address object Optional:
{
name: String
company: String
street1: String
street2: String
city: String
state: String
zip: String
country: String
phone_number: String
email: String
is_residential: Boolean
is_po_box: Boolean
address_type: String
}
alternate_return_address object Optional:
{
name: String
company: String
street1: String
street2: String
city: String
state: String
zip: String
country: String
phone_number: String
email: String
is_residential: Boolean
is_po_box: Boolean
address_type: String
}
origin_accessorials array[object] Array of Object:
{
id: integer
price: float
side: string
name: string
default: boolean
type: string
accessorial_type: string
value: any type
option_value: string
accessorial_options: {
title: string
value: string
}
}
destination_accessorials array[object] Array of Object:
{
id: integer
price: float
side: string
name: string
default: boolean
type: string
accessorial_type: string
value: any type
option_value: string
accessorial_options: {
title: string
value: string
}
}
origin_instructions string
destination_instructions string
packages array[object] Proposed Shipment Package Response Object
shipment_line_items array[hash] Array of hashes representing the shipment line items for this proposed shipment:
{
order_line_item_id: integer
quantity: integer
name: string
description: string
sku: string
upc: string
value: float
weight: float
hs_code: string
country_of_origin: string
child_sku: string
child_sku_quantity: integer
line_number: integer
origin_order_number: string
}
ship_date string ISO 8601 formatted date, i.e. YYYY-MM-DD
created_at string ISO 8601 formatted date, i.e. YYYY-MM-DD
policies_applied object Object representing the rating rules applied for rating:
{
id: string
name: string
}
fees object Object determining whether there are active fees (currently supporting insurance fees):
{
insurance: json (returns active: proposed_shipment.is_insurance_requested)
}
include_return_label boolean
shipment_billing object Shipment Billing Details Response object
duties_taxes_billing object Shipment Billing Details Response object
reference_numbers object Object:
{
id: integer
code: string
value: string
name: string
}
warehouse_code string
warehouse_id string
error_message string
rate_id string
status string
license_plate_number string
all_license_plate_numbers array Array of string
is_external boolean
carrier_name string
shipping_price float
tracking_number string
is_dropship boolean
is_backordered boolean
eei Hash Object:
{
compliance: String
compliance_code: String
}

Proposed Shipment Package Response Object

{
    "id": "pkg_SEh6CF4d",
    "length": null,
    "width": null,
    "height": null,
    "weight": 2,
    "dry_ice_weight": null,
    "volume": null,
    "value": 425,
    "freight_class": null,
    "nmfc": null,
    "packing_type": "parcel",
    "package_type": null,
    "package_quantity": 0,
    "quantity": 1,
    "commodity_description": "",
    "hazmat": false,
    "carrier_container": null,
    "unpacked_item_type_id": null,
    "unpacked_item_type_name": null,
    "number_of_units": 1,
    "orm_d": false,
    "hazmat_data": {
        "un_or_na_number": null,
        "proper_shipping_name": null,
        "technical_name": null,
        "hazard_class_or_division": null,
        "packing_group": null,
        "emergency_response_phone_number": null,
        "emergency_contact_name": null,
        "emergency_contact_phone_number": null,
        "regulation_level": null,
        "container": null,
        "amount": null,
        "amount_unit": null,
        "transportation_mode": null,
        "additional_description": null
    },
    "materials": [],
    "labors": [],
    "package_items": [
        {
            "id": null,
            "product_sku": null,
            "product_upc": null,
            "product_sku_packing_code": null,
            "product_child_sku": null,
            "product_child_sku_quantity": null,
            "item_name": "Small Parcel",
            "description": null,
            "length": 1,
            "width": 1,
            "height": 1,
            "weight": 1,
            "volume": 0,
            "value": 1,
            "unpacked_item_type_id": 0,
            "require_crating": null,
            "freight_class": null,
            "nmfc": null,
            "hs_code": null,
            "country_of_origin": null,
            "xid": null,
            "quantity": 1,
            "order_line_item_id": null,
            "order_line_item_source_system_id": null,
            "order_line_item_source_system_line_number": null
        },
        {
            "id": null,
            "product_sku": null,
            "product_upc": null,
            "product_sku_packing_code": null,
            "product_child_sku": null,
            "product_child_sku_quantity": null,
            "item_name": "Small Parcel",
            "description": null,
            "length": 1,
            "width": 1,
            "height": 1,
            "weight": 1,
            "volume": 0,
            "value": 1,
            "unpacked_item_type_id": 0,
            "require_crating": null,
            "freight_class": null,
            "nmfc": null,
            "hs_code": null,
            "country_of_origin": null,
            "xid": null,
            "quantity": 1,
            "order_line_item_id": null,
            "order_line_item_source_system_id": null,
            "order_line_item_source_system_line_number": null
        }
    ],
    "handling_unit_packages": [],
    "accessorials": [],
    "license_plate_number": null
}

A proposed shipment is information describing a shipment that hasn't been created yet. You can use either a Rate or a Proposed Shipment in order to create a new shipment.

Attribute Type Description, Defaults
id string
length float
width float
height float
weight float
dry_ice_weight float
volume float
value float
freight_class string
nmfc string
packing_type string
package_type string
package_quantity integer
quantity integer
commodity_description string
hazmat boolean
carrier_container string
unpacked_item_type_id string
unpacked_item_type_name string
number_of_units integer
orm_d boolean
hazmat_data object Hazmat Data Response object
materials array[hash] List of packing material:
{
name: string
unit_cost: float
ext_cost: float
weight: float
quantity: integer
uom : string
}
labors object List of:
{
name: string
unit_cost: float
ext_cost: float
quantity: float
uom: string
}
package_items array[hash] List of:
{
id: string
product_sku: string
product_upc: string
product_sku_packing_code: string
product_child_sku: integer
product_child_sku_quantity: integer
item_name: string
description: string
length: float
width: float
height: float
weight: float
volume: float
value: float
unpacked_item_type_id: string
require_crating: boolean
freight_class: string
nmfc: string
hs_code: string
country_of_origin: string
xid: string
quantity: integer
order_line_item_id: string
order_line_item_source_system_id: string
order_line_item_source_system_line_number: string
}
handling_unit_packages array[hash] List of:
{
weight: float
dry_ice_weight: float
value: float
package_type: string
hazmat: boolean
freight_class: string
tracking_number: string
nmfc: string
number_of_units: integer
commodity_description: string
orm_d: boolean
hazmat_data: Hazmat Data Response object
package_items: See package_items definition above
}
accessorials array[hash] List of:
{
id: integer
price: number
side: string
name: string
default: boolean
type: string
accessorial_type: string
value: any type
option_value: string
accessorial_options: {
title: string
value: string
}
}
license_plate_number string

Proposed Shipment API Endpoints

Retrieve Proposed Shipments from a Order

curl -X GET 'https://sandbox.shiphawk.com/api/v4/orders/:id/proposed_shipments/generate?api_key=YOUR_API_KEY'
require 'net/http'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)
puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'ord_RfE8CtKE' is an example order id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/ord_RfE8CtKE/proposed_shipments?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){      
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/orders/:id/proposed_shipments

Book a Proposed Shipment

#'ord_Sq9Q39fx' is an example order id.
curl -H "Content-Type: application/json" -X POST -d '
{
    "rate_id":"06e8521a-0b47-4497-cv2c-ff0abb6d58c9",
    "origin_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"1 FIRST ST",
      "phone_number":"5551234567",
      "city":"SANTA BARBARA",
      "state":"CA",
      "country":"US",
      "zip":"93000",
      "email":"email@example.com",
      "is_residential":false,
      "is_po_box":false
    },
    "destination_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"2 FIRST ST",
      "phone_number":"5561234567",
      "city":"Santa Barbara",
      "state":"CA",
      "country":"US",
      "zip":"93001",
      "email":"email@example.com",
      "is_residential":true,
      "is_po_box":false
    },
    "carrier_code":"usps",
    "service_name":"Priority Mail",
    "service_code":"Priority Mail",
    "proposed_shipment_id":"pshp_zW5SZ1SZ",
    "include_return_label":false,
    "insurance_option":"no_insurance",
    "order_source":"BigCommerce",
    "is_external":false,
    "shipping_price":7.1,
    "ship_date":"2018-12-20T08:28:13.000Z",
    "packages":[
      {
        "id":"pkg_JCVW80ZE",
        "packing_type":"parcel",
        "number_of_units":1,
        "packed":true,
        "value":"425",
        "dimension_unit":"in.",
        "weight":2.0,
        "weight_uom":"lbs",
        "package_items":[],
        "accessorials":[],
        "quantity":1,
        "hazmat":false,
        "item_type":"parcel"
      }
    ],
    "shipment_line_items":[
      {
        "description":"Description",
        "name":"Sample",
        "sku":"AAA",
        "quantity":1,
        "price":225,
        "value":225.0,
        "weight":1.0,
        "order_line_item_id":"ordi_PGPRvEBB",
        "source_system_id":"3"
      },
      {
        "description":"Description",
        "name":"Sample2",
        "sku":"BBB",
        "quantity":1,
        "price":200,
        "value":200.0,
        "weight":1.0,
        "order_line_item_id":"ordi_h8ckEkff",
        "source_system_id":"4"
      }
    ],
    "destination_accessorials":[],
    "origin_accessorials":[],
    "accessorials":[],
    "label_format":"PDF",
    "include_label_source":false
}' 'https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments/book?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

#'ord_Sq9Q39fx' is an example order id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments/book?api_key=YOUR_API_KEY')

proposed_shipment =
'{
    "rate_id":"06e8521a-0b47-4497-cv2c-ff0abb6d58c9",
    "origin_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"1 FIRST ST",
      "phone_number":"5551234567",
      "city":"SANTA BARBARA",
      "state":"CA",
      "country":"US",
      "zip":"93000",
      "email":"email@example.com",
      "is_residential":false,
      "is_po_box":false
    },
    "destination_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"2 FIRST ST",
      "phone_number":"5561234567",
      "city":"Santa Barbara",
      "state":"CA",
      "country":"US",
      "zip":"93001",
      "email":"email@example.com",
      "is_residential":true,
      "is_po_box":false
    },
    "carrier_code":"usps",
    "service_name":"Priority Mail",
    "service_code":"Priority Mail",
    "proposed_shipment_id":"pshp_dZ7xjhhQ",
    "include_return_label":false,
    "insurance_option":"no_insurance",
    "order_source":"BigCommerce",
    "is_external":false,
    "shipping_price":7.1,
    "ship_date":"2018-12-20T08:28:13.000Z",
    "packages":[
      {
        "id":"pkg_JCVW80ZE",
        "packing_type":"parcel",
        "number_of_units":1,
        "packed":true,
        "value":"425",
        "dimension_unit":"in.",
        "weight":2.0,
        "weight_uom":"lbs",
        "package_items":[],
        "accessorials":[],
        "quantity":1,
        "hazmat":false,
        "item_type":"parcel"
      }
    ],
    "shipment_line_items":[
      {
        "description":"Description",
        "name":"Sample",
        "sku":"AAA",
        "quantity":1,
        "price":225,
        "value":225.0,
        "weight":1.0,
        "order_line_item_id":"ordi_PGPRvEBB",
        "source_system_id":"3"
      },
      {
        "description":"Description",
        "name":"Sample2",
        "sku":"BBB",
        "quantity":1,
        "price":200,
        "value":200.0,
        "weight":1.0,
        "order_line_item_id":"ordi_h8ckEkff",
        "source_system_id":"4"
      }
    ],
    "destination_accessorials":[],
    "origin_accessorials":[],
    "accessorials":[],
    "label_format":"PDF",
    "include_label_source":false
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = proposed_shipment

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments/book'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "rate_id":"06e8521a-0b47-4497-cv2c-ff0abb6d58c9",
    "origin_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"1 FIRST ST",
      "phone_number":"5551234567",
      "city":"SANTA BARBARA",
      "state":"CA",
      "country":"US",
      "zip":"93000",
      "email":"email@example.com",
      "is_residential":false,
      "is_po_box":false
    },
    "destination_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"2 FIRST ST",
      "phone_number":"5561234567",
      "city":"Santa Barbara",
      "state":"CA",
      "country":"US",
      "zip":"93001",
      "email":"email@example.com",
      "is_residential":true,
      "is_po_box":false
    },
    "carrier_code":"usps",
    "service_name":"Priority Mail",
    "service_code":"Priority Mail",
    "proposed_shipment_id":"pshp_dZ7xjhhQ",
    "include_return_label":false,
    "insurance_option":"no_insurance",
    "order_source":"BigCommerce",
    "is_external":false,
    "shipping_price":7.1,
    "ship_date":"2018-12-20T08:28:13.000Z",
    "packages":[
      {
        "id":"pkg_JCVW80ZE",
        "packing_type":"parcel",
        "number_of_units":1,
        "packed":true,
        "value":"425",
        "dimension_unit":"in.",
        "weight":2.0,
        "weight_uom":"lbs",
        "package_items":[],
        "accessorials":[],
        "quantity":1,
        "hazmat":false,
        "item_type":"parcel"
      }
    ],
    "shipment_line_items":[
      {
        "description":"Description",
        "name":"Sample",
        "sku":"AAA",
        "quantity":1,
        "price":225,
        "value":225.0,
        "weight":1.0,
        "order_line_item_id":"ordi_PGPRvEBB",
        "source_system_id":"3"
      },
      {
        "description":"Description",
        "name":"Sample2",
        "sku":"BBB",
        "quantity":1,
        "price":200,
        "value":200.0,
        "weight":1.0,
        "order_line_item_id":"ordi_h8ckEkff",
        "source_system_id":"4"
      }
    ],
    "destination_accessorials":[],
    "origin_accessorials":[],
    "accessorials":[],
    "label_format":"PDF",
    "include_label_source":false
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("rate_id", "rate_3FqhSS7eakakwn9TeFccRV89")
                .add("order_number", "ORD10100111")
                .add("source_system", "ShipHawk eComm")
                .add("source_system_id", "SH123")
                .add("source", "Proprietary")
                .add("source_system_processed_at", "2016-03-01")
                .add("origin_address", Json.createObjectBuilder()
                    .add("name", "Name")
                    .add("company", "Test Company")
                    .add("street1", "1 FIRST ST")
                    .add("city", "Santa Barbara")
                    .add("state", "CA")
                    .add("country", "US")
                    .add("zip", "93000")
                    .add("email", "email@example.com")
                    .add("is_residential", false)
                    .add("is_po_box", false)
                    )
                .add("destination_address", Json.createObjectBuilder()
                    .add("name", "Name")
                    .add("company", "Test Company")
                    .add("street1", "2 FIRST ST")
                    .add("city", "Santa Barbara")
                    .add("state", "CA")
                    .add("country", "US")
                    .add("zip", "93001")
                    .add("email", "email@example.com")
                    .add("is_residential", true)
                    .add("is_po_box", false)
                    )
                .add("carrier_code", "usps")
                .add("service_name", "Priority Mail")
                .add("service_code", "Priority Mail")
                .add("proposed_shipment_id", "pshp_dZ7xjhhQ")
                .add("include_return_label", false)
                .add("insurance_option", "no_insurance")
                .add("order_source", "BigCommerce")
                .add("is_external", false)
                .add("shipping_price", 7.1)
                .add("ship_date", "2018-12-20T08:28:13.000Z")
                .add("order_line_items", Json.createArrayBuilder()
                    .add(Json.createObjectBuilder()
                        .add("id", "pkg_JCVW80ZE")
                        .add("packing_type", "parcel")
                        .add("number_of_units", 1)
                        .add("packed", true)
                        .add("value", "425")
                        .add("dimension_unit", "in.")
                        .add("weight", 2.0)
                        .add("weight_uom", "lbs")
                        .add("package_items", Json.createArrayBuilder())
                        .add("accessorials", Json.createArrayBuilder())
                        .add("quantity", 1)
                        .add("hazmat", false)
                        .add("item_type", "parcel")
                        )
                    )
                .add("shipment_line_items", Json.createArrayBuilder()
                    .add(Json.createObjectBuilder()
                        .add("description", "Description")
                        .add("name", "Sample")
                        .add("sku", "AAA")
                        .add("quantity", 1)
                        .add("price", 225)
                        .add("value", 225.0)
                        .add("weight", 1.0)
                        .add("order_line_item_id", "ordi_PGPRvEBB")
                        .add("source_system_id", "3")
                        )
                    .add(Json.createObjectBuilder()
                        .add("description", "Description")
                        .add("name", "Sample2")
                        .add("sku", "BBB")
                        .add("quantity", 1)
                        .add("price", 200)
                        .add("value", 200.0)
                        .add("weight", 1.0)
                        .add("order_line_item_id", "ordi_h8ckEkff")
                        .add("source_system_id", "4")
                        )
                    )
                .add("destination_accessorials", Json.createArrayBuilder())
                .add("origin_accessorials", Json.createArrayBuilder())
                .add("accessorials", Json.createArrayBuilder())
                .add("label_format", "PDF")
                .add("include_label_source", false)
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            // 'ord_Sq9Q39fx' is an example order id.
            URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments/book?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){     
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/orders/:id/proposed_shipments/book

Generate a Proposed Shipment

#'ord_Sq9Q39fx' is an example order id.
curl -X POST 'https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments/generate?api_key=YOUR_API_KEY'
require 'net/http'

#'ord_Sq9Q39fx' is an example order id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments/generate?api_key=YOUR_API_KEY')

# Create the HTTP objects
request = Net::HTTP::Post.new(uri.request_uri)

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests

url = 'https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments/generate'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.post(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class PostRequestsSimple {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        // 'ord_RfE8CtKE' is an example order id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/ord_RfE8CtKE/proposed_shipments/generate?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Content-Type", "application/json");

        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_CREATED){     
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("POST request failed. Code was " + responseCode);        
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/orders/:id/proposed_shipments/generate

Create a Proposed Shipment

#'ord_Sq9Q39fx' is an example order id.
curl -H "Content-Type: application/json" -X POST -d '
{
    "origin_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"1 FIRST ST",
      "phone_number":"5551234567",
      "city":"SANTA BARBARA",
      "state":"CA",
      "country":"US",
      "zip":"93000",
      "email":"email@example.com",
      "is_residential":false,
      "is_po_box":false
    },
    "destination_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"2 FIRST ST",
      "phone_number":"5561234567",
      "city":"Santa Barbara",
      "state":"CA",
      "country":"US",
      "zip":"93001",
      "email":"email@example.com",
      "is_residential":true,
      "is_po_box":false
    },
    "carrier_code":"usps",
    "service_name":"Priority Mail",
    "service_code":"Priority Mail",
    "proposed_shipment_id":"pshp_zW5SZ1SZ",
    "include_return_label":false,
    "return_label_service_name":"",
    "insurance_option":"no_insurance",
    "order_source":"BigCommerce",
    "is_external":false,
    "shipping_price":7.1,
    "ship_date":"2018-12-20T08:49:30.000Z",
    "reference_numbers":[],
    "packages":[
      {
        "id":"pkg_JCVW80ZE",
        "packing_type":"parcel",
        "number_of_units":1,
        "packed":true,
        "value":"425",
        "dimension_unit":"in.",
        "weight":2.0,
        "weight_uom":"lbs",
        "package_items":[
          {
            "order_line_item_id":"ofdi_h8xkEfdk",
            "quantity":1
          },
          {
            "order_line_item_id":"ordt_PDGsvEAA",
            "quantity":1
          }
        ],
        "accessorials":[],
        "quantity":1,
        "hazmat":false,
        "item_type":"parcel"
      }
    ],
    "shipment_line_items":[
      {
        "description":"Description",
        "name":"Sample",
        "sku":"AAA",
        "quantity":1,
        "price":225,
        "value":225.0,
        "weight":1.0,
        "order_line_item_id":"ordi_PGPRvEBB",
        "source_system_id":"3"
      },
      {
        "description":"Description",
        "name":"Sample2",
        "sku":"BBB",
        "quantity":1,
        "price":200,
        "value":200.0,
        "weight":1.0,
        "order_line_item_id":"ordi_h8ckEkff",
        "source_system_id":"4"
      }
    ],
    "destination_accessorials":[],
    "origin_accessorials":[],
    "accessorials":[]
}' 'https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

#'ord_Sq9Q39fx' is an example order id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments?api_key=YOUR_API_KEY')

proposed_shipment =
'{
    "origin_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"1 FIRST ST",
      "phone_number":"5551234567",
      "city":"SANTA BARBARA",
      "state":"CA",
      "country":"US",
      "zip":"93000",
      "email":"email@example.com",
      "is_residential":false,
      "is_po_box":false
    },
    "destination_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"2 FIRST ST",
      "phone_number":"5561234567",
      "city":"Santa Barbara",
      "state":"CA",
      "country":"US",
      "zip":"93001",
      "email":"email@example.com",
      "is_residential":true,
      "is_po_box":false
    },
    "carrier_code":"usps",
    "service_name":"Priority Mail",
    "service_code":"Priority Mail",
    "proposed_shipment_id":"pshp_zW5SZ1SZ",
    "include_return_label":false,
    "return_label_service_name":"",
    "insurance_option":"no_insurance",
    "order_source":"BigCommerce",
    "is_external":false,
    "shipping_price":7.1,
    "ship_date":"2018-12-20T08:49:30.000Z",
    "reference_numbers":[],
    "packages":[
      {
        "id":"pkg_JCVW80ZE",
        "packing_type":"parcel",
        "number_of_units":1,
        "packed":true,
        "value":"425",
        "dimension_unit":"in.",
        "weight":2.0,
        "weight_uom":"lbs",
        "package_items":[
          {
            "order_line_item_id":"ofdi_h8xkEfdk",
            "quantity":1
          },
          {
            "order_line_item_id":"ordt_PDGsvEAA",
            "quantity":1
          }
        ],
        "accessorials":[],
        "quantity":1,
        "hazmat":false,
        "item_type":"parcel"
      }
    ],
    "shipment_line_items":[
      {
        "description":"Description",
        "name":"Sample",
        "sku":"AAA",
        "quantity":1,
        "price":225,
        "value":225.0,
        "weight":1.0,
        "order_line_item_id":"ordi_PGPRvEBB",
        "source_system_id":"3"
      },
      {
        "description":"Description",
        "name":"Sample2",
        "sku":"BBB",
        "quantity":1,
        "price":200,
        "value":200.0,
        "weight":1.0,
        "order_line_item_id":"ordi_h8ckEkff",
        "source_system_id":"4"
      }
    ],
    "destination_accessorials":[],
    "origin_accessorials":[],
    "accessorials":[]
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = proposed_shipment

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "origin_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"1 FIRST ST",
      "phone_number":"5551234567",
      "city":"SANTA BARBARA",
      "state":"CA",
      "country":"US",
      "zip":"93000",
      "email":"email@example.com",
      "is_residential":false,
      "is_po_box":false
    },
    "destination_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"2 FIRST ST",
      "phone_number":"5561234567",
      "city":"Santa Barbara",
      "state":"CA",
      "country":"US",
      "zip":"93001",
      "email":"email@example.com",
      "is_residential":true,
      "is_po_box":false
    },
    "carrier_code":"usps",
    "service_name":"Priority Mail",
    "service_code":"Priority Mail",
    "proposed_shipment_id":"pshp_zW5SZ1SZ",
    "include_return_label":false,
    "return_label_service_name":"",
    "insurance_option":"no_insurance",
    "order_source":"BigCommerce",
    "is_external":false,
    "shipping_price":7.1,
    "ship_date":"2018-12-20T08:49:30.000Z",
    "reference_numbers":[],
    "packages":[
      {
        "id":"pkg_JCVW80ZE",
        "packing_type":"parcel",
        "number_of_units":1,
        "packed":true,
        "value":"425",
        "dimension_unit":"in.",
        "weight":2.0,
        "weight_uom":"lbs",
        "package_items":[
          {
            "order_line_item_id":"ofdi_h8xkEfdk",
            "quantity":1
          },
          {
            "order_line_item_id":"ordt_PDGsvEAA",
            "quantity":1
          }
        ],
        "accessorials":[],
        "quantity":1,
        "hazmat":false,
        "item_type":"parcel"
      }
    ],
    "shipment_line_items":[
      {
        "description":"Description",
        "name":"Sample",
        "sku":"AAA",
        "quantity":1,
        "price":225,
        "value":225.0,
        "weight":1.0,
        "order_line_item_id":"ordi_PGPRvEBB",
        "source_system_id":"3"
      },
      {
        "description":"Description",
        "name":"Sample2",
        "sku":"BBB",
        "quantity":1,
        "price":200,
        "value":200.0,
        "weight":1.0,
        "order_line_item_id":"ordi_h8ckEkff",
        "source_system_id":"4"
      }
    ],
    "destination_accessorials":[],
    "origin_accessorials":[],
    "accessorials":[]
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("origin_address", Json.createObjectBuilder()
                    .add("name", "Name")
                    .add("company", "Test Company")
                    .add("street1", "1 FIRST ST")
                    .add("city", "Santa Barbara")
                    .add("state", "CA")
                    .add("country", "US")
                    .add("zip", "93000")
                    .add("email", "email@example.com")
                    .add("is_residential", false)
                    .add("is_po_box", false)
                    )
                .add("destination_address", Json.createObjectBuilder()
                    .add("name", "Name")
                    .add("company", "Test Company")
                    .add("street1", "2 FIRST ST")
                    .add("city", "Santa Barbara")
                    .add("state", "CA")
                    .add("country", "US")
                    .add("zip", "93001")
                    .add("email", "email@example.com")
                    .add("is_residential", true)
                    .add("is_po_box", false)
                    )
                .add("carrier_code", "usps")
                .add("service_name", "Priority Mail")
                .add("service_code", "Priority Mail")
                .add("proposed_shipment_id", "pshp_dZ7xjhhQ")
                .add("include_return_label", false)
                .add("insurance_option", "no_insurance")
                .add("order_source", "BigCommerce")
                .add("is_external", false)
                .add("shipping_price", 7.1)
                .add("ship_date", "2018-12-20T08:28:13.000Z")
                .add("order_line_items", Json.createArrayBuilder()
                    .add(Json.createObjectBuilder()
                        .add("id", "pkg_JCVW80ZE")
                        .add("packing_type", "parcel")
                        .add("number_of_units", 1)
                        .add("packed", true)
                        .add("value", "425")
                        .add("dimension_unit", "in.")
                        .add("weight", 2.0)
                        .add("weight_uom", "lbs")
                        .add("package_items", Json.createArrayBuilder())
                        .add("accessorials", Json.createArrayBuilder())
                        .add("quantity", 1)
                        .add("hazmat", false)
                        .add("item_type", "parcel")
                        )
                    )
                .add("shipment_line_items", Json.createArrayBuilder()
                    .add(Json.createObjectBuilder()
                        .add("description", "Description")
                        .add("name", "Sample")
                        .add("sku", "AAA")
                        .add("quantity", 1)
                        .add("price", 225)
                        .add("value", 225.0)
                        .add("weight", 1.0)
                        .add("order_line_item_id", "ordi_PGPRvEBB")
                        .add("source_system_id", "3")
                        )
                    .add(Json.createObjectBuilder()
                        .add("description", "Description")
                        .add("name", "Sample2")
                        .add("sku", "BBB")
                        .add("quantity", 1)
                        .add("price", 200)
                        .add("value", 200.0)
                        .add("weight", 1.0)
                        .add("order_line_item_id", "ordi_h8ckEkff")
                        .add("source_system_id", "4")
                        )
                    )
                .add("destination_accessorials", Json.createArrayBuilder())
                .add("origin_accessorials", Json.createArrayBuilder())
                .add("accessorials", Json.createArrayBuilder())
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            // 'ord_gYcgBh5K' is an example order id.
            URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/ord_gYcgBh5K/proposed_shipments?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){     
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/orders/:id/proposed_shipments

Edit a Proposed Shipment

#'pshp_sfbMrjqZ' is an example proposed shipment id, and 'ord_Sq9Q39fx' is an example order id.
curl -H "Content-Type: application/json" -X POST -d '
{
    "origin_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"1 FIRST ST",
      "phone_number":"5551234567",
      "city":"SANTA BARBARA",
      "state":"CA",
      "country":"US",
      "zip":"93000",
      "email":"email@example.com",
      "is_residential":false,
      "is_po_box":false
    },
    "destination_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"2 FIRST ST",
      "phone_number":"5561234567",
      "city":"Santa Barbara",
      "state":"CA",
      "country":"US",
      "zip":"93001",
      "email":"email@example.com",
      "is_residential":true,
      "is_po_box":false
    },
    "carrier_code":"usps",
    "service_name":"Priority Mail",
    "service_code":"Priority Mail",
    "proposed_shipment_id":"pshp_zW5SZ1SZ",
    "include_return_label":false,
    "return_label_service_name":"",
    "insurance_option":"no_insurance",
    "order_source":"BigCommerce",
    "is_external":false,
    "shipping_price":7.1,
    "ship_date":"2018-12-20T08:49:30.000Z",
    "reference_numbers":[],
    "packages":[
      {
        "id":"pkg_JCVW80ZE",
        "packing_type":"parcel",
        "number_of_units":1,
        "packed":true,
        "value":"425",
        "dimension_unit":"in.",
        "weight":2.0,
        "weight_uom":"lbs",
        "package_items":[
          {
            "order_line_item_id":"ofdi_h8xkEfdk",
            "quantity":1
          },
          {
            "order_line_item_id":"ordt_PDGsvEAA",
            "quantity":1
          }
        ],
        "accessorials":[],
        "quantity":1,
        "hazmat":false,
        "item_type":"parcel"
      }
    ],
    "shipment_line_items":[
      {
        "description":"Description",
        "name":"Sample",
        "sku":"AAA",
        "quantity":1,
        "price":225,
        "value":225.0,
        "weight":1.0,
        "order_line_item_id":"ordi_PGPRvEBB",
        "source_system_id":"3"
      },
      {
        "description":"Description",
        "name":"Sample2",
        "sku":"BBB",
        "quantity":1,
        "price":200,
        "value":200.0,
        "weight":1.0,
        "order_line_item_id":"ordi_h8ckEkff",
        "source_system_id":"4"
      }
    ],
    "destination_accessorials":[],
    "origin_accessorials":[],
    "accessorials":[]
}' 'https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments/pshp_sfbMrjqZ?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

#'ord_Sq9Q39fx' is an example order id and 'pshp_ckyz6CSn' is an example proposed shipment id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments/pshp_ckyz6CSn?api_key=YOUR_API_KEY')

proposed_shipment =
'{
    "origin_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"1 FIRST ST",
      "phone_number":"5551234567",
      "city":"SANTA BARBARA",
      "state":"CA",
      "country":"US",
      "zip":"93000",
      "email":"email@example.com",
      "is_residential":false,
      "is_po_box":false
    },
    "destination_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"2 FIRST ST",
      "phone_number":"5561234567",
      "city":"Santa Barbara",
      "state":"CA",
      "country":"US",
      "zip":"93001",
      "email":"email@example.com",
      "is_residential":true,
      "is_po_box":false
    },
    "carrier_code":"usps",
    "service_name":"Priority Mail",
    "service_code":"Priority Mail",
    "proposed_shipment_id":"pshp_zW5SZ1SZ",
    "include_return_label":false,
    "return_label_service_name":"",
    "insurance_option":"no_insurance",
    "order_source":"BigCommerce",
    "is_external":false,
    "shipping_price":7.1,
    "ship_date":"2018-12-20T08:49:30.000Z",
    "reference_numbers":[],
    "packages":[
      {
        "id":"pkg_JCVW80ZE",
        "packing_type":"parcel",
        "number_of_units":1,
        "packed":true,
        "value":"425",
        "dimension_unit":"in.",
        "weight":2.0,
        "weight_uom":"lbs",
        "package_items":[
          {
            "order_line_item_id":"ofdi_h8xkEfdk",
            "quantity":1
          },
          {
            "order_line_item_id":"ordt_PDGsvEAA",
            "quantity":1
          }
        ],
        "accessorials":[],
        "quantity":1,
        "hazmat":false,
        "item_type":"parcel"
      }
    ],
    "shipment_line_items":[
      {
        "description":"Description",
        "name":"Sample",
        "sku":"AAA",
        "quantity":1,
        "price":225,
        "value":225.0,
        "weight":1.0,
        "order_line_item_id":"ordi_PGPRvEBB",
        "source_system_id":"3"
      },
      {
        "description":"Description",
        "name":"Sample2",
        "sku":"BBB",
        "quantity":1,
        "price":200,
        "value":200.0,
        "weight":1.0,
        "order_line_item_id":"ordi_h8ckEkff",
        "source_system_id":"4"
      }
    ],
    "destination_accessorials":[],
    "origin_accessorials":[],
    "accessorials":[]
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = proposed_shipment

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments/pshp_ckyz6CSn'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "origin_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"1 FIRST ST",
      "phone_number":"5551234567",
      "city":"SANTA BARBARA",
      "state":"CA",
      "country":"US",
      "zip":"93000",
      "email":"email@example.com",
      "is_residential":false,
      "is_po_box":false
    },
    "destination_address":{
      "name":"Name",
      "company":"Test Company",
      "street1":"2 FIRST ST",
      "phone_number":"5561234567",
      "city":"Santa Barbara",
      "state":"CA",
      "country":"US",
      "zip":"93001",
      "email":"email@example.com",
      "is_residential":true,
      "is_po_box":false
    },
    "carrier_code":"usps",
    "service_name":"Priority Mail",
    "service_code":"Priority Mail",
    "proposed_shipment_id":"pshp_zW5SZ1SZ",
    "include_return_label":false,
    "return_label_service_name":"",
    "insurance_option":"no_insurance",
    "order_source":"BigCommerce",
    "is_external":false,
    "shipping_price":7.1,
    "ship_date":"2018-12-20T08:49:30.000Z",
    "reference_numbers":[],
    "packages":[
      {
        "id":"pkg_JCVW80ZE",
        "packing_type":"parcel",
        "number_of_units":1,
        "packed":true,
        "value":"425",
        "dimension_unit":"in.",
        "weight":2.0,
        "weight_uom":"lbs",
        "package_items":[
          {
            "order_line_item_id":"ofdi_h8xkEfdk",
            "quantity":1
          },
          {
            "order_line_item_id":"ordt_PDGsvEAA",
            "quantity":1
          }
        ],
        "accessorials":[],
        "quantity":1,
        "hazmat":false,
        "item_type":"parcel"
      }
    ],
    "shipment_line_items":[
      {
        "description":"Description",
        "name":"Sample",
        "sku":"AAA",
        "quantity":1,
        "price":225,
        "value":225.0,
        "weight":1.0,
        "order_line_item_id":"ordi_PGPRvEBB",
        "source_system_id":"3"
      },
      {
        "description":"Description",
        "name":"Sample2",
        "sku":"BBB",
        "quantity":1,
        "price":200,
        "value":200.0,
        "weight":1.0,
        "order_line_item_id":"ordi_h8ckEkff",
        "source_system_id":"4"
      }
    ],
    "destination_accessorials":[],
    "origin_accessorials":[],
    "accessorials":[]
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("origin_address", Json.createObjectBuilder()
                    .add("name", "Name")
                    .add("company", "Test Company")
                    .add("street1", "3 FIRST ST")
                    .add("city", "Santa Barbara")
                    .add("state", "CA")
                    .add("country", "US")
                    .add("zip", "93000")
                    .add("email", "email@example.com")
                    .add("is_residential", false)
                    .add("is_po_box", false)
                    )
                .add("destination_address", Json.createObjectBuilder()
                    .add("name", "Name")
                    .add("company", "Test Company")
                    .add("street1", "2 FIRST ST")
                    .add("city", "Santa Barbara")
                    .add("state", "CA")
                    .add("country", "US")
                    .add("zip", "93001")
                    .add("email", "email@example.com")
                    .add("is_residential", true)
                    .add("is_po_box", false)
                    )
                .add("carrier_code", "usps")
                .add("service_name", "Priority Mail")
                .add("service_code", "Priority Mail")
                .add("proposed_shipment_id", "pshp_dZ7xjhhQ")
                .add("include_return_label", false)
                .add("insurance_option", "no_insurance")
                .add("order_source", "BigCommerce")
                .add("is_external", false)
                .add("shipping_price", 7.1)
                .add("ship_date", "2018-12-20T08:28:13.000Z")
                .add("packages", Json.createArrayBuilder()
                    .add(Json.createObjectBuilder()
                        .add("id", "pkg_JCVW80ZE")
                        .add("packing_type", "parcel")
                        .add("number_of_units", 1)
                        .add("packed", true)
                        .add("value", "425")
                        .add("dimension_unit", "in.")
                        .add("weight", 2.0)
                        .add("weight_uom", "lbs")
                        .add("package_items", Json.createArrayBuilder()
                            .add(Json.createObjectBuilder()
                                .add("order_line_item_id", "ofdi_h8xkEfdk")
                                .add("quantity", 1)
                                )
                            .add(Json.createObjectBuilder()
                                .add("order_line_item_id", "ordt_PDGsvEAA")
                                .add("quantity", 1)
                                )
                            )
                        .add("accessorials", Json.createArrayBuilder())
                        .add("quantity", 1)
                        .add("hazmat", false)
                        .add("item_type", "parcel")
                        )
                    )
                .add("shipment_line_items", Json.createArrayBuilder()
                    .add(Json.createObjectBuilder()
                        .add("description", "Description")
                        .add("name", "Sample")
                        .add("sku", "AAA")
                        .add("quantity", 1)
                        .add("price", 225)
                        .add("value", 225.0)
                        .add("weight", 1.0)
                        .add("order_line_item_id", "ordi_PGPRvEBB")
                        .add("source_system_id", "3")
                        )
                    .add(Json.createObjectBuilder()
                        .add("description", "Description")
                        .add("name", "Sample2")
                        .add("sku", "BBB")
                        .add("quantity", 1)
                        .add("price", 200)
                        .add("value", 200.0)
                        .add("weight", 1.0)
                        .add("order_line_item_id", "ordi_h8ckEkff")
                        .add("source_system_id", "4")
                        )
                    )
                .add("destination_accessorials", Json.createArrayBuilder())
                .add("origin_accessorials", Json.createArrayBuilder())
                .add("accessorials", Json.createArrayBuilder())
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            // 'pshp_kcNhnmW5' is an example proposed shipment id, and 'ord_gYcgBh5K' is an example order id.
            URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/ord_gYcgBh5K/proposed_shipments/pshp_kcNhnmW5?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){     
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/orders/:id/proposed_shipments/:proposed_shipment_id

Delete a Proposed Shipment

#'pshp_sfbMrjqZ' is an example proposed shipment id, and 'ord_Sq9Q39fx' is an example order id.
curl -X DELETE 'https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments/pshp_sfbMrjqZ?api_key=YOUR_API_KEY'
require 'net/http'

#'pshp_sfbMrjqZ' is an example proposed shipment id, and 'ord_Sq9Q39fx' is an example order id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments/pshp_ckyz6CSn?api_key=YOUR_API_KEY')

# Create the HTTP objects
request = Net::HTTP::Delete.new(uri.request_uri)

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests

url = 'https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/proposed_shipments/pshp_ckyz6CSn'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.delete(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class DeleteRequests {
    public static void main(String [] args)
    {
        try{
            sendDelete();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendDelete() throws IOException {
        // 'ord_RfE8CtKE' is an example order id, 'pshp_6wr47Zhs' is an example proposed shipment id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/orders/ord_RfE8CtKE/proposed_shipments/pshp_6wr47Zhs?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("DELETE");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_NO_CONTENT || responseCode == HttpURLConnection.HTTP_OK){     
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("DELETE request failed. Code was " + responseCode);
        }
    }
}

DELETE https://sandbox.shiphawk.com/api/v4/orders/:id/proposed_shipments/:proposed_shipment_id

Rates

Rate Resources

Rate Request Object

Parameters are optional unless specified.

Attribute Type Description
origin_address Hash required
{
id: String
name: String
company: String
street1: String
street2: String
city: String
state: String
zip: String
phone_number: String
email: String
code: String
is_residential: Boolean (Default: false)
country: String (Default: US)
}
destination_address Hash required
{
id: String
name: String
company: String
street1: String
street2: String
city: String
state: String
zip: String
phone_number: String
email: String
code: String
is_residential: Boolean (Default: false)
country: String (Default: US)
is_po_box: Boolean
}
source_system String
source_system_domain String
source_system_order_id String
display_rate_detail Boolean Default: false
mask_carrier_service Boolean Default: false
apply_rules Boolean Default: false
third_party_fulfillment Boolean Default: false
ship_complete Boolean Default: false
display_rate_uuid Boolean Default: false
usps_parcel_select Boolean
usps_library_mail Boolean
usps_media_mail Boolean
carrier_filter Array Default: []
carrier_type_filter Array An Array of strings.
carrier_service_code String
standardized_service_filter String One of:
White Glove Threshold Standard Courier Room of Choice Flatbed Local Delivery Standard Freight Same-Day Freight Guaranteed Freight Next Day Two-Day Three-Day International Economy International Priority Ground Restricted Ground Standard Vehicle Same Day Flat Rate Same Day Freight Blanket Wrap
rate_filter String One of: best consumer top_10
service_days_filter Integer
ship_date String
origin_accessorials Hash
destination_accessorials Hash
network_location String
insurance_option String One of:
add_insurance no_insurance
order_source String
rate_source String
currency_codes String One of:
AED AFN ALL AMD ANG AOA ARS AUD AWG AZN BAM BBD BDT BGN BHD BIF BMD BND BOB BOV BRL BSD BTN BWP BYN BZD CAD CDF CHE CHF CHW CLF CLP CNY COP COU CRC CUC CUP CVE CZK DJF DKK DOP DZD EGP ERN ETB EUR FJD FKP GBP GEL GHS GIP GMD GNF GTQ GYD HKD HNL HRK HTG HUF IDR ILS INR IQD IRR ISK JMD JOD JPY KES KGS KHR KMF KPW KRW KWD KYD KZT LAK LBP LKR LRD LSL LYD MAD MDL MGA MKD MMK MNT MOP MRO MUR MVR MWK MXN MXV MYR MZN NAD NGN NIO NOK NPR NZD OMR PAB PEN PGK PHP PKR PLN PYG QAR RON RSD RUB RWF SAR SBD SCR SDG SEK SGD SHP SLL SOS SRD SSP STD SVC SYP SZL THB TJS TMT TND TOP TRY TTD TWD TZS UAH UGX USD USN UYI UYU UZS VEF VND VUV WST XAF XAG XAU XBA XBB XBC XBD XCD XDR XOF XPD XPF XPT XSU XTS XUA XXX YER ZAR ZMW ZWL
warehouse_id String
warehouse_code String
shipment_line_items Array List of:
{
quantity: Integer
source_system_id: String
sku: String
}
items Array required: List of Rate Item Request objects
shipment_billing Hash {
bill_to: String, one of sender third_party recipient
carrier_code: String
service_code: String
account_number: String
name: String
company: String
phone_number: String
street1: String
street2: String
city: String
state: String
zip: String
country: String
}
duties_billing_taxes Hash {
bill_to: String, one of sender third_party recipient
carrier_code: String
service_code: String
account_number: String
name: String
company: String
phone_number: String
street1: String
street2: String
city: String
state: String
zip: String
country: String
}

Rate Item Request Object

Parameters are optional unless specified.

Attribute Type Description
item_type String One of: parcel handling_unit unpacked. (Default: parcel)
accessorials Array
name String
length Float
width Float
height Float
weight Float
dry_ice_weight Float
weight_uom String One of: lbs oz
volume_cubic_ft Float
value Float
handling_unit_type String
quantity Integer Default: 1
freight_class String
nmfc String
description String
can_ship_parcel Boolean Default: false
optimize_packing Boolean Default: false
ship_individually Boolean
is_drop_ship Boolean Default: false
package_type String
package_quantity Integer
hs_code String
country_of_origin String
product_sku String
require_crating Boolean Default: false
unpacked_item_type_id String
hazmat Boolean Default: false
orm_d Boolean Default: false
carrier_container String
number_of_units Integer Default: 1
available_in Hash
warehouse_code String
order_line_item_source_system_id String
origin_address Hash {
id: String
name: String
company: String
street1: String
street2: String
city: String
state: String
zip: String
phone_number: String
email: String
code: String
is_residential: Boolean (Default: false)
country: String (Default: US)
}
hazmat_data Hash see Orders Hazmat Data Request Object
handling_unit_packages Array List of:
{
package_type: String
package_quantity: Integer
weight, type: Float
dry_ice_weight: Float
nmfc: String
freight_class: String
hazmat: Boolean (Default: false)
orm_d: Boolean (Default: false
number_of_units: Integer
commodity_description: String
hazmat_data: see Orders Hazmat Data Request Object
}

Rate Without Details Response Object

Parameters are optional unless specified.

Attribute Type Description
id String
carrier String
carrier_code String
tariff_insurance_role String
service_name String
service_level String
standardized_serivce_name String
rate_display_name String
price Float
currency_code String
est_delivery_date DateTime
estimated_delivery_time String
service_days Integer
origin_network_location_id Integer
destination_network_location_id Integer

Rate Response Object

{
    "rates": [
        {
            "id": "rate_6ZPt6R1fSsSg8FXvq0zSGPwD",
            "carrier": "USPS",
            "carrier_code": "usps",
            "tariff_insurance_rule": "carrier",
            "service_name": "First-Class Mail",
            "service_level": "First-Class Mail",
            "standardized_service_name": "Ground",
            "rate_display_name": "USPS First-Class Mail",
            "price": "4.19",
            "currency_code": "USD",
            "est_delivery_date": "2019-01-23T00:00:00.000-06:00",
            "est_delivery_time": null,
            "service_days": 3,
            "origin_network_location_id": null,
            "destination_network_location_id": null
        },
        {
            "id": "rate_fG2f45GaBQH0c4XS1vgNybsD",
            "carrier": "USPS",
            "carrier_code": "usps",
            "tariff_insurance_rule": "carrier",
            "service_name": "Priority Mail",
            "service_level": "Priority Mail",
            "standardized_service_name": "Ground",
            "rate_display_name": "USPS Priority Mail",
            "price": "7.99",
            "currency_code": "USD",
            "est_delivery_date": "2019-01-22T00:00:00.000-06:00",
            "est_delivery_time": null,
            "service_days": 2,
            "origin_network_location_id": null,
            "destination_network_location_id": null
        }
    ]
}

Parameters are optional unless specified.

Attribute Type Description
RateWithoutDetails Object Rate Without Details Response Object
rate_detail Object Rate Detail Response Object
carrier_details Object Carrier Details Response Object
applied_rules Object Rule For Rating Response Object

Rate Detail Response Object

Parameters are optional unless specified.

Attribute Type Description
pickup_price Float
delivery_price Float
est_delivery_time String
proposed_shipment Object Proposed Shipment Response Object

Carrier Details Response Object

Attribute Type Description
logo String
friendly_name String
carrier_type String

Rate Endpoints

Create a New Rate Request

curl -H "Content-Type: application/json" -X POST -d'{
 "items":[
   {
     "type": "parcel",
     "length": "10",
     "width" : "10",
     "height": "11",
     "weight": "10",
     "value": 100.00
   }
 ],
 "origin_address":{ "zip": "93101"},
 "destination_address":{ "zip": "60060"}
}' 'https://sandbox.shiphawk.com/api/v4/rates?api_key=YOUR_API_KEY'

require 'net/http'
require 'uri'
require 'json'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/rates?api_key=YOUR_API_KEY')

rate =
'{
    "items":[
       {
         "type": "parcel",
         "length": "10",
         "width" : "10",
         "height": "11",
         "weight": "10",
         "value": 100.00
       }
     ],
     "origin_address":{ "zip": "93101"},
     "destination_address":{ "zip": "60060"}
 }'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri.request_uri, 'Content-Type' => 'application/json')
request.body = rate

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

print(response.body)
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/rates'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "items":[
       {
         "type": "parcel",
         "length": "10",
         "width" : "10",
         "height": "11",
         "weight": "10",
         "value": 100.00
       }
     ],
     "origin_address":{ "zip": "93101"},
     "destination_address":{ "zip": "60060"}
}
r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar 
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("items", Json.createArrayBuilder().add(Json.createObjectBuilder()
                                                        .add("type", "parcel")
                                                        .add("length", "10")
                                                        .add("width", "10")
                                                        .add("height", "11")
                                                        .add("weight", "10")
                                                        .add("value", 100.00))
                    )
                .add("origin_address", Json.createObjectBuilder().add("zip", "93101"))
                .add("destination_address", Json.createObjectBuilder().add("zip", "60060"))
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            URL url = new URL("https://sandbox.shiphawk.com/api/v4/rates?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){     
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/rates?api_key=YOUR_API_KEY

Batches

Small unpacked items must be packed prior to shipping. ShipHawk estimates the packing materials required and provides rates based on the estimated weight and dimensions of the resulting package(s).

For larger items (such as furniture or lab equipment), ShipHawk provide rates for Blanket Wrap carriers and compares those rates against the cost to pack and ship with a traditional LTL or Home Delivery carrier.

Batch Resources

Batch Object

Attribute Type Description
id string required
name string required
items_count integer Number of orders in this batch
created_at date
created_by string

Batch API Endpoints

Retrieve Batches List

curl -H "Content-Type: application/json" -X GET
'https://sandbox.shiphawk.com/api/v4/batches?api_key=YOUR_API_KEY'

# Example Response
[
    {
        "id": "bat_23zjfqaB",
        "name": "Batch #1",
        "items_count": 0,
        "created_at": "2018-12-04T21:26:18+00:00",
        "created_by": "NVShipper38 NVShipper38"
    },
    {
        "id": "bat_gdgWDBSZ",
        "name": "Batch #1",
        "items_count": 0,
        "created_at": "2018-12-15T14:48:23+00:00",
        "created_by": "Keith Wilson"
    },
    {
        "id": "bat_htJXZ6zw",
        "name": "Batch #1",
        "items_count": 0,
        "created_at": "2018-12-17T17:12:03+00:00",
        "created_by": "NVshipper2  NVshipper2"
    }
]
require 'net/http'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/batches?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)
puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/batches'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/batches?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){      
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/batches

Create a Batch

curl -H "Content-Type: application/json" -X POST
'https://sandbox.shiphawk.com/api/v4/batches?api_key=YOUR_API_KEY'

# Example Response
{
    "id": "bat_DhmbwcwE",
    "name": "Batch #3",
    "items_count": 0,
    "created_at": "2019-01-22T19:53:27+00:00",
    "created_by": "Roni Rae-Staples"
}
require 'net/http'
require 'uri'
require 'json'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/batches?api_key=YOUR_API_KEY')

# Create the HTTP objects
request = Net::HTTP::Post.new(uri.request_uri)

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests

url = 'https://sandbox.shiphawk.com/api/v4/batches'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.post(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class PostRequestsSimple {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/batches?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Content-Type", "application/json");

        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_CREATED){     
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("POST request failed. Code was " + responseCode);        
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/batches

Retrieve a Batch

# 'bat_2VTmjr7x' is an example batch id.
curl -H "Content-Type: application/json" -X GET
'https://sandbox.shiphawk.com/api/v4/batches/bat_2VTmjr7x?api_key=YOUR_API_KEY'

# Example Response
{
    "id": "bat_2VTmjr7x",
    "name": "Batch #2",
    "items_count": 0,
    "created_at": "2019-01-22T19:53:22+00:00",
    "created_by": "Roni Rae-Staples"
}
require 'net/http'

#'bat_XBryhqba' is an example batch id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/batches/bat_XBryhqba?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

#'bat_XBryhqba' is an example batch id.
url = 'https://sandbox.shiphawk.com/api/v4/batches/bat_XBryhqba'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'bat_mMppjwpG' is an example batch id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/batches/bat_mMppjwpG?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){      
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/batches/:id

Update a Batch

# 'bat_2VTmjr7x' is an example batch id.
curl -H "Content-Type: application/json" -X POST -d '{
  "name" : new name
}' 'https://sandbox.shiphawk.com/api/v4/batches/bat_2VTmjr7x?api_key=YOUR_API_KEY'

# Example Response
{
    "id": "bat_2VTmjr7x",
    "name": "new name",
    "items_count": 0,
    "created_at": "2019-01-22T19:53:22+00:00",
    "created_by": "Roni Rae-Staples"
}
require 'net/http'
require 'uri'
require 'json'

# 'bat_XBryhqba' is an example batch id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/batches/bat_XBryhqba?api_key=YOUR_API_KEY')

rate =
'{
    "name": "Changed"
 }'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = rate

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

# 'bat_XBryhqba' is an example batch id.
url = 'https://sandbox.shiphawk.com/api/v4/batches/bat_XBryhqba'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "name": "New Name"
 }

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("name", "new name")
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            //'bat_2QvQe0FN' is an example batch id.
            URL url = new URL("https://sandbox.shiphawk.com/api/v4/batches/bat_2QvQe0FN?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){     
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/batches/:id

Delete a Batch

# 'bat_2VTmjr7x' is an example batch id.
curl --request DELETE \
  --url https://sandbox.shiphawk.com/api/v4/batches/bat_2VTmjr7x?api_key=YOUR_API_KEY
require 'net/http'

#'bat_2M4VVTw0' is an example batch id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/batches/bat_2M4VVTw0?api_key=YOUR_API_KEY')

# Create the HTTP objects
request = Net::HTTP::Delete.new(uri.request_uri)

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests

#'bat_2M4VVTw0' is an example batch id.
url = 'https://sandbox.shiphawk.com/api/v4/batches/bat_2M4VVTw0'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.delete(url, headers=headers)
// Running with javax.json-1.0.jar 
import java.io.*;
import java.net.*;

public class DeleteRequests {
    public static void main(String [] args)
    {
        try{
            sendDelete();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendDelete() throws IOException {
        // 'bat_mMppjwpG' is an example batch id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/batches/bat_mMppjwpG?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("DELETE");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_NO_CONTENT || responseCode == HttpURLConnection.HTTP_OK){     
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("DELETE request failed. Code was " + responseCode);
        }
    }
}

DELETE https://sandbox.shiphawk.com/api/v4/batches/:id

Handling Units

Handling Unit Resources

Handling Unit Object

A handling unit is a physical unit consisting of packaging materials (load carriers/packing material) and the goods contained on/in it. Examples include: pallet carton crate.

Handling units are primarily used for rating freight shipments, although the rates endpoint will also return parcel rates if the can_ship_parcel flag is true.

Attribute Type Description
type string required Use value handling_unit
handling_unit_type string required Handling unit types: pallet carton box crate bag
length number(inches) required Limited to one decimal place.
width number(inches) required Limited to one decimal place.
height number(inches) required Limited to one decimal place.
weight number(inches) required Limited to one decimal place.
value integer required The total value of the contents in US Dollars, rounded to the nearest whole dollar.
freight_class string NMFC freight class codes: 50 55 60 65 70 77.5 85 92.5 100 110 125 150 175 200 250 300 400 500
nmfc string The National Motor Freight Classification code. Default value will be calculated based on density (This can affect rating accuracy).
description string A description of the handling unit's contents. Typically this should be the name of the NMFC commodity, but can also be a more generic description. This attribute will be printed on the Bill of Lading (BOL).
package_type string required for pallets Describes the type of packages contained in or on the handling unit. The package types are: carton box crate bag
package_quantity integer required for pallets The number of packages contained in or on the handling unit. No mix or matching allowed.
product_sku string Only use this field if you have integrated with our Product Service
optimize_packing boolean If true, we will attempt to palletize prior to rating. Default: false

Unpacked Items

Unpacked Item Resources

Unpacked Item Object

Small unpacked items must be packed prior to shipping. ShipHawk estimates the packing materials required and provides rates based on the estimated weight and dimensions of the resulting package(s).

For larger items (such as furniture or lab equipment), ShipHawk provide rates for Blanket Wrap carriers and compares those rates against the cost to pack and ship with a traditional LTL or Home Delivery carrier.

# Example Response
{
        "id": "itm_ceQKE0MS",
        "category": "Food and Beverage",
        "subcategory_name": "Food and Beverage",
        "name": "Coffee-33 Panama box",
        "length": 20,
        "width": 19,
        "height": 8,
        "weight": 34.5,
        "value": 0,
        "can_be_rolled": false,
        "can_be_folded": false,
        "can_be_stacked": false
}
Attribute Type Description
id long
category string
subcategory_name string
name string
length float
width float
height float
weight float
value float
can_be_rolled boolean
can_be_folded boolean
can_be_stacked boolean

Unpacked Item Type Object

Unpacked Item Types represent types of items (i.e. Macbook Pro, Antique Chair, etc.) for which ShipHawk provides detailed information for (i.e. average length, minimum padding, whether it can be rolled or stacked, etc.)

Attribute Type Description
id string
name long
category_name string
subcategory_name string
dimensions object Dimensions Object

Dimensions Object

Attribute Type Description
length float
width float
height float
weight float

Unpacked Item API Endpoints

Retrieve an Unpacked Item Type

# 'itm_ceQKE0MS' is an example unpacked item type id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/unpacked_item_types/itm_ceQKE0MS?api_key=YOUR_API_KEY'
require 'net/http'

# 'itm_ceQKE0MS' is an example unpacked item type id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/unpacked_item_types/itm_ceQKE0MS?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

'itm_ceQKE0MS' is an example unpacked item type id.
url = 'https://sandbox.shiphawk.com/api/v4/unpacked_item_types/itm_ceQKE0MS'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
print r.content
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'shp_Zm7B5cVm' is an example shipment id, 'doc_3rkcPwbh' is an example document id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/unpacked_item_types/itm_ceQKE0MS?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/unpacked_item_types/:id?api_key=YOUR_API_KEY

Retrieve Unpacked Items Types by IDs

# 'itm_ceQKE0MS' and 'itm_QrKZQ4Jf' are example unpacked item type ids.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/unpacked_item_types/find?ids\[\]=itm_ceQKE0MS&ids\[\]=itm_QrKZQ4Jf&api_key=YOUR_API_KEY'
require 'net/http'

# 'itm_ceQKE0MS' and 'itm_QrKZQ4Jf' are example unpacked item type ids.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/unpacked_item_types/find?ids[]=itm_ceQKE0MS&ids[]=itm_QrKZQ4Jf&api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

# 'itm_ceQKE0MS' and 'itm_QrKZQ4Jf' are example unpacked item type ids.
url = 'https://sandbox.shiphawk.com/api/v4/unpacked_item_types/find?ids[]=itm_ceQKE0MS&ids[]=itm_QrKZQ4Jf'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
print r.content
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'itm_ceQKE0MS' and 'itm_QrKZQ4Jf' are example unpacked item type ids.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/unpacked_item_types/find?ids[]=itm_ceQKE0MS&ids[]=itm_QrKZQ4Jf&api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/unpacked_item_types/find?ids\[\]=:id&ids\[\]=:id&...&api_key=YOUR_API_KEY

List All Unpacked Items

curl -X GET 'https://sandbox.shiphawk.com/api/v4/unpacked_item_types?api_key=YOUR_API_KEY'
require 'net/http'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/unpacked_item_types?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/unpacked_item_types'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
print r.content
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/unpacked_item_types?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/unpacked_item_types?api_key=YOUR_API_KEY

Search for an Unpacked Item Type

# 'P8A' is an example unpacked item type name.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/unpacked_item_types/search?name=P8A&api_key=YOUR_API_KEY'
require 'net/http'

#'P8A' is an example unpacked item type name.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/unpacked_item_types/search?name=P8A&api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

# 'P8A' is an example unpacked item type name.
url = 'https://sandbox.shiphawk.com/api/v4/unpacked_item_types/search?name=P8A'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
print r.content
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'P8A' is an example unpacked item type name.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/unpacked_item_types/search?name=P8A&api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/unpacked_item_types/search?name=P8A&api_key=YOUR_API_KEY

Validates Unpacked Item Types by ID

# 'itm_ceQKE0MS' and 'itm_QrKZQ4Jf' are example unpacked item type ids.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/unpacked_item_types/check_existence?ids\[\]=itm_ceQKE0MS&ids\[\]=itm_QrKZQ4Jf&api_key=YOUR_API_KEY'
require 'net/http'

# 'itm_ceQKE0MS' and 'itm_QrKZQ4Jf' are example unpacked item type ids.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/unpacked_item_types/check_existence?ids[]=itm_ceQKE0MS&ids[]=itm_QrKZQ4Jf&api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

# 'itm_ceQKE0MS' and 'itm_QrKZQ4Jf' are example unpacked item type ids.
url = 'https://sandbox.shiphawk.com/api/v4/unpacked_item_types/check_existence?ids[]=itm_ceQKE0MS&ids[]=itm_QrKZQ4Jf'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
print r.content
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'itm_ceQKE0MS' and 'itm_QrKZQ4Jf' are example unpacked item type ids.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/unpacked_item_types/check_existence?ids[]=itm_ceQKE0MS&ids[]=itm_QrKZQ4Jf&api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/unpacked_item_types/check_existence?ids\[\]=:id&ids\[\]=:id&...&api_key=YOUR_API_KEY

Addresses

Address Resources

Address Object

Address objects represent an origin or destination of a shipment and are required in order to get rates and book shipments. They can also be saved to the address book so that frequently used addresses can be stored for search or retrieval at a later time.

Attribute Type Description
id string
name string Usually Required Not required when company is present or when rating. The name of the contact person at this address.
company string Usually Required Not required when name is present or when rating.
street1 string Usually Required Not required when rating.
street2 string Apt or suite #, mailstop, etc
city string Usually Required Not required when rating. City or town.
state string Usually Required Not required when rating. 2-digit state or province required for US and Canadian addresses.
zip string required Zip or postal code.
country string A 2-digit ISO country code. Default: US
phone_number string Usually Required Not required when rating.
email string
is_residential boolean Default: false
code string A unique reference for this address. This field is indexed so that you can search for addresses by this code using the List all Addresses endpoint. The code may have numbers, letters, underscores, and dashes.

Booking Address Object

Attribute Type Description
id String
name String
company String
street1 String
street2 String
city String
state String
zip String
country String
phone_number String
email String
is_residential Boolean
is_warehouse Boolean
address_type String
code String

Address API Endpoints

Create an Address

curl -H "Content-Type: application/json" -X POST -d '
{
  "name": "Shiphawk",
  "street1": "925 De La Vina St #300",
  "city": "SANTA BARBARA",
  "state": "CA",
  "zip": "93101"
}' 'https://sandbox.shiphawk.com/api/v4/addresses?api_key=YOUR_API_KEY'

# Example Response
{
    "id": "adr_ddstab0m",
    "name": "Shiphawk",
    "company": null,
    "street1": "925 De La Vina St #300",
    "street2": null,
    "city": "SANTA BARBARA",
    "state": "CA",
    "zip": "93101",
    "country": "US",
    "phone_number": null,
    "email": null,
    "is_residential": false,
    "is_warehouse": false,
    "address_type": null,
    "validated": false,
    "code": null
}
require 'net/http'
require 'uri'
require 'json'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/addresses?api_key=YOUR_API_KEY')

address =
'{
  "name": "Shiphawk",
  "street1": "925 De La Vina St #300",
  "city": "SANTA BARBARA",
  "state": "CA",
  "zip": "93101"
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = address

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts response.body
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/addresses'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
  "name": "Shiphawk",
  "street1": "925 De La Vina St #300",
  "city": "SANTA BARBARA",
  "state": "CA",
  "zip": "93101"
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("name", "Shiphawk")
                .add("street1", "925 De La Vina St #300")
                .add("city", "SANTA BARBARA")
                .add("state", "CA")
                .add("zip", "93101")
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            //'adr_KHsx29g8' is an example address id.
            URL url = new URL("https://sandbox.shiphawk.com/api/v4/addresses?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){     
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/addresses

Retrieve an Address

# 'adr_ddstab0m' is an example address id.
curl -H "Content-Type: application/json" -X GET
'https://sandbox.shiphawk.com/api/v4/addresses/adr_ddstab0m?api_key=YOUR_API_KEY'

# Example Response
{
    "id": "adr_ddstab0m",
    "name": "Shiphawk",
    "company": null,
    "street1": "925 De La Vina St #300",
    "street2": null,
    "city": "SANTA BARBARA",
    "state": "CA",
    "zip": "93101",
    "country": "US",
    "phone_number": null,
    "email": null,
    "is_residential": false,
    "is_warehouse": false,
    "address_type": null,
    "validated": false,
    "code": null
}
require 'net/http'

#'adr_1pEZY2F9' is an example address id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/addresses/adr_1pEZY2F9?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

#'adr_1pEZY2F9' is an example address id.
url = 'https://sandbox.shiphawk.com/api/v4/addresses/adr_1pEZY2F9'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
  public static void main(String [] args)
  {
    try{
      sendGet();
    }
    catch(IOException ex){
      ex.printStackTrace(System.out);
    }
  }
  private static void sendGet() throws IOException {
    // 'adr_W7NQxx48' is an example address id.
    URL url = new URL("https://sandbox.shiphawk.com/api/v4/addresses/adr_W7NQxx48?api_key=YOUR_API_KEY");
    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    con.setRequestMethod("GET");
    int responseCode = con.getResponseCode();

    if(responseCode == HttpURLConnection.HTTP_OK){    
      BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
      String inputLine;
      StringBuffer content = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
          content.append(inputLine);
      }
      in.close();
      System.out.println(content.toString());
    }
    else{
      System.out.println("GET request failed. Code was " + responseCode);
    }
  }
}

GET https://sandbox.shiphawk.com/api/v4/addresses/:id

Retrieve an Address by code

curl -H "Content-Type: application/json" -X POST 'https://sandbox.shiphawk.com/api/v4/addresses/codes?api_key=YOUR_API_KEY&codes=12345'

# Example Response
[
    {
        "id": "adr_eMktm1xl",
        "name": "Kiara Montross",
        "company": null,
        "street1": "316 nw 57th street",
        "street2": null,
        "city": "Newport",
        "state": "OR",
        "zip": "97365",
        "country": "US",
        "phone_number": "8776358125",
        "email": "moab31@yahoo.com",
        "is_residential": true,
        "is_warehouse": false,
        "address_type": "destination",
        "validated": false,
        "code": "12345"
    },
    ...
]
require 'net/http'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/addresses/codes?api_key=YOUR_API_KEY&codes=12345')

# Create the HTTP objects
request = Net::HTTP::Post.new(uri.request_uri)

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts response.body
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class PostRequestsSimple {
  public static void main(String [] args)
  {
    try{
      sendPost();
    }
    catch(IOException ex){
      ex.printStackTrace(System.out);
    }
  }
  private static void sendPost() throws IOException {
    URL url = new URL("https://sandbox.shiphawk.com/api/v4/addresses/codes?api_key=YOUR_API_KEY&codes=12345");
    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    con.setRequestMethod("POST");
    con.setRequestProperty("Content-Type", "application/json");

    int responseCode = con.getResponseCode();

    if(responseCode == HttpURLConnection.HTTP_CREATED){   
      BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
      String inputLine;
      StringBuffer content = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
          content.append(inputLine);
      }
      in.close();
      System.out.println(content.toString());
    }
    else{
      System.out.println("POST request failed. Code was " + responseCode);    
    }
  }
}
import requests

url = 'https://sandbox.shiphawk.com/api/v4/addresses/codes?codes=12345'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.post(url, headers=headers)

POST https://sandbox.shiphawk.com/api/v4/addresses/codes?codes=12345

Update an Address

# 'adr_ddstab0m' is an example address id.
curl -H "Content-Type: application/json" -X POST -d '
{
  "name": "ShiphawkV2"
}' 'https://sandbox.shiphawk.com/api/v4/addresses/adr_ddstab0m?api_key=YOUR_API_KEY'

# Example Response
{
    "id": "adr_ddstab0m",
    "name": "ShiphawkV2",
    "company": null,
    "street1": "316 nw 57th street",
    "street2": null,
    "city": "Newport",
    "state": "OR",
    "zip": "97365",
    "country": "US",
    "phone_number": "8776358125",
    "email": "moab31@yahoo.com",
    "is_residential": false,
    "is_warehouse": false,
    "address_type": "destination",
    "validated": false,
    "code": "12345"
}
require 'net/http'
require 'uri'
require 'json'

#'adr_1pEZY2F9' is an example address id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/addresses/adr_1pEZY2F9?api_key=YOUR_API_KEY')

address =
'{
  "name": "ShiphawkV2"
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = address

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts response.body
import requests
import json

#'adr_1pEZY2F9' is an example address id.
url = 'https://sandbox.shiphawk.com/api/v4/addresses/adr_1pEZY2F9'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
  "name": "ShiphawkV2"
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("name", "ShiphawkV2")
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            //'adr_RRYrcqPa' is an example address id.
            URL url = new URL("https://sandbox.shiphawk.com/api/v4/addresses/adr_RRYrcqPa?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){     
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/addresses/:id

Delete an Address

# 'adr_ddstab0m' is an example address id.
curl --request DELETE \
  --url https://sandbox.shiphawk.com/api/v4/addresses/adr_ddstab0m?api_key=YOUR_API_KEY
require 'net/http'

#'adr_1pEZY2F9' is an example address id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/addresses/adr_1pEZY2F9?api_key=YOUR_API_KEY')

# Create the HTTP objects
request = Net::HTTP::Delete.new(uri.request_uri)

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts response.body
import requests

#'adr_1pEZY2F9' is an example address id.
url = 'https://sandbox.shiphawk.com/api/v4/addresses/adr_1pEZY2F9'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.delete(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class DeleteRequests {
  public static void main(String [] args)
  {
    try{
      sendDelete();
    }
    catch(IOException ex){
      ex.printStackTrace(System.out);
    }
  }
  private static void sendDelete() throws IOException {
    // 'adr_KHsx29g8' is an example address id.
    URL url = new URL("https://sandbox.shiphawk.com/api/v4/addresses/adr_KHsx29g8?api_key=YOUR_API_KEY");
    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    con.setRequestMethod("DELETE");
    int responseCode = con.getResponseCode();

    if(responseCode == HttpURLConnection.HTTP_NO_CONTENT || responseCode == HttpURLConnection.HTTP_OK){   
      BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
      String inputLine;
      StringBuffer content = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
          content.append(inputLine);
      }
      in.close();
      System.out.println(content.toString());
    }
    else{
      System.out.println("DELETE request failed. Code was " + responseCode);
    }
  }
}

DELETE https://sandbox.shiphawk.com/api/v4/addresses/:id

Validate an Address

curl -H "Content-Type: application/json" -X POST -d '
{
"addresses":
 [
   {
     "street1": "1420 GARDINER LN",
     "city": "Louisville",
     "state": "KY",
     "zip": "40231"
   },
   {
     "street1": "26 Castilian Dr",
     "city": "Goleta",
     "state": "CA",
     "zip": "93117"
    }
  ]
}' 'https://sandbox.shiphawk.com/api/v4/addresses/validate?api_key=YOUR_API_KEY'

# Example Response
{
"valid": false,
"non_deliverable_addresses": [
 {
   "street1": "1 Infinite",
   "city": "Cupertins",
   "state": "WA",
   "zipcode": "95014",
   "suggestions": [
     {
       "street1": "1 Infinite Loop",
       "city": "Cupertino",
       "state": "CA",
       "zipcode": "95014"
     }
   ]
 }
]
}
require 'net/http'
require 'uri'
require 'json'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/addresses/validate?api_key=YOUR_API_KEY')

address =
'{
"addresses":
 [
   {
     "street1": "1420 GARDINER LN",
     "city": "Louisville",
     "state": "KY",
     "zip": "40231"
   },
   {
     "street1": "26 Castilian Dr",
     "city": "Goleta",
     "state": "CA",
     "zip": "93117"
    }
  ]
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = address

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts response.body
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/addresses/validate'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
"addresses":
 [
   {
     "street1": "1420 GARDINER LN",
     "city": "Louisville",
     "state": "KY",
     "zip": "40231"
   },
   {
     "street1": "26 Castilian Dr",
     "city": "Goleta",
     "state": "CA",
     "zip": "93117"
    }
  ]
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("addresses", Json.createArrayBuilder()
                    .add(Json.createObjectBuilder()
                        .add("street1", "1420 GARDINER LN")
                        .add("city", "Lousville")
                        .add("state", "KY")
                        .add("zip", "40231")
                        )
                    .add(Json.createObjectBuilder()
                        .add("street1", "26 Castilian Dr")
                        .add("city", "Goleta")
                        .add("state", "CA")
                        .add("zip", "93117")
                        )
                    )
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            URL url = new URL("https://sandbox.shiphawk.com/api/v4/addresses/validate?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){     
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/addresses/validate

List all Addresses

curl -H "Content-Type: application/json" -X GET 'https://sandbox.shiphawk.com/api/v4/addresses/search?api_key=YOUR_API_KEY&q='

# Example Response
[
    {
        "id": "adr_eMktm1xe",
        "name": "Kiara Montross",
        "company": null,
        "street1": "316 nw 57th street",
        "street2": null,
        "city": "Newport",
        "state": "OR",
        "zip": "97365",
        "country": "US",
        "phone_number": "8776358125",
        "email": "moab31@yahoo.com",
        "is_residential": true,
        "is_warehouse": false,
        "address_type": "destination",
        "validated": false,
        "code": null
    },
    ...
]
require 'net/http'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/addresses/search?api_key=YOUR_API_KEY&q=')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/addresses/search'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
  public static void main(String [] args)
  {
    try{
      sendGet();
    }
    catch(IOException ex){
      ex.printStackTrace(System.out);
    }
  }
  private static void sendGet() throws IOException {
    // 'adr_W7NQxx48' is an example address id.
    URL url = new URL("https://sandbox.shiphawk.com/api/v4/addresses?api_key=YOUR_API_KEY&q=");
    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    con.setRequestMethod("GET");
    int responseCode = con.getResponseCode();

    if(responseCode == HttpURLConnection.HTTP_OK){    
      BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
      String inputLine;
      StringBuffer content = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
          content.append(inputLine);
      }
      in.close();
      System.out.println(content.toString());
    }
    else{
      System.out.println("GET request failed. Code was " + responseCode);
    }
  }
}

GET https://sandbox.shiphawk.com/api/v4/addresses/search

Retrieve Address Count

curl -H "Content-Type: application/json" -X GET 'https://sandbox.shiphawk.com/api/v4/addresses/counts?api_key=YOUR_API_KEY&q='

# Example Response
{
    "is_warehouse": 5,
    "is_not_warehouse": 1443405
}
require 'net/http'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/addresses/counts?api_key=YOUR_API_KEY&q=')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/addresses/counts'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
  public static void main(String [] args)
  {
    try{
      sendGet();
    }
    catch(IOException ex){
      ex.printStackTrace(System.out);
    }
  }
  private static void sendGet() throws IOException {
    // 'adr_W7NQxx48' is an example address id.
    URL url = new URL("https://sandbox.shiphawk.com/api/v4/addresses/counts?api_key=YOUR_API_KEY&q=");
    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    con.setRequestMethod("GET");
    int responseCode = con.getResponseCode();

    if(responseCode == HttpURLConnection.HTTP_OK){    
      BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
      String inputLine;
      StringBuffer content = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
          content.append(inputLine);
      }
      in.close();
      System.out.println(content.toString());
    }
    else{
      System.out.println("GET request failed. Code was " + responseCode);
    }
  }
}

GET https://sandbox.shiphawk.com/api/v4/addresses/counts

Documents

Document Resources

Document Object

A document is the paperwork required by a particular carrier in order to ship a set of goods. For parcel carriers, a shipping label is needed. For LTL carriers, a bill of lading is needed. For international shipments, a commercial invoice and Internal Transaction Number (ITN) may be needed.

Attribute Type Description
id string
customer_uploaded boolean
type string The document types are: bol signed_bol pod address_label waybill carrier_doc image other
extension string
code string
url string A URL link to a pdf version of the document
meta_data hash
created_at float

Document API Endpoints

Create a Document on the Shipment

# `shp_nhMNNzwQ` is an example shipment id.
curl -X POST -d '
{
    "files": "path_to_file"
}' 'https://sandbox.shiphawk.com/api/v4/shipments/shp_nhMNNzwQ/documents?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

# 'shp_10RCpAYY' is an example shipment id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/shp_10RCpAYY/documents?api_key=YOUR_API_KEY')

document =
'{
    "files": "path_to_file"
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = document

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

# 'shp_10RCpAYY' is an example shipment id.
url = 'https://sandbox.shiphawk.com/api/v4/shipments/shp_10RCpAYY/documents'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "files": "path_to_file"
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("files", "path_to_file")
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            // 'shp_Zm7B5cVm' is an example shipment id.
            URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/shp_Zm7B5cVm/documents?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){     
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/shipments/:id/documents

Retrieve a Document From the Shipment

# `shp_nhMNNzwQ` is an example shipment id, `doc_zVv5N3hX` is an example document id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/shipments/shp_nhMNNzwQ/documents/doc_zVv5N3hX?api_key=YOUR_API_KEY'

# Example Response
{
    "id": "doc_zVv5N3hX",
    "customer_uploaded": false,
    "type": "Other",
    "extension": "ZPL",
    "code": "other",
    "url": "https://shiphawk-assets-qa.s3.amazonaws.com/uploads/package_label_5c7fff4e324e6f1c98e4.zpl?AWSAccessKeyId=AKIAIGBEYNQ6VGNFN2GQ&Signature=koAh%2BiGwztnGjDDiJp/zu3CfOMM%3D&Expires=1864550533",
    "meta_data": {},
    "created_at": "2019-01-17T20:25:46.530+00:00",
    "filename": "package_label_5c7fff4e324e6f1c98e4.zpl"
}
require 'net/http'

# 'shp_10RCpAYY' is an example shipment id and 'doc_aM5pCQ2A' is an example documents id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/shp_10RCpAYY/documents/doc_aM5pCQ2A?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

# 'shp_10RCpAYY' is an example shipment id and 'doc_aM5pCQ2A' is an example documents id.
url = 'https://sandbox.shiphawk.com/api/v4/shipments/shp_10RCpAYY/documents/doc_aM5pCQ2A'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'shp_Zm7B5cVm' is an example shipment id, 'doc_3rkcPwbh' is an example document id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/shp_Zm7B5cVm/documents/doc_3rkcPwbh?api_key=YOUR_API_KEY&q=");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){      
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/shipments/:id/documents/:id

Update Document Type of Document on the Shipment

#`shp_nhMNNzwQ` is an example shipment id, `doc_q04Sx49Z` is an example document id.
curl -H "Content-Type: application/json" -X POST -d '
{
    "type":"other"
}' 'https://sandbox.shiphawk.com/api/v4/shipments/shp_nhMNNzwQ/documents/doc_q04Sx49Z?api_key=YOUR_API_KEY'
`POST https://sandbox.shiphawk.com/api/v4/shipments/:id/documents/:id?api_key=YOUR_API_KEY`

# Example Response
{
    "id": "doc_zVv5N3hX",
    "customer_uploaded": false,
    "type": "Other",
    "extension": "ZPL",
    "code": "other",
    "url": "https://shiphawk-assets-qa.s3.amazonaws.com/uploads/package_label_5c7fff4e324e6f1c98e4.zpl?AWSAccessKeyId=AKIAIGBEYNQ6VGNFN2GQ&Signature=eUpEyVE9ry964u8gtK05z8463T4%3D&Expires=1864550316",
    "meta_data": {},
    "created_at": "2019-01-17T20:25:46.530+00:00",
    "filename": "package_label_5c7fff4e324e6f1c98e4.zpl"
}
require 'net/http'
require 'uri'
require 'json'

#'shp_10RCpAYY' is an example shipment id and 'doc_aM5pCQ2A' is an example document id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/shp_10RCpAYY/documents/doc_aM5pCQ2A?api_key=YOUR_API_KEY')

document =
'{
    "type":"other"
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = document

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/shipments/shp_10RCpAYY/documents/doc_aM5pCQ2A'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "type":"other"
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("type", "other")
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            // 'shp_Zm7B5cVm' is an example shipment id, 'doc_3rkcPwbh' is an example document id.
            URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/shp_Zm7B5cVm/documents/doc_3rkcPwbh?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){     
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/shipments/:id/documents/:id

Delete a Document from the Shipment

#'shp_nhMNNzwQ' is an example shipment id and 'doc_q04Sx49Z' is an example document id.
curl -X DELETE 'https://sandbox.shiphawk.com/api/v4/shipments/shp_nhMNNzwQ/documents/doc_q04Sx49Z?api_key=YOUR_API_KEY'
require 'net/http'

#'shp_nhMNNzwQ' is an example shipment id and 'doc_zVv5N3hX' is an example document id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/shp_nhMNNzwQ/documents/doc_zVv5N3hX?api_key=YOUR_API_KEY')

# Create the HTTP objects
request = Net::HTTP::Delete.new(uri.request_uri)

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests

#'shp_nhMNNzwQ' is an example shipment id and 'doc_zVv5N3hX' is an example document id.
url = 'https://sandbox.shiphawk.com/api/v4/shipments/shp_nhMNNzwQ/documents/doc_zVv5N3hX'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.delete(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class DeleteRequests {
    public static void main(String [] args)
    {
        try{
            sendDelete();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendDelete() throws IOException {
        // 'shp_Zm7B5cVm' is an example shipment id, 'doc_3rkcPwbh' is an example document id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/shp_Zm7B5cVm/documents/doc_3rkcPwbh?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("DELETE");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_NO_CONTENT || responseCode == HttpURLConnection.HTTP_OK){     
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("DELETE request failed. Code was " + responseCode);
        }
    }
}

DELETE https://sandbox.shiphawk.com/api/v4/shipments/:id/documents/:id

Email Shipping Documents

#`shp_nhMNNzwQ` is an example shipment id, assuming shipment has requested documents.
curl -H "Content-Type: application/json" -X POST -d '
{
    "documents": "doc_zVv5N3hX"
}' 'https://sandbox.shiphawk.com/api/v4/shipments/shp_nhMNNzwQ/documents/email?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

#'shp_10RCpAYY' is an example shipment id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/shp_10RCpAYY/documents/email?api_key=YOUR_API_KEY')

document =
'{
    "documents": "doc_zVv5N3hX"
}'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = document

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response.body
import requests
import json

#'shp_10RCpAYY' is an example shipment id.
url = 'https://sandbox.shiphawk.com/api/v4/shipments/shp_10RCpAYY/documents/email'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "documents": "doc_zVv5N3hX"
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject personObject = Json.createObjectBuilder()
                .add("documents", "doc_0nc6ZSGW")
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", personObject.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            // 'shp_Zm7B5cVm' is an example shipment id.
            URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/shp_Zm7B5cVm/documents/email?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(personObject.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){     
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/shipments/:id/documents/email

Retrieve a List of Shipment's Documents

#'shp_nhMNNzwQ' is an example shipment id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/shipments/shp_nhMNNzwQ/documents?api_key=YOUR_API_KEY'

# Example Response
[
    {
        "id": "doc_dz3fhBMC",
        "customer_uploaded": false,
        "type": "Packing Slip",
        "extension": "PDF",
        "code": "packing_slip",
        "url": "https://shiphawk-assets-qa.s3.amazonaws.com/uploads/packing_slip_8c5ed7e2f552ac8dfa97f97b4597a9e2.pdf?AWSAccessKeyId=AKIAIGBEYNQ6VGNFN2GQ&Signature=VOPDM5VjkhbaSHDfsVG00j5GAnY%3D&Expires=1864552092",
        "meta_data": {},
        "created_at": "2019-01-29T23:35:37.589+00:00",
        "filename": "packing_slip_8c5ed7e2f552ac8dfa97f97b4597a9e2.pdf"
    },
    {
        "id": "doc_BGT54Etg",
        "customer_uploaded": false,
        "type": "Package Labels Combined",
        "extension": "PDF",
        "code": "package_labels_combined",
        "url": "https://shiphawk-assets-qa.s3.amazonaws.com/uploads/package_labels_combined_20190129-1340-1a2evvy.pdf?AWSAccessKeyId=AKIAIGBEYNQ6VGNFN2GQ&Signature=bXsqXXpGvToR9D0hIH9hOMl%2B3s0%3D&Expires=1864552092",
        "meta_data": {},
        "created_at": "2019-01-17T201-29T23:35:32.559+00:00",
        "filename": "package_labels_combined_20190129-1340-1a2evvy.pdf"
    }
]
require 'net/http'

#'shp_10RCpAYY' is an example shipment id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/shipments/shp_10RCpAYY/documents?api_key=YOUR_API_KEY&q=')
response = Net::HTTP.get(uri)

puts response
import requests

#'shp_10RCpAYY' is an example shipment id.
url = 'https://sandbox.shiphawk.com/api/v4/shipments/shp_10RCpAYY/documents'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
// Running with javax.json-1.0.jar 
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        // 'shp_Zm7B5cVm' is an example shipment id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/shipments/shp_Zm7B5cVm/documents?api_key=YOUR_API_KEY&q=");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){      
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/shipments/:id/documents

Material Containers

Material Container Resources

Material Container Request Object

Used when creating or updating Material Container. Parameters are optional unless noted.

Parameter Type Description, Defaults
name String
packing_type String Packing type ("parcel", "carton", "box", "pallet", etc.)
length Float
width Float
height Float
weight Float
max_capacity_weight Float
max_stack_height Float
is_active Boolean
warehouse_public_ids Array List of Warehouses ( id )

Material Container Response Object

{
    "id": "mc_817t4wBv",
    "carrier": null,
    "carrier_container_name": null,
    "name": "TEST #1",
    "packing_type": "pallet",
    "length": 10.0,
    "width": 10.0,
    "height": 10.0,
    "weight": 10.0,
    "max_capacity_weight": null,
    "max_stack_height": 96.0,
    "is_active": false,
    "warehouses": []
}

Returned from MaterialContainer creation, updating, fetching, etc.

Attributes Type Description
id String ShipHawk MaterialContainer identifier.
carrier Hash Material Container Carrier Response object
carrier_container_name String
name String
packing_type String Packing type ("parcel", "carton", "box", "pallet", etc.)
length Float
width Float
height Float
weight Float
max_capacity_weight Float
max_stack_height Float
is_active Boolean
warehouses Array List of Material Container Warehouses Response Objects

Material Container Warehouses Response Objects

Attribute Type Description
id String
code String

Material Container Carrier Response object

Attribute Type Description
code String
name String

Material Container Search Request Object

Used for search/filtering.

Parameter Type Description, Defaults
query String Name of material container
statuses Array[Boolean] Include active/not active materials containers
packing_types Array[String] List of packing types ("parcel", "carton", "box", "pallet", etc.)
warehouse_public_ids Array[String] List of warehouse ids
carrier_ids Array[String] List of carrier ids
with_custom_carrier Boolean Include own materials

Material Container API Endpoints

List all Material Containers

curl -X GET 'https://sandbox.shiphawk.com/api/v4/materials/containers' -H 'X-User-Email:YOUR_ACCOUNT_EMAIL' -H 'X-User-Token: YOUR_ACCOUNT_TOKEN'

# Example Response
List of Material Containers Response Object

GET https://sandbox.shiphawk.com/api/v4/materials/containers

Search for Material Containers

# 'whs_8MXd7Phd' is a warehouse id
# with_custom_carrier - means include own materials

curl -X GET 'https://sandbox.shiphawk.com/api/v4/materials/containers?per_page=10&page=1&query=Express&packing_types[]=parcel,box&carrier_ids[]=3,18&warehouse_public_ids[]=whs_8MXd7Phd&statuses[]=false,true&with_custom_carrier=false' -H 'X-User-Email:YOUR_ACCOUNT_EMAIL' -H 'X-User-Token: YOUR_ACCOUNT_TOKEN'

# Example Response
List of Material Containers Response Object

GET https://sandbox.shiphawk.com/api/v4/materials/containers?per_page=10&page=1&query=Express&packing_types[]=parcel,box&carrier_ids[]=3,18&warehouse_public_ids[]=whs_8MXd7Phd&statuses[]=false,true&with_custom_carrier=false

Create a Material Container

curl -X POST -H "X-User-Email: YOUR_ACCOUNT_EMAIL" -H "X-User-Token: YOUR_ACCOUNT_TOKEN" -H "Content-Type: application/json" -d '
{
    "name": "Material container name",
    "packing_type": "pallet",
    "length": "10",
    "width": "10",
    "height": "10",
    "weight": "10",
    "warehouse_public_ids": []
}' 'https://sandbox.shiphawk.com/api/v4/materials/containers'

# Example Response
Material Container Response Object

POST https://sandbox.shiphawk.com/api/v4/materials/containers

Update a Material Container

#'mc_y4W6Trgy' is an example material container id.

curl -X POST -H "X-User-Email: YOUR_ACCOUNT_EMAIL" -H "X-User-Token: YOUR_ACCOUNT_TOKEN" -H "Content-Type: application/json" -d '
{
    "name": "Super XL Art Box"
    "packing_type": "pallet",
    "is_active": "false",
    "warehouse_public_ids": ["whs_8MXd7Phd"]
}' 'https://sandbox.shiphawk.com/api/v4/materials/containers/mc_y4W6Trgy'

# Example Response
Material Container Response Object

POST https://sandbox.shiphawk.com/api/v4/materials/containers/:id

Delete a Material Container

# 'mc_6RdEWCWN' is an example of material container id

curl -H "Content-Type: application/json" -X DELETE 'https://sandbox.shiphawk.com/api/v4/materials/containers/mc_6RdEWCWN'

# Example Response
Status: 204

DELETE https://sandbox.shiphawk.com/api/v4/materials/containers/mc_6RdEWCWN

Delete bulk of Material Containers

# 'mc_n7nJ5XjQ' is an example of material container id

curl -H "Content-Type: application/json" -H 'X-User-Email: YOUR_ACCOUNT_EMAIL' -H 'X-User-Token: YOUR_ACCOUNT_TOKEN' -X DELETE -d '
{
   "public_ids": ["mc_n7nJ5XjQ"]
}' 'https://sandbox.shiphawk.com/api/v4/materials/containers/bulk'

# Example Response
Status: 204

DELETE https://sandbox.shiphawk.com/api/v4/materials/containers/bulk

Retrieve a statistic of Material Containers

curl -X GET 'https://sandbox.shiphawk.com/api/v4/materials/containers/statistic' -H 'X-User-Email:YOUR_ACCOUNT_EMAIL' -H 'X-User-Token: YOUR_ACCOUNT_TOKEN'

# Example Response
{
  "packing_types": [
    {
      "label": "pallet",
      "count": 9
    },
    {
      "label": "parcel",
      "count": 157
    }
    ],
    "statuses": [
    {
      "label": "enabled",
      "count": 110
    },
    {
      "label": "disabled",
      "count": 56
    }
  ],
  "warehouses": [
    {
      "label": "whs_FZvTNdRY",
      "count": 1
    }
  ],
  "carriers": [
    {
      "label": null,
      "count": 111
    },
    {
      "label": 233,
      "count": 22
    },
    {
      "label": 2,
      "count": 7
    },
    {
      "label": 3,
      "count": 15
    },
    {
      "label": 18,
      "count": 11
    }
  ]
}

GET https://sandbox.shiphawk.com/api/v4/materials/containers/statistic

Retrieve a filtered statistic of Material Containers

curl -X GET 'https://sandbox.shiphawk.com/api/v4/materials/containers/statistic?query=Express&packing_types[]=parcel,box&carrier_ids[]=3,18&warehouse_ids[]=273&statuses[]=false' -H 'X-User-Email:YOUR_ACCOUNT_EMAIL' -H 'X-User-Token: YOUR_ACCOUNT_TOKEN'

# Example Response
{
  "packing_types": [
    {
      "label": "parcel",
      "count": 18
    }
    ],
    "statuses": [
    {
      "label": "enabled",
      "count": 0
    },
    {
      "label": "disabled",
      "count": 18
    }
  ],
  "warehouses": [],
  "carriers": [
    {
      "label": 2,
      "count": 6
    },
    {
      "label": 3,
      "count": 15
    },
    {
      "label": 18,
      "count": 3
    },
    {
      "label": 233,
      "count": 4
    }
  ]
}

GET https://sandbox.shiphawk.com/api/v4/materials/containers/statistic?query=Express&packing_types[]=parcel,box&carrier_ids[]=3,18&warehouse_ids[]=273&statuses[]=false

Material Containers Import

Upload csv file with material containers

curl -X POST -H "X-User-Email: YOUR_ACCOUNT_EMAIL" -H "X-User-Token: YOUR_ACCOUNT_TOKEN" -H "Content-Type: application/json" -d '
{
    "file": "path_to_CSV_file"
}' 'https://sandbox.shiphawk.com/api/v4/materials/containers_import'

# Example Response
Status 201

POST https://sandbox.shiphawk.com/api/v4/materials/containers_import

Rating Rules

Rating Rule Resources

Rating Rule Request Object

#Example Request Body
{
    "criteria": [
        {
            "field":null,
            "operator":"GLOBAL",
            "value":null
        }],
    "actions":[
        {
            "name":"best_rate_filter",
            "value":null
        }],
    "name":"Test",
    "active":true,
    "is_backup_rate":false
}

Parameters are optional unless specified.

Attribute Type Description
name String
active Boolean
is_backup_rate Boolean Default: false
criteria Array List of:
{
field: String (required)
operator: String (required)
value: String or NilClass (required and coerce with SpaceRemoverService)
group: String
extra_value: String (coerce with SpaceRemoverService)
extra_field: String
}
actions Array required:
{
name: String (required)
value: Any
}

Rating Rule Response Object

Returned from Rating Rule Creation, Retrieval, etc.

#Example Response Body
{
    "id": "rule_Cf39XArZ",
    "name": "Test",
    "active": true,
    "is_backup_rate": false,
    "subtype": "post_rating",
    "criteria": [
        {
            "field": "global",
            "operator": "GLOBAL",
            "value": true,
            "group": null,
            "extra_value": null,
            "extra_field": null
        }
    ],
    "actions": [
        {
            "name": "best_rate_filter",
            "value": null
        }
    ],
    "created_at": "2019-04-26T21:59:09+00:00",
    "updated_at": "2019-04-26T21:59:09+00:00",
    "rule_type": "RatingRule"
}
Attribute Type Description
id String
name String
active Boolean
is_backup_rate Boolean
subtype Rating Rule Criteria Response Object
actions Rating Rule Action Response Object
created_at DateTime
updated_at DateTime
rule_type String

Rating Rule Criteria Response Object

Attribute Type Description
field String
operator String
value Integer, Float, or String
group String
extra_value String
extra_field String

Rating Rule Action Response Object

Attribute Type Description
name String
value Integer, Float, or String

Rating Rule Endpoints

Create a Rating Rule

curl -H "Content-Type: application/json" -X POST -d'{
    "criteria":[{"field":null,"operator":"GLOBAL","value":null}],
    "actions":[{"name":"best_rate_filter","value":null}],
    "name":"Test",
    "active":true,
    "is_backup_rate":false
}' 'https://sandbox.shiphawk.com/api/v4/rating_rules?api_key=YOUR_API_KEY'

require 'net/http'
require 'uri'
require 'json'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/rating_rules?api_key=YOUR_API_KEY')

rate =
'{
    "criteria":[{"field":null,"operator":"GLOBAL","value":null}],
    "actions":[{"name":"packing_slip_template","value":null}],
    "name":"Test",
    "active":true,
    "is_backup_rate":false
 }'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri.request_uri, 'Content-Type' => 'application/json')
request.body = rate

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

print(response.body)
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/rating_rules'
headers = {'X-Api-Key': YOUR_API_KEY}
payload = {
    "criteria":[{"field":"null","operator":"GLOBAL","value":"null"}],
    "actions":[{"name":"packing_slip_template","value":"null"}],
    "name":"Test",
    "active":"true",
    "is_backup_rate":"false"
}
r = requests.post(url, headers=headers, json=payload)
print r
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject body = Json.createObjectBuilder()
                .add("criteria", Json.createArrayBuilder()
                    .add(Json.createObjectBuilder()
                        .add("field", JsonObject.NULL)
                        .add("operator", "GLOBAL")
                        .add("value", JsonObject.NULL)))
                .add("actions", Json.createArrayBuilder()
                    .add(Json.createObjectBuilder()
                        .add("name", "use_warehouse_for_rating")
                        .add("value", JsonObject.NULL)))
                .add("name", "Test!!!!")
                .add("active", "true")
                .add("is_backup_rate", "false")
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", body.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            URL url = new URL("https://sandbox.shiphawk.com/api/v4/rating_rules?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(body.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

POST https://sandbox.shiphawk.com/api/v4/rating_rules/?api_key=YOUR_API_KEY

Update a Rating Rule

#'rule_Cf39XArZ' is an example rule id.
curl -H "Content-Type: application/json" -X POST -d'{
    "criteria":[{"field":null,"operator":"GLOBAL","value":null}],
    "actions":[{"name":"best_rate_filter","value":null}],
    "name":"Test",
    "active":true,
    "is_backup_rate":false
}' 'https://sandbox.shiphawk.com/api/v4/rating_rules/rule_Cf39XArZ?api_key=YOUR_API_KEY'

require 'net/http'
require 'uri'
require 'json'

# 'rule_Cf39XArZ' is an example rule id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/rating_rules/rule_Cf39XArZ?api_key=YOUR_API_KEY')

rate =
'{
    "criteria":[{"field":null,"operator":"GLOBAL","value":null}],
    "actions":[{"name":"packing_slip_template","value":null}],
    "name":"Test",
    "active":true,
    "is_backup_rate":false
 }'

# Create the HTTP objects
request = Net::HTTP::Post.new(uri.request_uri, 'Content-Type' => 'application/json')
request.body = rate

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

print(response.body)
import requests
import json

# 'rule_YQdgjy2M' is an example rule id.
url = 'https://sandbox.shiphawk.com/api/v4/rating_rules/rule_YQdgjy2M'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "criteria":[{"field":"null","operator":"GLOBAL","value":"null"}],
    "actions":[{"name":"packing_slip_template","value":"null"}],
    "name":"Test",
    "active":"true",
    "is_backup_rate":"false"
 }
r = requests.post(url, headers=headers, json=payload)
print r

POST https://sandbox.shiphawk.com/api/v4/rating_rules/:id?api_key=YOUR_API_KEY

Retrieve a Rating Rule

# 'rule_Cf39XArZ' is an example rule id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/rating_rules/rule_Cf39XArZ?api_key=YOUR_API_KEY'
require 'net/http'

# 'rule_Cf39XArZ' is an example rule id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/rating_rules/rule_Cf39XArZ?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

# 'rule_Cf39XArZ' is an example rating rule id.
url = 'https://sandbox.shiphawk.com/api/v4/rating_rules/rule_Cf39XArZ'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
print r
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class PostRequests {
    public static void main(String [] args)
    {
        try{
            sendPost();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendPost() throws IOException {
        JsonObject body = Json.createObjectBuilder()
                .add("criteria", Json.createArrayBuilder()
                    .add(Json.createObjectBuilder()
                        .add("field", JsonObject.NULL)
                        .add("operator", "GLOBAL")
                        .add("value", JsonObject.NULL)))
                .add("actions", Json.createArrayBuilder()
                    .add(Json.createObjectBuilder()
                        .add("name", "use_warehouse_for_rating")
                        .add("value", JsonObject.NULL)))
                .add("name", "Test5")
                .add("active", "true")
                .add("is_backup_rate", "false")
                .build();
        try{
            // For formatting json object to be readable
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
            scriptEngine.put("jsonString", body.toString());
            scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
            String prettyPrintedJson = (String) scriptEngine.get("result");

            //'rule_5JpV5vRB' is an example rating rule id.
            URL url = new URL("https://sandbox.shiphawk.com/api/v4/rating_rules/rule_5JpV5vRB?api_key=YOUR_API_KEY");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);
            OutputStream os = con.getOutputStream();
            os.write(body.toString().getBytes());
            os.flush();
            os.close();

            int responseCode = con.getResponseCode();

            if(responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_OK){
                BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
                String inputLine;
                StringBuffer content = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            }
            else{
                System.out.println("POST request failed. Code was " + responseCode);
                System.out.println("Body form:\n" +  prettyPrintedJson);
            }
        } catch(NullPointerException ex){
            ex.printStackTrace(System.out);
        } catch(ScriptException ex){
            ex.printStackTrace(System.out);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/rating_rules/:id?api_key=YOUR_API_KEY

List all Rating Rules

curl -X GET 'https://sandbox.shiphawk.com/api/v4/rating_rules?api_key=YOUR_API_KEY'
require 'net/http'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/rating_rules?api_key=YOUR_API_KEY')
response = Net::HTTP.get(uri)

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/rating_rules'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.get(url, headers=headers)
print r
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class GetRequests {
    public static void main(String [] args)
    {
        try{
            sendGet();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendGet() throws IOException {
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/rating_rules?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_OK){
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("GET request failed. Code was " + responseCode);
        }
    }
}

GET https://sandbox.shiphawk.com/api/v4/rating_rules?api_key=YOUR_API_KEY

Delete a Rating Rule

# 'rule_Cf39XArZ' is an example rule id.
curl -X DELETE 'https://sandbox.shiphawk.com/api/v4/rating_rules/rule_Cf39XArZ?api_key=YOUR_API_KEY'
require 'net/http'

# 'rule_pdzqXh1a' is an example rule id.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/rating_rules/rule_pdzqXh1a?api_key=YOUR_API_KEY')
request = Net::HTTP::Delete.new(uri)

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end

puts response
import requests

# 'rule_pdzqXh1a' is an example rating rule id.
url = 'https://sandbox.shiphawk.com/api/v4/rating_rules/rule_pdzqXh1a'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

r = requests.delete(url, headers=headers)
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;

public class DeleteRequests {
    public static void main(String [] args)
    {
        try{
            sendDelete();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }
    private static void sendDelete() throws IOException {
        // 'rule_5JpV5vRB' is an example rating rule id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/rating_rules/rule_5JpV5vRB?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("DELETE");
        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_NO_CONTENT || responseCode == HttpURLConnection.HTTP_OK){
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("DELETE request failed. Code was " + responseCode);
        }
    }
}

DELETE https://sandbox.shiphawk.com/api/v4/rating_rules/:id?api_key=YOUR_API_KEY

Delete all Rating Rules

curl -H "Content-Type: application/json" -X DELETE -d '
{
    "id": ["rule_CjKy0RQT", "rule_xknrDsDk"]
}' 'https://sandbox.shiphawk.com/api/v4/rating_rules?api_key=YOUR_API_KEY'
require 'net/http'
require 'uri'
require 'json'

uri = URI.parse('https://sandbox.shiphawk.com/api/v4/rating_rules?api_key=YOUR_API_KEY')

# 'rule_kVjnqnj5' and 'rule_12wSFsNr' are example rate ids.
rate =
'{
    "id": ["rule_12wSFsNr", "rule_kVjnqnj5"]
 }'

# Create the HTTP objects
request = Net::HTTP::Delete.new(uri.request_uri, 'Content-Type' => 'application/json')
request.body = rate

# Send the request
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
end
import requests
import json

url = 'https://sandbox.shiphawk.com/api/v4/rating_rules'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
    "id": ["rule_pdzqXh1a", "rule_E01B3YTb"]
 }
r = requests.delete(url, headers=headers, json=payload)
print r
// Running with javax.json-1.0.jar
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.script.*;

public class DeleteRequestBody {
    public static void main(String [] args)
    {
        try{
            sendDelete();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }

    // 'rule_YQdgjy2M' and 'rule_0BWDNe1k' are example rating rule ids.
    private static void sendDelete() throws IOException {
    JsonObject body = Json.createObjectBuilder()
            .add("id", Json.createArrayBuilder()
                .add("rule_YQdgjy2M")
                .add("rule_0BWDNe1k"))
            .build();
    try{
        // For formatting json object to be readable
        ScriptEngineManager manager = new ScriptEngineManager();
        ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
        scriptEngine.put("jsonString", body.toString());
        scriptEngine.eval("result = JSON.stringify(JSON.parse(jsonString), null, 2)");
        String prettyPrintedJson = (String) scriptEngine.get("result");

        URL url = new URL("https://sandbox.shiphawk.com/api/v4/rating_rules?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("DELETE");
        con.setRequestProperty("Content-Type", "application/json");
        con.setDoOutput(true);
        OutputStream os = con.getOutputStream();
        os.write(body.toString().getBytes());
        os.flush();
        os.close();

        int responseCode = con.getResponseCode();

        if(responseCode == HttpURLConnection.HTTP_NO_CONTENT || responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT){
            BufferedReader in = new BufferedReader(
              new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            System.out.println(content.toString());
        }
        else{
            System.out.println("POST request failed. Code was " + responseCode);
            System.out.println("Body form:\n" +  prettyPrintedJson);
        }
    } catch(NullPointerException ex){
        ex.printStackTrace(System.out);
    } catch(ScriptException ex){
        ex.printStackTrace(System.out);
    }
    }
}

DELETE https://sandbox.shiphawk.com/api/v4/rating_rules?api_key=YOUR_API_KEY

Shipping Policies

Shipping Policy Resources

Shipping Policy Request Object

# Example Request Body
{
    "criteria":[{"field":null,"operator":"GLOBAL","value":null}],
    "actions":[{"name":"add_insurance","value":null}],
    "name":"Tesssst",
    "active":true,
    "is_backup_rate":false
}

Parameters are optional unless specified.

Attribute Type Description
name String
active Boolean
is_backup_rate Boolean Default: false
criteria Array List of:
{
field: String (required)
operator: String (required)
value: String or NilClass (required and coerce with SpaceRemoverService)
group: String
extra_value: String (coerce with SpaceRemoverService)
extra_field: String
}
actions Array required:
{
name: String (required)
value: Any
}

Shipping Policy Response Object

# Example Response Body
{
    "id": "spol_gaBcrA9M",
    "name": "Tesssst",
    "active": true,