Carrier Accounts

You can create, modify, delete, and specify which shipping carriers you want to use via the Shippo API. This allows you to connect with your shipping account to compare and purchase different Rates for each Shipment.

You can also manually connect to carriers through the Carriers page of your Shippo Dashboard.

Default Carrier Accounts

You won't need to sign up for a new carrier account to start testing or shipping on Shippo. By default, you have access to Shippo's discounted master accounts for U.S. outbound shipments to retrieve shipping rates and purchase labels.

If you want to use your own carrier account, continue this tutorial.

Create a Carrier Account Object

Each carrier has different account properties. For instance, while FedEx requires an account number and a meter number, UPS asks you for a UPS account number, user ID and password. Each Carrier Account object will have a unique object_id that you will need to reference in your API calls.

The Carrier Account object can be created (POST), modified or de-activated (PUT), or retrieved (GET). You can also list (GET) all activate accounts.

Here's how you create a carrier account:

curl https://api.goshippo.com/carrier_accounts/ \
    -H "Authorization: ShippoToken <API_TOKEN>" \
    -d carrier="fedex" \
    -d account_id="<YOUR-FEDEX-ACCOUNT-NUMBER>" \
    -d parameters='{ "meter": "<YOUR-FEDEX-METER-NUMBER>"}'
fedex_account = Shippo::CarrierAccount.create(
	:carrier => 'fedex',
	:account_id => '<YOUR-FEDEX-ACCOUNT-NUMBER>',
	:parameters => {:meter => '<YOUR-FEDEX-METER-NUMBER>'},
	:test => true,
	:active => true)
fedex_account = shippo.CarrierAccount.create(
	carrier = 'fedex',
	account_id = '<YOUR-FEDEX-ACCOUNT-NUMBER>',
	parameters = {"meter" : '<YOUR-FEDEX-METER-NUMBER>'},
	test = True,
	active = True)
$fedex_account = Shippo_CarrierAccount::create(array(
    'carrier' => 'fedex',
    'account_id' => '<YOUR-FEDEX-ACCOUNT-NUMBER>',
    'parameters' => array('meter' => '<YOUR-FEDEX-METER-NUMBER>'),
    'test' => true,
    'active' => true
));
shippo.carrieraccount.create({
    "carrier":"fedex", 
    "account_id":"<YOUR-FEDEX-ACCOUNT-NUMBER>", 
    "parameters":{"meter":"<YOUR-FEDEX-METER-NUMBER>"},
    "test":true,
    "active":true
}, function(err, account) {
  // asynchronously called
});
HashMap accountMap = new HashMap();
accountMap.put("carrier", "fedex");
accountMap.put("account_id", "<YOUR-FEDEX-ACCOUNT-NUMBER>"); 
accountMap.put("parameters", new HashMap() {
	{
		put("meter", "<YOUR-FEDEX-METER-NUMBER>");
	}
});
accountMap.put("test", Boolean.TRUE);
accountMap.put("active", Boolean.TRUE);

CarrierAccount fedex_account = CarrierAccount.create(accountMap);
Hashtable accountTable = new Hashtable ();
accountTable.Add ("carrier", "fedex");
accountTable.Add ("account_id", "<YOUR-FEDEX-ACCOUNT-NUMBER>");
accountTable.Add ("parameters", new Hashtable(){
	{"meter":"<YOUR-FEDEX-METER-NUMBER>"}
	});
accountTable.Add ("test", true);
accountTable.Add ("active", true);

CarrierAccount fedexAccount = resource.CreateCarrierAccount(accountTable)

The API will respond with the JSON serialized carrier account object:

{
    "object_id":"b741b99f95e841639b54272834bc478c",
    "object_owner": "shippotle@goshippo.com",
    "carrier": "fedex",
    "account_id": "",
    "parameters": {
        "meter": ""
    },
    "test": true,
    "active": true
}

Using Carrier Accounts in Shipments

You can specify which carrier accounts you want to use on a per-shipment basis by passing in each account's object_id in the shipment's carrier_accounts field as a list. If you don't specify which accounts to use, Shippo will use all your active accounts for this shipment.

curl https://api.goshippo.com/shipments/ \
    -H "Authorization: ShippoToken <API_TOKEN>" \
    -d object_purpose="PURCHASE" \
    -d address_from="d799c2679e644279b59fe661ac8fa488" \
    -d address_to="42236bcf36214f62bcc6d7f12f02a849" \
    -d parcel="7df2ecf8b4224763ab7c71fae7ec8274" \
    -d carrier_accounts=["b741b99f95e841639b54272834bc478c", "b741b99f95e841639b54272834bc478c" ] \
    -d async=false
shipment = Shippo::Shipment.create(
	:object_purpose => 'PURCHASE',
	:address_from => address_from,
	:address_to => address_to,
	:parcel => parcel,
	:carrier_accounts => ["b741b99f95e841639b54272834bc478c"],
	:async => false)
shipment = shippo.Shipment.create(
		object_purpose= 'PURCHASE',
		address_from= address_from,
		address_to= address_to,
		parcel= parcel,
		carrier_accounts= ['b741b99f95e841639b54272834bc478c'],
		async= False)
$shipment = Shippo_Shipment::create(array(
    'object_purpose'=> 'PURCHASE',
    'address_from'=> $fromAddress,
    'address_to'=> $toAddress,
    'parcel'=> $parcel,
    'carrier_accounts' => array('b741b99f95e841639b54272834bc478c'),
    'async' => false
));
shippo.shipment.create({
		"object_purpose": "PURCHASE",
		"address_from": addressFrom,
		"address_to": addressTo,
		"parcel": parcel,
		"carrier_accounts": ['b741b99f95e841639b54272834bc478c'],
		"async": false
}, function(err, shipment) {
  // asynchronously called
});
Map shipmentMap = new HashMap();
shipmentMap.put("object_purpose", "PURCHASE");
shipmentMap.put("address_to", toAddressMap);
shipmentMap.put("address_from", fromAddressMap);
shipmentMap.put("parcel", parcelMap);
shipmentMap.put("carrier_accounts", new String[]{"b741b99f95e841639b54272834bc478c"});
shipmentMap.put("async", false);

Shipment shipment = Shipment.create(shipmentMap);
shippo.shipment.create({
		"object_purpose": "PURCHASE",
		"address_from": addressFrom,
		"address_to": addressTo,
		"parcel": parcel,
		"carrier_accounts": ["b741b99f95e841639b54272834bc478c"],
		"async": false})

Filtering Carrier Accounts

You can filter carrier accounts by carrier and account_id:

curl https://api.goshippo.com/carrier_accounts/?carrier=fedex \
    -H "Authorization: ShippoToken <API_TOKEN>" \
Shippo::CarrierAccount.all(:carrier => "fedex")
shippo.CarrierAccount.all(carrier="fedex")
Shippo_CarrierAccount::all(array('carrier'=> 'fedex'))
shippo.carrieraccount.list({ carrier: 'fedex' }, function(err, response) {
    // asynchronously called
});
// not yet supported.
// not yet supported.

Account Structure by Carrier

Each carrier has its own type of fields. Browse the list below to find the required fields for the carriers you want to use.

{
    "carrier": "fedex",
    "account_id": "321123", // FedEx account number
    "parameters": {
        "meter": "789987", // FedEx meter number
        "smartpost_id": "5902" // Smartpost hub id (optional)
    },
    ...
}
{
    "carrier": "ups",
    "account_id": "myupsuser", // UPS user ID
    "parameters": {
        "password": "HipposDontLie!", // UPS password
        "account_number": "AB1234", // UPS account number
        "surepost": false, // Add Surepost rating (optional)
        "cost_center": "shippo", // Mail Innovations cost center (optional)
        "usps_endorsement": "3" // Mail Innovations USPS endorsement (optional)
    },
    ...
}
{
    "carrier": "dhl_express",
    "account_id": "123123", // DHL account number
    "parameters": {},
    ...
}
{
    "carrier": "dhl_ecommerce",
    "account_id": "dhl_ecommerce", // DHL eCommerce client ID
    "parameters": {
        "username": "HipposDontLie!", // DHL eCommerce username
        "password": "shipshippo", // DHL eCommerce password
        "pickup_no": "123123", // DHL eCommerce pickup number
        "facility_code": "23" // DHL eCommerce facility code
    },
    ...
}
{
    "carrier": "canada_post",
    "account_id": "shippo_api", // Canada Post API username
    "parameters": {
        "api_password": "HipposDontLie!", // Canada Post API password
        "customer_number": "413781", // Canada Post customer number
        "contract_id": "910412", // Canada Post contract number (optional)
        "payment_method": "Account" // Payment method for account, 'CreditCard' or 'Account' (optional)
    },
    ...
}
{
    "carrier": "purolator",
    "account_id": "shippo_purolator", // Purolator account number
    "parameters": {
        "production_key": "345345", // Purolator production key
        "production_key_password": "abcdef" // Purolator production key password
    },
    ...
}
{
    "carrier": "dhl_germany",
    "account_id": "500000123101291283", // DHL Paket account number
    "parameters": {
        "intraship_username": "dhl_shippo", // DHL username
        "intraship_password": "HipposDontLie!", // DHL password
        "tracking_account": "978346", // DHL tracking account (optional)
        "tracking_password": "HipposAreBack!" // DHL tracking password (optional)
    },
    ...
}
{
    "carrier": "gls_fr", // gls_fr for france, gls_de for germany
    "account_id": "7384207", // GLS customer ID
    "parameters": {
        "contact_id": "9238702", // GLS contact ID
        "depot": "DE 1680", // GLS depot
        "parcel_number_min": "9500001230", // GLS parcel number minimum
        "parcel_number_cur": "9500001244", // GLS parcel number current
        "parcel_number_max": "9500002300", // GLS parcel number maximum
        "cod_parcel_number_min": "2800001250", // GLS cash-on-delivery parcel number minimum
        "cod_parcel_number_cur": "2800001281", // GLS cash-on-delivery parcel number current
        "cod_parcel_number_max": "2800002900", // GLS cash-on-delivery parcel number maximum
        "depot_customer_id": "3764982" // GLS depot customer ID (optional)
    },
    ...
}
{
    "carrier": "mondialrelay",
    "account_id": "9328271", // Mondial Relay merchant ID
    "parameters": {
        "key": "JBHOS29JH19N7V6SJ89MK10K" // Mondial Relay key
    },
    ...
}
{
    "carrier": "newgistics",
    "account_id": "9328271", // Newgistics ID
    "parameters": {
        "ftp_production_username": "newgistics_shippo", 
        "ftp_production_password": "shipshipshippo", 
        "ftp_test_username": "newgistics_shippo_test", 
        "ftp_test_password": "testshippo", 
        "merchant_id": "123123", 
        "facility_id": "34535", 
        "induction_site_id": "123", 
        "mailer_id": "9328271" // (optional)
    },
    ...
}
{
    "carrier": "lasership",
    "account_id": "01isf7yzmpsbfy02172gyu2ek78", // LaserShip API key
    "parameters": {
        "lasership_apiid": "c27908r07cc20r893270adsc0402" // LaserShip API ID
    },
    ...
}
{
    "carrier": "ontrac",
    "account_id": "37", // OnTrac account number
    "parameters": {
        "password": "testpass" // OnTrac provided password
    },
    ...
}
{
    "carrier": "australia_post",
    "account_id": "123456", // Australia Post account number
    "parameters": {
        "apikey": "yourapikey", // Australia Post API key
        "password": "testpass" // Australia Post password
    },
    ...
}