NAV Navbar
cURL Ruby Python Java

Overview

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.

Examples are shown on the right side of the page. 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.

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 send and receive 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 or as a param in an HTTP request.

curl --request GET 'https://shiphawk.com/api/v4/user' \
            --header 'Content-Type: application/json' \
            --header 'x-api-key: YOUR_API_KEY'

Examples: GET /api/v4/users?api_key={YOUR_API_KEY}

API Hosts Block

Production: https://shiphawk.com

Sandbox: https://sandbox.shiphawk.com

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 use the Create Shipment endpoint to create their shipments. All processes 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 can use our shared Sandbox environment. These two environments are in many cases identical; however, the Sandbox environment might 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 by means of API endpoints, as well as by means of 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 (support@shiphawk.com), 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 whether 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 Object

Params for creating and updating Orders

Parameter Type Description, Defaults
order_number String required for creation, optional for update.
source_system String Source system (such as "NetSuite", "Shopify", "Magento", and so on).
source_system_id String *
source_system_domain String *
source_system_meta Hash A free form hash that can store information for customization.
source String deprecated
source_system_processed_at DateTime
unbundle_kits Boolean Whether or not Order should split kit into separate order line items.
origin_address Address Order Address Request object
destination_address Address Order Address Request object
billing_address Address Order Address Request object
order_line_items Array[OrderLineItem] List of Order Line item request objects.
tax_price Float
shipping_price Float
total_price Float Price presented to customer of an Order.
items_price Float
status String Options:
  • new (default)
  • partially_shipped
  • shipped
  • delivered
  • cancelled
  • on_hold
  • picking
requested_shipping_details String Can be used in rules for building criteria. Usually looks like "Carrier - Service" pair.
requested_rate_id String or Array[String] Rate ID that is returned from /rates endpoint. If provided on Order creation, Order will use data from Rate (like Carrier/Service)
tags Array[String]
warehouse_id String
warehouse_code String
self_packed Boolean Default: true.
Don't add packing cost to the rate.
include_return_label Boolean Default: false.
Specify whether return label is printed with regular labels.
reference_numbers Array[ReferenceNumber] List of Reference Number Request objects.
proposed_shipments Array[ProposedShipment] List of Proposed Shipment Request objects.
notes Array[Note] List of Note Request objects.
instant_proposed_shipment_generation Boolean Default: false
Specifies whether the rating of an Order happens on its creation, which would slow down Order creation.
billing_details BillingDetails Shipment Billing Details Request object
duties_taxes_billing_details BillingDetails Shipment Billing Details Request object
regenerate_proposed_shipments Boolean Available only on update.
Regenerate (rerate Order) ProposedShipments after update.
regenerate_proposed_shipments_if_changed Boolean Same as regenerate_proposed_shipments but would trigger rerate if any field which effects rate is changed (for example: destination, items).

Order ReferenceNumber Object

Attribute Type Description
id String
name String If our codes do not support your needs, use other_id and then you can name your own reference number.
value String An invoice number, purchase number, and so on.
code String Options:
  • invoice_id
  • customer_id
  • reference_id
  • purchase_id
  • bol_id
  • other_id

Order OrderLineItem Object

Parameters are optional unless noted.

Parameter Type Description, Defaults
id String required for update as uniq key identifier if source_system_id blank.
source_system_id String ID of entity in external system, required for update as a unique key identifier if id blank.
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 weight unit is lbs
item_type String Options:
  • parcel
  • handling_unit
  • unpacked
type_of_item String Options:
  • loose
  • box
  • pallet
do_not_pack_with_other_items Boolean
do_not_palletize Boolean
do_not_pack_before_palletize Boolean
handling_unit_type String Only used if item_type=handling_unit.
Options: pallet carton box crate bag drum
hs_code String Harmonized Code
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 Default: false.
Specifies whether each item should be shipped in a separate Shipments.
orm_d Boolean Default: false.
commodity_description String
meta Hash
origin_address Address Order Address Request object
reference_numbers Array[ReferenceNumber] List of Order Line Reference Number Request objects.
hazmat_data HazmatData

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 do not support your needs, use other_id and then you can name your own reference number.
value String An invoice number, purchase number, and so on.
code String Options:
  • invoice_id
  • customer_id
  • reference_id
  • purchase_id
  • bol_id
  • other_id
external_code String

Inventory Identifier Request Object

Attribute Type Description
type String Options:
  • SerialNumber
  • LotNumber
code String SerialNumber/LotNumber value, for example: SR0015
source_system_id String ID of inventory identifier in the source system (NetSuite/Shopify/etc)
// Inventory Identfiers array example
[
    { "code": "ML31", "source_system_id": "544", "type": "SerialNumber" },
    { "code": "ML32", "source_system_id": "545", "type": "SerialNumber" }
]
{
    // Context example
    // # ...,
    "order_line_items": [
        {
            "name": "1.5 inch display and 4x zoom",
            "sku": "CAM00002",
            "source_system_id": "1",
            "line_number": "1",
            "quantity": 2,
            "weight": "0.5",
            "warehouse_code": "CA",
            "meta": {},
            "inventory_identifiers": [
                { "code": "ML31", "source_system_id": "544", "type": "SerialNumber" },
                { "code": "ML32", "source_system_id": "545", "type": "SerialNumber" }
            ]

        }
    ]
    // ...,
}
{
    // Context example LOT NUMBERS
    // # ...,
    "order_line_items": [
        {
            "name": "1.5 inch display and 4x zoom",
            "sku": "LOT00001",
            "source_system_id": "1",
            "line_number": "1",
            "quantity": 3,
            "weight": "0.5",
            "warehouse_code": "CA",
            "meta": {},
            "inventory_identifiers": [
                { "code": "LOT1", "source_system_id": "544", "type": "LotNumber" },
                { "code": "LOT1", "source_system_id": "544", "type": "LotNumber" },
                { "code": "LOT1", "source_system_id": "544", "type": "LotNumber" }
            ]

        }
    ]
    // ...,
}

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 (such as "NetSuite", "Shopify", "Magento", and so on).
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 Objects.
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 One of: invoice_id customer_id reference_id purchase_id bol_id or other_id
value String An invoice number, purchase number, and so on.
name String

Split Order async Response Object

{
    "id": "skjob_mh7vQtVQ",
    "error_message": null,
    "meta": {
        "original_order_id": "ord_2E1pWGRh",
        "new_order_number": "ord_kogf4GhR",
        "move_to_order_id": null
    },
    "meta_search": {},
    "status": "unprocessed",
    "type": null,
    "created_at": "2020-10-05T08:21:06.378+00:00",
    "started_at": null,
    "finished_at": null
}

Job Tracker Object

"skjob_mh7vQtVQ" is a Job Tracker Object id

Once splitting is finished, Job Tracker status will be finished

Please use Job Tracker Endpoint to get updates about the Split process.

Split Order async Order Line Item Object

{
    "id": "ordi_mh7vQtVQ",
    "quantity": 1,
}

Parameter Type Description, Defaults
id String required
quantity Integer required

Combine Order async Response Object

{
    "id": "skjob_mh7vQtVQ",
    "error_message": null,
    "meta": {
        "master_order_id": "ord_EwpPBxf8",
        "all_order_ids": ["ord_8CS2CvEy", "ord_XZWspyTk"],
    },
    "meta_search": {},
    "status": "unprocessed",
    "type": null,
    "created_at": "2020-10-05T08:21:06.378+00:00",
    "started_at": null,
    "finished_at": null
}


Job Tracker Object

"skjob_mh7vQtVQ" is a Job Tracker Object id.

Once splitting is finished, Job Tracker status will be finished.

Please use Job Tracker Endpoint to get updates about the Combine process.

Line Item Sku response object

{
    "id": "lis_9VCx4GeY",
    "quantity": 1,
    "sku": "CAM00007",
}

Parameter Type Description, Defaults
id String
quantity Integer
sku String

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":  "Reference ID",
            "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":  "Reference ID",
            "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": "Reference ID",
            "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", "Reference ID")
                        .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);
        }
    }
}

Request: POST /api/v4/orders

Parameter Type Description, Defaults
order_number String required
source_system String Source system (such as "NetSuite", "Shopify", "Magento", and so on).
source_system_id String *
source_system_processed_at DateTime *
origin_address Address Order Address Request object
destination_address Address Order Address Request object
billing_address Address Order Address Request object
order_line_items Array[Order Line item] List of Order Line item request objects.
reference_numbers Array[ReferenceNumber] List of Reference Number Request objects.
total_price Float Price presented to customer of an Order.
shipping_price Float
tax_price Float
items_price Float
status String Options:
  • new (default)
  • partially_shipped
  • shipped
  • delivered
  • cancelled
  • on_hold
  • picking
requested_shipping_details String Can be used in rules for building criteria. Usually looks like "Carrier - Service" pair.
requested_rate_id String or Array[String] The RateId that is returned from /rates endpoint. If provided on Order creation, Order will use data from Rate (like Carrier/Service).
inventory_identifiers Array[InventoryIdentifier] List of Inventory Identifiers (Serial/Lot) Number Request objects. This option is also available during an order update.

Response: order-response-object

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":  "Reference ID",
            "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": "Reference ID",
            "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": "Reference ID",
            "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", "Reference ID")
                        .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);
        }
    }
}

Request: POST /api/v4/orders/:id

Parameter Type Description, Defaults
order_number String required
source_system String Source system (such as "NetSuite", "Shopify", "Magento", and so on).
source_system_id String *
source_system_processed_at DateTime *
origin_address Address Order Address Request object
destination_address Address Order Address Request object
billing_address Address Order Address Request object
order_line_items Array[Order Line item] List of Order Line item request objects.
reference_numbers Array[ReferenceNumber] List of Reference Number Request objects.
total_price Float Price presented to customer of an Order.
shipping_price Float
tax_price Float
items_price Float
status String Options:
  • new (default)
  • partially_shipped
  • shipped
  • delivered
  • cancelled
  • on_hold
  • picking
requested_shipping_details String Can be used in rules for building criteria. Usually looks like "Carrier - Service" pair.
requested_rate_id String or Array[String] The RateId that is returned from /rates endpoint. If provided on Order creation, Order will use data from Rate (like Carrier/Service).

Response: order-response-object

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.");
        }
    }
}

Request: GET /api/v4/orders/:id

Parameter Type Description, Defaults
id String Order id, required

Response: order-response-object

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.");
        }
    }
}

Request: GET /api/v4/orders/:id/pick_ticket

Parameter Type Description, Defaults
id String Order id, required

Example Response: { "id": "doc_jzMM11eB", "url": "http://localhost:3000/uploads/pick_ticket_92067a160eac5537fec413d487baaa5a.pdf" }

Retrieve Pick Ticket async for an Order

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

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

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/orders/ord_eHaXPJEmeyeJ/pick_ticket_async'
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/ord_eHaXPJEmeyeJ/pick_ticket_async?api_key=YOUR_API_KEY");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("POST");
        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("POST request failed.");
        }
    }
}

Request: POST /api/v4/orders/:id/pick_ticket_async

Parameter Type Description, Defaults
id String Order id, required

Example Response: { "created_at": "2021-07-26T13:45:11.488+00:00", "error_message": null, "finished_at": null, "id": "skjob_RSC0YmDbM5CD", "meta": { "order_public_id": "ord_eHaXPJEmeyeJ" }, "meta_search": {}, "started_at": null, "status": "unprocessed", "type": "PickTicketJob" }

"id" from response can be used to check when job is finished

Then pick ticket document will be returned with order

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.");
        }
    }
}

Request: GET /api/v4/orders

Response: Array[order-response-object]

List all Order's Shipments

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

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

puts response
# `ord_2E1pWGRh` is an example order id
import requests

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

r = requests.get(url, headers=headers)
// `ord_2E1pWGRh` is an example order id
// 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/ord_2E1pWGRh/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.");
        }
    }
}

Request: GET /api/v4/orders/:id/shipments

Parameter Type Description, Defaults
id String Order id, required

Response: [Shipment Object]

List all Order's Proposed Shipments

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

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

puts response
# `ord_2E1pWGRh` is an example order id
import requests

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

r = requests.get(url, headers=headers)
// `ord_2E1pWGRh` is an example order id
// 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/ord_2E1pWGRh/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.");
        }
    }
}

Request: GET /api/v4/orders/:id/proposed_shipments

Parameter Type Description, Defaults
id String Order id, required

Response: [Proposed Shipment Object]

List all Order's Order Line Items

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

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

puts response
# `ord_2E1pWGRh` is an example order id
import requests

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

r = requests.get(url, headers=headers)
// `ord_2E1pWGRh` is an example order id
// 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/ord_2E1pWGRh/order_line_items?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.");
        }
    }
}

Request: GET /api/v4/orders/:id/order_line_items

Parameter Type Description, Defaults
id String Order id, required
type String If empty - returns all Order Line Items
String shipped - returns all shipped Order Line Items
String not_shipped - returns all not shipped Order Line Items
page Integer Current page
per_page Integer Items per page
query String Search word, search is performed only by SKU field

Response: [Order Line Item Object]

List all Order's Shipped Line Item Skus

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

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

puts response
# `ord_2E1pWGRh` is an example order id
import requests

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

r = requests.get(url, headers=headers)
// `ord_2E1pWGRh` is an example order id
// 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/ord_2E1pWGRh/shipped_line_item_skus?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.");
        }
    }
}

Request: GET /api/v4/orders/:id/shipped_line_item_skus

Parameter Type Description, Defaults
id String Order id, required
page Integer Current page
per_page Integer Items per page

Response: [Line Item Sku response object]

List all Order's Not Shipped Line Item Skus

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

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

puts response
# `ord_2E1pWGRh` is an example order id
import requests

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

r = requests.get(url, headers=headers)
// `ord_2E1pWGRh` is an example order id
// 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/ord_2E1pWGRh/not_shipped_line_item_skus?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.");
        }
    }
}

Request: GET /api/v4/orders/:id/not_shipped_line_item_skus

Parameter Type Description, Defaults
id String Order id, required
page Integer Current page
per_page Integer Items per page

Response: [Line Item Sku response object]

Cancel an Order - Endpoint is deprecated, please use Cancel (Deprecated on May 1st 2024)

### `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);
        }
    }
}

Request: POST /api/v4/orders/:order_number/cancelled

Parameter Type Description, Defaults
order_number String Order id, required

Response: order-response-object

Cancel an Order

### `ORD10100111` is an example order number.
curl -X POST 'https://sandbox.shiphawk.com/api/v4/orders/ORD10100111/cancel?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/cancel?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/cancel'
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/cancel?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);
        }
    }
}

Request: POST /api/v4/orders/:order_number_or_id/cancel

Parameter Type Description, Defaults
order_number_or_id String Order Id / Order Number, required
remove_unshiped Boolean Default: false. Specify whether we remove Proposed Shipment in unprocessed state

Response: order-response-object

Combine One or More Orders - Endpoint is deprecated, please use Combine Order Async (Deprecated on January 1st 2024)

Combine One or More Orders Async

# 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);
        }
    }
}

Request: POST /api/v4/orders/combine

Parameter Type Description, Defaults
master_order_id String Order id, order will keep combined items, required
ids Array[String] Order ids to combine, required if param all_items blank
all_items Boolean All order ids to combine, required if param ids blank

Response: Combine Order async Response Object

Combine One or More Orders Async

# Example includes list of order ids.
curl POST 'https://sandbox.shiphawk.com/api/v4/orders/combine_async?api_key=YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "master_order_id": "ord_EwpPBxf8",
    "ids": ["ord_8CS2CvEy", "ord_XZWspyTk"]
}'

# Example combine all orders.
curl POST 'https://sandbox.shiphawk.com/api/v4/orders/combine_async?api_key=YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "master_order_id": "ord_EwpPBxf8",
    "all_items": true
}'

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

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

# Example includes list of order ids.
combine_async_body = {
    "master_order_id": "ord_EwpPBxf8",
    "ids": ["ord_7eNTAmVT", "ord_4WBTxPxS"],
}.to_json

# Example combine all orders.
combine_async_body = {
    "master_order_id": "ord_EwpPBxf8",
    "all_items": true,
}.to_json

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

# 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/orders/combine_async'
headers = {'X-Api-Key': 'YOUR_API_KEY'}

# Example includes list of order ids.
payload = {
    "master_order_id": "ord_EwpPBxf8",
    "ids": ["ord_DqKvSb9M", "ord_2E1pWGRh"],
}

# Example combine all orders.
payload = {
    "master_order_id": "ord_EwpPBxf8",
    "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", "ord_EwpPBxf8")
                .add("ids", Json.createArrayBuilder()
                        .add("ord_DqKvSb9M")
                        .add("ord_2E1pWGRh")
                    )
                .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_async?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);
        }
    }
}

Request: /api/v4/orders/combine_async

Parameter Type Description, Defaults
master_order_id String Order id, order will keep combined items, required
ids Array[String] Order ids to combine, required if param all_items blank
all_items Boolean All order ids to combine, required if param ids blank

Response: Combine Order async Response Object

Split Order Async

Request:
#`ord_2E1pWGRh` is an example order id
# Split order to New order
curl POST 'https://sandbox.shiphawk.com/api/v4/orders/ord_2E1pWGRh/split_async?api_key=YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "new_order_number": "ORD10100112",
    "order_line_items": [
        {
            "id": "ordi_NmDJkZWj",
            "quantity": 1
        }
    ]
}'

# Split order to Existing order
curl POST 'https://sandbox.shiphawk.com/api/v4/orders/ord_2E1pWGRh/split_async?api_key=YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "move_to_order_id": "ord_F2gvqhR2",
    "order_line_items": [
        {
            "id": "ordi_NmDJkZWj",
            "quantity": 1
        }
    ]
}'
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_async?api_key=YOUR_API_KEY')

# Split order to New order
split_body = {
    "order_number": "ORD10100112",
    "order_line_items": [
        {
            "id": "ordi_NmDJkZWj",
            "quantity": 1
        }
    ]
}.to_json

# Split order to Existing order
split_body = {
    "move_to_order_id": "ord_F2gvqhR2",
    "order_line_items": [
        {
            "id": "ordi_NmDJkZWj",
            "quantity": 1
        }
    ]
}.to_json


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

# 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_async'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
# Split order to New order
payload = {
    "order_number": "ORD10100112",
    "order_line_items": [
        {
            "id": "ordi_NmDJkZWj",
            "quantity": 1
        }
    ]
}

# Split order to Existing order
payload = {
    "move_to_order_id": "ord_F2gvqhR2",
    "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("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_async?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);
        }
    }
}

Request: POST /api/v4/orders/:id/split_async

Parameter Type Description, Defaults
id String required
new_order_number String New order will be created with entered number, required if move_to_order_id param blank.
move_to_order_id String Order id, Order line items will moved to existing order, required if new_order_number blank.
order_line_items Array[Order Line Item] required

Response: Split Order async Response Object

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);
        }
    }
}

Request: POST /api/v4/orders/hold

Parameter Type Description, Defaults
id String required
hold_until DateTime required

Example Response: { "public_id": "buop_dHpM9bKz", "finished": false, "records_total_count": 1, "records_processed_count": 0, "records_failed_count": 0 }

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);
        }
    }
}

Request: POST /api/v4/orders/restore

Parameter Type Description, Defaults
id String required

Example Response: { "public_id": "buop_sNVkw4rt", "finished": false, "records_total_count": 1, "records_processed_count": 0, "records_failed_count": 0 }

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.");
        }
    }
}

Request: GET /api/v4/orders/simple?source_system=NetSuite

Parameter Type Description, Defaults
source_system String required

Response: Array[orders]

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);
        }
    }
}

Request: DELETE /api/v4/orders/:id

Parameter Type Description, Defaults
id String Order id, required

Response: no content

Create Order Line Items for an Order

#'ord_DqKvSb9M' is an example order id.

curl POST 'https://sandbox.shiphawk.com/api/v4/orders/ord_DqKvSb9M/order_line_items?api_key=YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "order_line_items": [
        {
            "source_system_id": "SH123",
            "name": "",
            "sku": "1234",
            "quantity": 5,
            "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"
                }
            ]
        }
    ]
}'
require 'net/http'
require 'uri'
require 'json'

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

order_line_items_body = {
  "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"
      }
    ]
  }]
}.to_json

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

# 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/order_line_items'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
  "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"
      }
    ],
  }],
}

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_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")
                                )
                            )
                        )
                    )
                .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/order_line_items?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);
        }
    }
}

Request: POST /api/v4/orders/:id/order_line_items

Parameter Type Description, Defaults
id String Order id, required
order_line_items Array[Order Line Item] Array of Order Line Items, required

Response: Array[Order Line Item]

Update Order Line Items for an Order

#'ord_DqKvSb9M' is an example order id.
#source_system_id or id can be used as unique key to update Order Line Item.
curl POST 'https://sandbox.shiphawk.com/api/v4/orders/ord_DqKvSb9M/order_line_items?api_key=YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "order_line_items": [
        {
            "source_system_id": "SH123",
            "name": "",
            "sku": "1234",
            "quantity": 5,
            "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"
                }
            ]
        }
    ]
}'
require 'net/http'
require 'uri'
require 'json'

#'ord_DqKvSb9M' is an example order id.
#source_system_id or id can be used as unique key to update Order Line Item.
uri = URI.parse('https://sandbox.shiphawk.com/api/v4/orders/ord_DqKvSb9M/order_line_items?api_key=YOUR_API_KEY')

order_line_items_body = {
  "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"
      }
    ]
  }]
}.to_json

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

# 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.
#source_system_id or id can be used as unique key to update Order Line Item.
url = 'https://sandbox.shiphawk.com/api/v4/orders/ord_mSCP9was/order_line_items'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
  "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"
      }
    ],
  }],
}

r = requests.post(url, headers=headers, json=payload)
// Running with javax.json-1.0.jar
// source_system_id or id can be used as unique key to update Order Line Item.
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_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")
                                )
                            )
                        )
                    )
                .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/order_line_items?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);
        }
    }
}

Request: POST /api/v4/orders/:id/order_line_items

Parameter Type Description, Defaults
id String Order id, required
order_line_items Array[Order Line Item] Array of Order Line Items, required

Response: Array[Order Line Item]

Delete Order Line Items

#'ord_DqKvSb9M' is an example order id.
curl --request DELETE 'https://sandbox.shiphawk.com/api/v4/orders/ord_DqKvSb9M/order_line_items?api_key=YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "order_line_item_ids": ["ordi_aKTSsMHG", "ordi_c3r1tMe0", "ordi_rf45FpNZ"]
}'
require 'net/http'
require 'uri'
require 'json'

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

order_line_items_body = {
  "order_line_item_ids": ["ordi_aKTSsMHG", "ordi_c3r1tMe0", "ordi_rf45FpNZ"]
}.to_json

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

# 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/order_line_items'
headers = {'X-Api-Key': 'YOUR_API_KEY'}
payload = {
  "order_line_items_ids": ["ordi_aKTSsMHG", "ordi_c3r1tMe0", "ordi_rf45FpNZ"],
}

r = requests.delete(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 DeleteRequestBody {
    public static void main(String [] args)
    {
        try{
            sendDelete();
        }
        catch(IOException ex){
            ex.printStackTrace(System.out);
        }
    }

    private static void sendDelete() throws IOException {
    JsonObject body = Json.createObjectBuilder()
            .add("order_line_items_ids", Json.createArrayBuilder()
                .add("ordi_aKTSsMHG")
                .add("ordi_c3r1tMe0")
                .add("ordi_rf45FpNZ"))
            .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/orders/ord_mSCP9was/order_line_items?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);
    }
    }
}

Request: DELETE /api/v4/orders/:id/order_line_items

Parameter Type Description, Defaults
id String Order id, required
order_line_item_ids Array[order_line_item_id] Array of Order Line Items Ids, required, maximum 500 ids

Response: no content

Shipments

Shipment Resources

Shipment Request Object

Parameters are optional unless noted.

Parameter Type Description, Defaults
id String
shid String
proposed_shipment_id String
rate_id String required
origin_address BookingAddress required
Shipment Address Request object
destination_address BookingAddress required
Shipment Address Request object
pickup Array[Pickup]
accessorials Array[ShipmentAccessorial]
reference_numbers Array[ReferenceNumber]
origin_instructions String
destination_instructions String
order_id String
order_number String
carrier String
service_name String
carrier_service_code String
label_format Enum Default: PDF.
Options:
  • ZPL
  • PDF
include_return_label Boolean Default: false
is_external Boolean
shipping_price Float Default: 0.0
tracking_number String
packages Array[PackageNoRate] 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 Pickup Object

Parameter Type Description, Defaults
start_time DateTime
end_time DateTime

Shipment Accessorial Object

Parameter Type Description, Defaults
type String
value String
option_value String

Shipment Reference Number Object

Parameter Type Description, Defaults
id String
name String If our codes do not 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 Options:
  • invoice_id
  • customer_id
  • reference_id
  • purchase_id
  • bol_id
  • other_id

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 Deprecated
orm_d Boolean Deprecated
nmfc String
number_of_units Integer Default: 1
hazmat_data Hash Shipment Hazmat Data Request object
package_items Array[PackageItem] List Of:
{
product_sku: String
id: String
value: String
hs_code: String
country_of_origin: String
description: String
weight: Float
quantity: Integer
}
handling_unit_packages Array[HandlingUnitPackage] Shipment Handling Unit Packages Request object
sscc_serial_references Array List of assigned Serial Shipping Container Codes (SSCC).

Shipment Handling Unit Packages Request Object

Parameter Type Description
package_type String
package_quantity Integer
weight Float
dry_ice_weight Float
nmfc String
freight_class String
hazmat Boolean Deprecated
orm_d Boolean Deprecated
number_of_units Integer
commodity_description String
hazmat_data HazmatData Shipment Hazmat Data Request object
package_items Array[PackageItem] Proposed Shipment Package Item Request object
sscc_serial_references Array List of assigned Serial Shipping Container Codes (SSCC).

Shipment Hazmat Data Object

Parameter 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 Enum Options:
  • ground
  • passenger_aircraft
  • cargo_aircraft_only
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
weight Float
value String
description String
order_line_item_id String
quantity Integer Default: 1

Shipment Response Object

{
    "id": "shp_8Wskd61X",
    "shid": 6395133,
    "proposed_shipment_id": "pshp_dZ7xjhhQ",
    "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",
    "license_plate_number": null,
    "all_license_plate_numbers": []
    "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,
    "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,
                    "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,
            "sscc_serial_references": []
        }
    ],
    "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
        }
    ],
    "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,
    "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
    },
    "warehouse": {
        "id": "whs_vVPCqvsyemQQ",
        "code": "WH-1"
        "default_for_international": false
        "enabled_for_external_domestic_rating": true
        "enabled_for_external_international_rating": true
        "domestic_priority": "9"
        "international_priority": "10"
        "created_at": "2023-05-29T09:20:14+00:00"
    }
}
Attribute Type Description
id string
shid integer
proposed_shipment_id string
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
license_plate_number string
all_license_plate_numbers array[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
}
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
}
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
}
warehouse Hash Object:
{
id: String
code: String
default_for_international: Boolean
enabled_for_external_domestic_rating: Boolean
enabled_for_external_international_rating: Boolean
domestic_priority: Integer
international_priority: Integer
created_at: DateTime
}

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);
        }
    }
}

Request: DELETE /api/v4/shipments/:id

Parameter Type Description, Defaults
id String Shipment id, required

Response: no content

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);
        }
    }
}

Request: POST /api/v4/shipments/?api_key=YOUR_API_KEY

Parameter Type Description, Defaults
rate_id String or Array[String] The RateId that is returned from /rates endpoint. If provided on Order creation, Order will use data from Rate (like Carrier/Service).
origin_address Address Order Address Request object
destination_address Address Order Address Request object

Response: shipment-response-object

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.");
        }
    }
}

Request: GET /api/v4/shipments

Response: Array[shipment-response-object]

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.");
        }
    }
}

Request: GET /api/v4/shipments/:id

Parameter Type Description, Defaults
id String shipment id

Response: shipment-response-object

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.");
        }
    }
}

Request: GET /api/v4/shipments/:id/bol

Parameter Type Description, Defaults
id String shipment id

Example Response: { "url": "https://sandbox.shiphawk.com/uploads/labels_7b2bc795e6e9b6a88eac2e7d067640c0.pdf", "id": "doc_0zRNYArq", "extension": "pdf" }

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);
        }
    }
}

Request: GET /api/v4/shipments/:id/commercial_invoice

Parameter Type Description, Defaults
id String shipment id

Example Response: { "url": "https://sandbox.shiphawk.com/uploads/ci_2E37C2FB50.pdf", "id": "doc_HejPj0CT", "extension": "pdf" }

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);
        }
    }
}

Request: GET /api/v4/shipments/:id/address_labels

Parameter Type Description, Defaults
id String shipment id

Example Response: { "url": "https://sandbox.shiphawk.com/uploads/address_labels_7b2bc795e6e9b6a88eac2e7d067640c0.pdf", "id": "doc_0zRNYArq", "extension": "pdf" }

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);
        }
    }
}

Request: GET /api/v4/shipments/:id/labels

Parameter Type Description, Defaults
id String shipment id

Example Response: { "url": "https://sandbox.shiphawk.com/uploads/package_labels_combined_20201001-51659-18y8z4j.pdf", "id": "doc_4TSr8V99", "extension": "pdf" }

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);
        }
    }
}

Request: GET /api/v4/shipments/:id/packing_slip

Parameter Type Description, Defaults
id String shipment id

Example Response: { "url": "https://sandbox.shiphawk.com/uploads/packing_slip_7b2bc795e6e9b6a88eac2e7d067640c0.pdf", "id": "doc_0zRNYArq", "extension": "pdf" }

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);
        }
    }
}

Request: GET /api/v4/shipments/search_count

Example Response: { "ordered": 0, "confirmed": 0, "scheduled_for_pickup": 0, "nl_prep": 0, "ready_for_carrier_pickup": 0, "in_transit": 0, "delivered": 0, "exception": 0, "cancelled": 2 }

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);
        }
    }
}

Request: GET /api/v4/shipments/:id

Parameter Type Description, Defaults
id String shipment id

Response: shipment-response-object

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);
        }
    }
}

Request: GET /api/v4/shipments/:id/tracking

Parameter Type Description, Defaults
id String shipment id

Example Response: { "id": "shp_bMv9F00T", "status": "cancelled", "status_updates": [], "tracking_number": "0041218925", "tracking_url": "", "actual_delivery_date": null, "actual_pickup_time": null, "requested_at": null, "requested_end_at": null }

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);
        }
    }
}

Request: POST /api/v4/shipments/:id/tracking

Parameter Type Description, Defaults
callback_url String

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);
        }
    }
}

Request: POST /api/v4/shipments/:id

Parameter Type Description, Defaults
status String
tracking_number String
origin_instructions String
destination_instructions String
itn_confirmation_number Integer
origin_address Address Order Address Request object
destination_address Address Order Address Request object

Response: shipment-response-object

Shipment Notes

Shipment Note Object

Parameter Type Description, Defaults
id String readonly
body String
tag String
created_at DateTime readonly
updated_at DateTime readonly

Shipment Notes Api Endpoints

Create Shipment Note

#shp_yYtFWAhc is an example shipment external id
curl -H "Content-Type: application/json" -X POST -d '
{
  “id”: “shp_yYtFWAhc”
}’ ‘https://sandbox.shiphawk.com/api/v4/shipments/shp_yYtFWAhc/notes?api_key=YOUR_API_KEY'

Request: POST /api/v4/shipments/:id/notes

Parameter Type Description, Defaults
id String Shipment id

Response: ShipmentNoteObject

Retrieve Shipment Note

#'shp_becFaAAj' is an example shipment external id, note_74YxKaMq is an example note id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/shipments/shp_becFaAAj/notes/note_74YxKaMq/?api_key=YOUR_API_KEY'

Request: GET /api/v4/shipments/:id/notes/:note_id

Parameter Type Description, Defaults
id String Shipment external id,
note_id String Note id

Response: ShipmentNoteObject

Retrieve All Shipment Notes

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

Request: GET /api/v4/shipments/:id/notes

Parameter Type Description, Defaults
id String Shipment id, required

Response: ArrayShipmentNoteObject

Update Shipment Note

#shp_yYtFWAhc is an example shipment external id, note_74YxKaMq is an example note id
curl -H "Content-Type: application/json" -X POST -d '
{
  “body”: “This is the body”,
  "tag": "This is a tag"
}’ ‘https://sandbox.shiphawk.com/api/v4/shipments/shp_yYtFWAhc/notes/note_74YxKaMq/?api_key=YOUR_API_KEY'

Request: POST /api/v4/shipments/:id/notes/:note_id

Parameter Type Description, Defaults
body String
tag String

Response: ShipmentNoteObject

Delete Shipment Note

#shp_yYtFWAhc is an example shipment external id, note_74YxKaMq is an example note id
curl -X DELETE 'https://sandbox.shiphawk.com/api/v4/shipments/shp_yYtFWAhc/notes/note_74YxKaMq/?api_key=YOUR_API_KEY'

Request: DELETE /api/v4/shipments/:id/notes/:note_id

Parameter Type Description, Defaults
id String Shipment external id,
note_id String Note id

Response: no content

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
reset_carrier Boolean Default: false. Nullifies carrier/service attributes during ProposedShipment update
insurance_option String One of: add_insurance no_insurance
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,
    "price_details": {
        "shipping": 0,
        "packing": 0,
        "insurance": 0,
        "accessorials": 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": "",
            "carrier_container": null,
            "unpacked_item_type_id": null,
            "unpacked_item_type_name": null,
            "number_of_units": 1,
            "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,
                    "freight_class": null,
                    "nmfc": null,
                    "hs_code": null,
                    "country_of_origin": 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,
                    "freight_class": null,
                    "nmfc": null,
                    "hs_code": null,
                    "country_of_origin": 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,
            "customs_data_list": [
                {
                    "sku": null,
                    "product_name": null,
                    "quantity": null,
                    "description": null,
                    "country_of_origin": null,
                    "hs_code": null,
                    "unit_weight": null,
                    "total_weight": null,
                    "unit_value": null,
                    "total_value": null
                },
                {
                    "sku": null,
                    "product_name": null,
                    "quantity": null,
                    "description": null,
                    "country_of_origin": null,
                    "hs_code": null,
                    "unit_weight": null,
                    "total_weight": null,
                    "unit_value": null,
                    "total_value": 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
price_details object Object:
{
shipping: Float
packing: Float
insurance: Float
accessorials: 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": "",
    "carrier_container": null,
    "unpacked_item_type_id": null,
    "unpacked_item_type_name": null,
    "number_of_units": 1,
    "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,
            "freight_class": null,
            "nmfc": null,
            "hs_code": null,
            "country_of_origin": 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,
            "freight_class": null,
            "nmfc": null,
            "hs_code": null,
            "country_of_origin": 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,
    "sscc_serial_references": [],
    "customs_data_list": [
        {
            "sku": null,
            "product_name": null,
            "quantity": null,
            "description": null,
            "country_of_origin": null,
            "hs_code": null,
            "unit_weight": null,
            "total_weight": null,
            "unit_value": null,
            "total_value": null
        },
        {
            "sku": null,
            "product_name": null,
            "quantity": null,
            "description": null,
            "country_of_origin": null,
            "hs_code": null,
            "unit_weight": null,
            "total_weight": null,
            "unit_value": null,
            "total_value": 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
carrier_container string
unpacked_item_type_id string
unpacked_item_type_name string
number_of_units integer
hazmat boolean Deprecated
orm_d boolean Deprecated
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
freight_class: string
nmfc: string
hs_code: string
country_of_origin: 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: Deprecated
freight_class: string
tracking_number: string
nmfc: string
number_of_units: integer
commodity_description: string
orm_d: Deprecated
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
sscc_serial_references Array list of assigned Serial Shipping Container Codes (SSCC)
customs_data_list Array[Object] [{
sku: String
product_name: String
quantity: Integer
description: String
country_of_origin: String
hs_code: String
unit_weight: Float
total_weight: Float
unit_value: Float
total_value: Float
}]

Proposed Shipment API Endpoints

Retrieve Proposed Shipments from a Order

# 'ord_Sq9Q39fx' is an example order id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/orders/ord_Sq9Q39fx/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);
        }
    }
}

Request: GET /api/v4/orders/:id/proposed_shipments

Parameter Type Description, Defaults
id String Order id

Response: proposed-shipment-response

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,
        "item_type":"parcel",
        "customs_data_list": [
          {
              "sku": "test_sku",
              "product_name": "test_product_name",
              "quantity": 1,
              "description": "test_product_description",
              "country_of_origin": "US",
              "hs_code": 123321,
              "unit_weight": null,
              "total_weight": 100,
              "unit_value": null,
              "total_value": 100
          },
          {
              "sku": "test_sku_2",
              "product_name": "test_product_name_2",
              "quantity": 3,
              "description": "test_product_description_2",
              "country_of_origin": "US",
              "hs_code": 123321,
              "unit_weight": null,
              "total_weight": 100,
              "unit_value": null,
              "total_value": 100
          }
        ]
      }
    ],
    "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,
        "item_type":"parcel",
        "customs_data_list": [
          {
              "sku": "test_sku",
              "product_name": "test_product_name",
              "quantity": 1,
              "description": "test_product_description",
              "country_of_origin": "US",
              "hs_code": 123321,
              "unit_weight": null,
              "total_weight": 100,
              "unit_value": null,
              "total_value": 100
          },
          {
              "sku": "test_sku_2",
              "product_name": "test_product_name_2",
              "quantity": 3,
              "description": "test_product_description_2",
              "country_of_origin": "US",
              "hs_code": 123321,
              "unit_weight": null,
              "total_weight": 100,
              "unit_value": null,
              "total_value": 100
          }
        ]
      }
    ],
    "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,
        "item_type":"parcel",
        "customs_data_list": [
          {
              "sku": "test_sku",
              "product_name": "test_product_name",
              "quantity": 1,
              "description": "test_product_description",
              "country_of_origin": "US",
              "hs_code": 123321,
              "unit_weight": null,
              "total_weight": 100,
              "unit_value": null,
              "total_value": 100
          },
          {
              "sku": "test_sku_2",
              "product_name": "test_product_name_2",
              "quantity": 3,
              "description": "test_product_description_2",
              "country_of_origin": "US",
              "hs_code": 123321,
              "unit_weight": null,
              "total_weight": 100,
              "unit_value": null,
              "total_value": 100
          }
        ]
      }
    ],
    "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("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);
        }
    }
}

Request: POST /api/v4/orders/:id/proposed_shipments/book

Parameter Type Description, Defaults
rate_id 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)
}
tracking_number String
service_name String
service_code String
proposed_shipment_id String
carrier_code String
insurance_option String One of: add_insurance no_insurance
order_source String
is_external Boolean
shipping_price Float Default: 0.0
ship_date Date
packages Array List of Proposed Shipment Package Request objects
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
}
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
}
accessorials Array[Object] List of:
{
type: String required
value: String
option_value: String
}
label_format String
include_label_source Boolean Default: false
include_return_label Boolean Default: false

Response: proposed-shipment-response

Book async 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,
        "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_async?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_async?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,
        "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_async'
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,
        "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("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_async?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);
        }
    }
}

Request: POST /api/v4/orders/:id/proposed_shipments/book_async

Params

Response: [Job Tracker object]

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);
        }
    }
}

Request: POST /api/v4/orders/:id/proposed_shipments/generate

Parameter Type Description, Defaults
id String Order id

Response: proposed-shipment-response

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,
        "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,
        "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,
        "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("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);
        }
    }
}

Request: POST /api/v4/orders/:id/proposed_shipments

Parameter Type Description, Defaults
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)
}
tracking_number String
service_name String
service_code String
proposed_shipment_id String
carrier_code String
return_label_service_name String
insurance_option String One of: add_insurance no_insurance
order_source String
is_external Boolean
shipping_price Float Default: 0.0
ship_date Date
reference_numbers Array Array of reference number objects
packages Array List of Proposed Shipment Package Request objects
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
}
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
}
accessorials Array[Object] List of:
{
type: String required
value: String
option_value: String
}
label_format String
include_label_source Boolean Default: false

Response: proposed-shipment-response

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,
        "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,
        "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,
        "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("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);
        }
    }
}

Request: POST /api/v4/orders/:id/proposed_shipments/:proposed_shipment_id

Parameter Type Description, Defaults
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)
}
tracking_number String
service_name String
service_code String
proposed_shipment_id String
carrier_code String
return_label_service_name String
insurance_option String One of: add_insurance no_insurance
order_source String
is_external Boolean
shipping_price Float Default: 0.0
ship_date Date
reference_numbers Array Array of reference number objects
packages Array List of Proposed Shipment Package Request objects
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
}
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
}
accessorials Array[Object] List of:
{
type: String required
value: String
option_value: String
}
label_format String
include_label_source Boolean Default: false

Response: proposed-shipment-response

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);
        }
    }
}

Request: DELETE /api/v4/orders/:id/proposed_shipments/:proposed_shipment_id

Parameter Type Description, Defaults
id String order id
proposed_shipment_id String proposed shipment id

Response: no content

Rates

Rate Resources

Rate Request Object

Parameters are optional unless specified.

Attribute Type Description
origin_address Address required
destination_address Address required
source_system String
source_system_domain String
source_system_order_id String
display_rate_detail Boolean Default: false
free_shipping_for_cheapest_rate 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[ShipmentLineItem]
items Array[Item] 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 Address Object

Attribute Type Description
name String
company String
street1 String
street2 String
city String
state String
zip String
phone_number String
email String
code String
is_residential Boolean
country String 2 letter country code

Rate Shipment Line Item Object

Attribute Type Description
quantity Integer
source_system_id String
sku String

Rate Item Object

Parameters are optional unless specified.

Attribute Type Description
item_type Enum Default: parcel
Options:
  • parcel
  • handling_unit
  • unpacked
accessorials Array
name String
length Float
width Float
height Float
weight Float
dry_ice_weight Float
weight_uom Enum Options:
  • 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_dropship Boolean Default: false
action_if_not_available Enum Default: backorder. Options:
  • backorder
  • dropship
package_type String
package_quantity Integer
hs_code String
country_of_origin String
product_sku String
unpacked_item_type_id String
hazmat Boolean Deprecated
orm_d Boolean Deprecated
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 (Deprecated)
orm_d: Boolean (Deprecated)
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);
        }
    }
}

Request: POST /api/v4/rates?api_key=YOUR_API_KEY

Parameter Type Description, Defaults
items Array[items] required: List of Rate Item Request objects
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)
}

Response: rate-response-object

Job Trackers

Job Tracker Resources

Job Tracker Response Object

{
    "id": "skjob_mh7vQtVQ",
    "error_message": null,
    "meta": {},
    "meta_search": {},
    "status": "unprocessed",
    "type": null,
    "created_at": "2020-10-05T08:21:06.378+00:00",
    "started_at": null,
    "finished_at": null
}
Parameter Type Description, Defaults
id String unikey key identifier
error_message String Show error message if something went wrong
meta Hash A free form hash that can store additional information
meta_search Hash A free form hash that can store additional information
status String Available statuses: unprocessed, in_progress, finished, failed
type String How object was created, e.g. ApiRequestSearch
created_at DateTime When object was created
updated_at DateTime When object was updated
finished_at DateTime When object was finished

Job Tracker API Endpoints

Retrieve a Job Tracker Object

#'skjob_mh7vQtVQ' is an example job tracker id.
curl -X GET 'https://sandbox.shiphawk.com/api/v4/job_trackers/skjob_mh7vQtVQ?api_key=YOUR_API_KEY'
require 'net/http'

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

puts response
import requests

url = 'https://sandbox.shiphawk.com/api/v4/job_trackers/skjob_mh7vQtVQ'
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 {
        //'skjob_mh7vQtVQ' is an example order id.
        URL url = new URL("https://sandbox.shiphawk.com/api/v4/job_trackers/skjob_mh7vQtVQ?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.");
        }
    }
}

Request: GET https://sandbox.shiphawk.com/api/v4/job_trackers/:id

Parameter Type Description, Defaults
id String required

Response: Job Tracker

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 packages.

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);
        }
    }
}

Request: GET /api/v4/batches

Response: Array[batch-object]

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);
        }
    }
}

Request: POST /api/v4/batches

Response: batch-object

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);
        }
    }
}

Request: GET /api/v4/batches/:id

Parameter Type Description, Defaults
id String Batch id

Response: batch-object

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);
        }
    }
}

Request: POST /api/v4/batches/:id

Parameter Type Description, Defaults
id String Batch id

Response: batch-object

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);
        }
    }
}

Request: DELETE /api/v4/batches/:id

Parameter Type Description, Defaults
id String Batch id

Response: no content

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 Enum required Options:
  • pallet
  • carton
  • box
  • crate
  • bag
length Float inches, required. Limited to one decimal place.
width Float inches, required. Limited to one decimal place.
height Float inches, required. Limited to one decimal place.
weight Float 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
sscc_serial_references Array list of assigned Serial Shipping Container Codes (SSCC)

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 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);
        }
    }
}

Request: GET /api/v4/unpacked_item_types/find?ids[]=:id&ids[]=:id&...&api_key=YOUR_API_KEY

Parameter Type Description, Defaults
id String Unpacked item id

Response: unpacked-item-type-object

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);
        }
    }
}

Request: GET /api/v4/unpacked_item_types/search?name=P8A&api_key=YOUR_API_KEY

Parameter Type Description, Defaults
name String Unpacked item name

Response: unpacked-item-type-object

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);
        }
    }
}

Request: GET /api/v4/unpacked_item_types/check_existence?ids[]=:id&ids[]=:id&...&api_key=YOUR_API_KEY

Parameter Type Description, Defaults
id String Unpacked item id

Response: unpacked-item-type-object

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
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.
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
is_warehouse Boolean
address_type Enum Options:
  • billing
  • mailing
  • physical
  • origin
  • destination
  • catalog_sale
  • bol
validated Boolean

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

Check Address Response

Objects represent the extended structure of address to validate initial input params

Attribute Type Description
corrected Boolean Indicates if address was changed (should be true even if the only change was that system added a default location type)
deliverable Boolean Indicates if the address can be used for delivery
address SuggestedAddress Suggested Address Response object

Suggested Address Response

Suggested Address Response object, including country/location type/etc fields added by the system from defaults...

Attribute Type Description
country String
state String
city String
zipcode String
street1 String
street2 String
location_type 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);
        }
    }
}

Request: POST /api/v4/addresses

Parameter Type Description, Defaults
name String
street1 String
city String
state String
zip String

Response address-object

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);
    }
  }
}

Request: GET /api/v4/addresses/:id

Parameter Type Description, Defaults
id String address id

Response: address-object

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)

Request: POST /api/v4/addresses/codes?codes=12345

Parameter Type Description, Defaults
code Integer Address code

Response: address-object

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"