Get Parcel Rates
Endpoint
https://tms.targetfmi.com/?p=api&r=text&c=parcelRateRequest&m=getParcelRates
Request Parameters
Parameter | Required | Available Options/Data Type | Max Length | Description |
---|---|---|---|---|
/shipper | Yes | n/a | n/a | Shipper container node |
/shipper/state | Yes | Valid state abbreviation / String | 2 | The state abbreviation where the shipment will move from. |
/shipper/zip | Yes | Valid postal code / String | 10 | The zip code where the shipment will move from. |
/shipper/country | Yes |
| 3 | The country code where the shipment will move from. |
/consignee | Yes | n/a | n/a | Consignee container node |
/consignee/address | No | String | ~65k | Consignee address |
/consignee/state | Yes | Valid state abbreviation / String | 2 | The state code where the shipment will move to. |
/consignee/zip | Yes | Valid postal code / String | 10 | The zip code where the shipment will move to. |
/consignee/country | Yes |
| 3 | The country code where the shipment will move to. |
/residential | Yes | [True][False] / Boolean | 1 | Indicates whether the shipment will be delivered to a residential address. |
/packagingType | Yes |
| n/a | The type of packaging used for the shipment. Applies to the entire rate request. Multi-piece shipments must contain the same packaging type in order to be valid. BOX should be used for customer provided packaging that does not fall into any other category. |
/dropoffType | Yes |
| n/a | Indicates how the shipment will be tendered to the carrier. This field does not initiate any type of pickup or drop off, it simply indicates how the package will be tendered in order to provide the most accurate rates. |
/warehouseCode | Yes | String | 20 | The warehouse (facility) you wish to get a rate for (TFM will provide this). Case sensitive. |
/shipDate | No | YYYY/MM/DD / String | n/a | Requested ship date for the shipment. |
/packages | Yes | n/a | n/a | Packages container node. |
/packages/length | Cond | Float > 0 | n/a, rounding may be applied | The length of the package, in inches. Required for packaging of type BOX* |
/packages/width | Cond | Float > 0 | n/a, rounding may be applied | The width of the package, in inches. Required for packaging of type BOX* |
/packages/height | Cond | Float > 0 | n/a, rounding may be applied | The height of the package, in inches. Required for packaging of type BOX* |
/packages/weight | Yes | Float > 0 | n/a, rounding may be applied | The weight of the package, in pounds. |
/packages/qty | Yes | Integer > 0 | depends on carrier limits | The number of packages in the shipment that are identical in every way to this one. Enter 1 for a single unique package. |
/packages/standardUnits | No | [True][False] / Boolean | 1 | Indicates whether units are standard (in/lbs) or metric (cm/kg). Default value: true. |
/packages/declaredValue | No | Integer >= 100 | depends on carrier limits | Declared value is covered up to the first $100 on a package by default. If you require additional insurance, enter a declared value higher than $100 for an additional surcharge. |
/packages/dgInfo | No | n/a | n/a | Dangerous goods / hazardous materials container node. Must be a contracted HazMat shipper to request dangerous goods. |
/packages/dgInfo/regulationSet | Cond |
| n/a | The regulatory set associated with regulated shipment. Must be the same across the entire shipment. |
/packages/dgInfo/unNum | Cond | '####' / String | 4 | The four digit UN number for the specified commodity. |
/packages/dgInfo/classNum | Cond | String | n/a | The hazard class associated to the specified commodity. |
/packages/dgInfo/subriskClassNum | Cond | String | n/a | The sub risk class associated with the specified commodity. Required if the field applies to the material by regulation. |
/packages/dgInfo/properShippingName | Cond | String | n/a | The proper shipping name assigned by the regulating body. |
/packages/dgInfo/technicalName | Cond | String | n/a | The technical name (when required) for the specified commodity. |
/packages/dgInfo/transportMode | Cond |
| n/a | Declares that a package was prepared according to ground, passenger aircraft or cargo aircraft only. |
/packages/dgInfo/packagingType | Cond |
| n/a | The type of package used to contain the regulated good. |
/packages/dgInfo/regulatoryQuantity | Cond |
| n/a | Indicates the type of commodity. FR = Fully Regulated, LQ = Limited Quantity |
/packages/dgInfo/packingInstructionCode | Cond | String | n/a | The packing instructions related to the chemical record. Required if the field applies to the material by regulation. |
/packages/dgInfo/packagingGroup | Cond |
| n/a | The packing group category associated to the specified commodity. Required if the field applies to the material by regulation. |
/packages/dgInfo/innerContainerType | Optional |
| n/a | An inner container packages inside of the packagingType. |
/packages/dgInfo/accessibility | Cond |
| n/a | The packing group category associated to the specified commodity. Required if the field applies to the material by regulation. |
/packages/dgInfo/requiredLabel | Cond | String | n/a | The required label identifying the type of hazardous material being shipped. e.g. 'NON FLAMMABLE GAS' |
/packages/dgInfo/emergencyPhone | Cond | String | n/a | A valid phone number to contact in case of an emergency during shipping. |
/packages/dgInfo/internationalEmergencyPhone | Cond | String | n/a | A valid phone number to contact in case of an emergency during shipping. |
/packages/dgInfo/emergencyResponseRegistrant | Cond | String | n/a | The emergency response registrant number |
/packages/dgInfo/offeror | Cond | String | n/a | The offeror name |
/packages/dgInfo/signatoryContactName | Cond | String | The signatory contact name | |
/packages/dgInfo/signatoryTitle | Cond | String | The signatory title | |
/packages/dgInfo/signatoryPlace | Cond | String | The location of the signatory. | |
/packages/dgInfo/packagingTypeQty | Cond | n/a | n/a | Packaging type quantity container node. |
/packages/dgInfo/packagingTypeQty/uom | Cond |
| n/a | The unit of measure used for the mass capacity of the regulated good. |
/packages/dgInfo/packagingTypeQty/qty | Cond | Float > 0.0 | n/a, rounding may be applied | The numerical value of the mass capacity of the regulated good. |
/customs/ | Cond | Customs container node | ||
/customs/customs_value | Cond | Integer > 0 | n/a | Value of package reported to customs Required if:
|
/customs/commodity_units | Cond | Integer > 0 | n/a | The number of units in the package Required if:
|
/customs/unit_value | Cond | Integer > 0 | n/a | The value of each commodity unit Required for FedEx International Shipment |
/customs/unit_count | Cond | Integer > 0 | n/a | |
/customs/part_number | Cond | String | Part number of the commodity being shipped Required for inbound international UPS shipments. | |
/customs/description | Cond | String | Description of the commodity being shipped. | |
/customs/import_uom | Cond |
| A description of the units of measure of the commodity. Required for inbound international UPS shipments. | |
/customs/export_reason | Cond |
| The reason the commodity is being exported. Only required for inbound international UPS shipments. | |
/customs/origin_country | Cond | String | 2 | The country code of the origin of the commodity being shipped. |
/specialServices | No | n/a | n/a | Special services container node. |
/specialServices/type | No |
| n/a | Type of special service for the shipment. Numerically indexed if both are required. |
/specialServices/additionalInfo | No |
| n/a | Type of signature option for the shipment. COD does not require additional information for a rate. |
/carrier | No |
| n/a | The carrier for which a rate is being requested |
/service | No |
| n/a | A specified service for which a rate is being requested. UPS codes are numeric strings. In parentheses are the services they correspond to. |
A Note on HazMat shipping
We currently only support Hazardous Materials shipping with FedEx and this service is available only by contractual basis.
Examples
<?php /** * Parcel Rate Example (Using Array Format) */ $data = array( 'shipper' => array( 'state' => 'PA', 'zip' => '15236', 'country' => 'US', ), 'consignee' => array( 'state' => 'PA', 'zip' => '15129', 'country' => 'US', ), 'residential' => TRUE, 'packagingType' => 'BOX', 'dropoffType' => 'REGULAR_PICKUP', 'warehouseCode' => 'CODE', 'packages' => array( array( 'length' => '10', 'width' => '10', 'height' => '10', 'weight' => '5', 'declaredValue' => 400, 'qty' => 12, ), array( 'length' => '24', 'width' => '17', 'height' => '10', 'weight' => '12', 'qty' => 3, ), ), ); ?>
<?php /** * Parcel Rate Example - HazMat (Using Array Format) */ $data = array ( 'warehouseCode' => 'CODE', 'shipper' => array ( 'zip' => '15056', 'country' => 'US', 'state' => 'PA', ), 'consignee' => array ( 'zip' => '15236', 'country' => 'US', 'state' => 'PA', ), 'packages' => array ( 0 => array ( 'id' => '', 'length' => '20', 'width' => '20', 'height' => '20', 'weight' => '15', 'declaredValue' => '', 'qty' => '1', 'standardUnits' => '1', 'dgInfo' => array ( 'selectedKey' => '', 'regulationSet' => 'IATA', 'unNum' => '1002', 'classNum' => '2.2', 'subriskClassNum' => '2.2', 'properShippingName' => 'Air, compressed', 'technicalName' => '', 'transportMode' => 'Ground', 'packagingType' => 'CYLINDER', 'innerContainerType' => '', 'regulatoryQuantity' => '', 'packingInstructionCode' => '200', 'packagingGroup' => 'None', 'accessibility' => 'ACCESSIBLE', 'requiredLabel' => 'NON FLAMMABLE GAS', 'emergencyPhone' => '8005551234', 'intlEmergencyPhone' => '8005551234', 'emergencyResponseRegistrant' => 'REGISTRANT_NUM', 'offeror' => 'OFFEROR', 'signatoryContactName' => 'SIGNATORY_CONTACT', 'signatoryTitle' => 'SIGNATORY_TITLE', 'signatoryPlace' => 'SIGNATORY_PLACE', 'packagingTypeQty' => array ( 'uom' => 'kg', 'qty' => '1', ), ), ), ), 'residential' => FALSE, 'dropoffType' => 'REGULAR_PICKUP', 'shipDate' => '', 'asnEmail' => '', 'packagingType' => 'BOX', 'shipmentId' => '', 'carrier' => 'FEDEX', 'service' => 'FEDEX_GROUND', ); ?>
<?php /** * Parcel Rate Example (Using stdClass() Format) */ // Base request node $data = new stdClass(); // Shipper details $data->shipper = new stdClass(); $data->shipper->state = 'NY'; $data->shipper->zip = '10980'; $data->shipper->country = 'US'; // Consignee details $data->consignee = new stdClass(); $data->consignee->state = 'PA'; $data->consignee->zip = '15129'; $data->consignee->country = 'US'; // General shipment information $data->residential = TRUE; $data->packagingType = 'BOX'; $data->dropoffType = 'REGULAR_PICKUP'; $data->warehouseCode = 'CODE'; $data->shipDate = '2019/01/09'; // Packages container $data->packages = array(); // First package in the shipment $package = new stdClass(); $package->length = '10'; $package->width = '10'; $package->height = '10'; $package->weight = '10'; $package->declaredValue = 400; $package->qty = 2; // Add the package to the container $data->packages[] = $package; // Second package in the shipment $package = new stdClass(); $package->length = '20'; $package->width = '45'; $package->height = '15'; $package->weight = '8'; $package->qty = 2; // Add the package to the container $data->packages[] = $package; ?>
Response Parameters
Parameter Name | Description |
---|---|
/body/parcelRates | Container for returned parcel rates |
/body/parcelRates/carrier | Name of the carrier |
/body/parcelRates/shipper | Shipper zip code |
/body/parcelRates/consignee | Consignee zip code |
/body/parcelRates/shipDate | Date the shipment is rated for |
/body/parcelRates/shipmentType | Indicates if the shipment is domestic or international |
/body/parcelRates/ratingMethod | The method used to rate the package. DIM (dimensional) or ACTUAL may be returned. UPS does not return this value, but it can be inferred from the total billing weight vs. actual weight of the shipment. |
/body/parcelRates/dimDivisor | The dimensional divisor that is used to calculate the shipment. |
/body/parcelRates/billingWeight | The total weight that was used to calculate billing for the shipment. |
/body/parcelRates/rates | Container for returned rates for this carrier. |
/body/parcelRates/rates/service | Textual name of the service type. |
/body/parcelRates/rates/serviceCode | Code used by the API to denote the service type. |
/body/parcelRates/rates/delivery | Container for delivery date and time information. |
/body/parcelRates/rates/delivery/dayOfWeek | Day of the week and date that the shipment will arrive by. |
/body/parcelRates/rates/delivery/dateTime | Time of the day that the shipment will arrive by. |
/body/parcelRates/rates/delivery/guaranteed | Indicates whether the delivery day of week and date time are guaranteed or estimated. 1 = Guaranteed, 0 = Estimated. |
/body/parcelRates/rates/baseCharge | Base charge of the shipment. |
/body/parcelRates/rates/discount | Discount amount that has been applied to the shipment. |
/body/parcelRates/rates/surcharges | Container to hold surcharge information. |
/body/parcelRates/rates/surcharges/type | Type of surcharge that has been applied. |
/body/parcelRates/rates/surcharges/amount | Monetary amount of the surcharge. |
/body/parcelRates/rates/totalSurcharges | Total monetary amount of all surcharges applied to the shipment |
/body/parcelRates/rates/totalCharge | Total monetary charge for the shipment |
/body/residential/ | True if the address is determined to be residential. [True][False] / Boolean (only returned if rating for a UPS shipment, or if carrier/service are not specified) |
Example
Array ( [body] => Array ( [parcelRates] => Array ( [0] => Array ( [carrier] => UPS [shipper] => 10980 [consignee] => 15129 [shipDate] => 2019-01-09 [shipmentType] => DOMESTIC [ratingMethod] => [dimDivisor] => [billingWeight] => 8.0 [rates] => Array ( [0] => Array ( [service] => UPS Ground [serviceCode] => 03 [delivery] => Array ( [dayOfWeek] => Fri 01-11-2019 [dateTime] => 11:00 PM [guaranteed] => 1 ) [baseCharge] => 12.51 [discount] => 6.94 [surcharges] => Array ( [0] => Array ( [type] => RESIDENTIAL ADDRESS [amount] => 3.95 ) [1] => Array ( [type] => INSURANCE [amount] => 4.2 ) [2] => Array ( [type] => HAZMAT ACCESSORIAL [amount] => 35 ) [3] => Array ( [type] => FUEL [amount] => 1.19 ) ) [totalSurcharges] => 44.34 [totalCharge] => 49.91 ) [1] => Array ( [service] => UPS 3 Day Select [serviceCode] => 12 [delivery] => Array ( [dayOfWeek] => Mon 01-14-2019 [dateTime] => 11:00 PM [guaranteed] => 1 ) [baseCharge] => 24.32 [discount] => 13.64 [surcharges] => Array ( [0] => Array ( [type] => RESIDENTIAL ADDRESS [amount] => 4.55 ) [1] => Array ( [type] => INSURANCE [amount] => 4.2 ) [2] => Array ( [type] => HAZMAT ACCESSORIAL [amount] => 98 ) [3] => Array ( [type] => FUEL [amount] => 1.8 ) ) [totalSurcharges] => 108.55 [totalCharge] => 119.23 ) [2] => Array ( [service] => UPS 2nd Day Air [serviceCode] => 02 [delivery] => Array ( [dayOfWeek] => Fri 01-11-2019 [dateTime] => 11:00 PM [guaranteed] => 1 ) [baseCharge] => 32.71 [discount] => 21.75 [surcharges] => Array ( [0] => Array ( [type] => RESIDENTIAL ADDRESS [amount] => 4.55 ) [1] => Array ( [type] => INSURANCE [amount] => 4.2 ) [2] => Array ( [type] => HAZMAT ACCESSORIAL [amount] => 98 ) [3] => Array ( [type] => FUEL [amount] => 2.33 ) ) [totalSurcharges] => 109.08 [totalCharge] => 120.04 ) [3] => Array ( [service] => UPS Next Day Air Saver [serviceCode] => 13 [delivery] => Array ( [dayOfWeek] => Thu 01-10-2019 [dateTime] => 3:00 PM [guaranteed] => 1 ) [baseCharge] => 93.01 [discount] => 66.47 [surcharges] => Array ( [0] => Array ( [type] => RESIDENTIAL ADDRESS [amount] => 4.55 ) [1] => Array ( [type] => INSURANCE [amount] => 4.2 ) [2] => Array ( [type] => HAZMAT ACCESSORIAL [amount] => 98 ) [3] => Array ( [type] => FUEL [amount] => 6.1 ) ) [totalSurcharges] => 112.85 [totalCharge] => 139.39 ) [4] => Array ( [service] => UPS Next Day Air Early [serviceCode] => 14 [delivery] => Array ( [dayOfWeek] => Thu 01-10-2019 [dateTime] => 8:30 AM [guaranteed] => 1 ) [baseCharge] => 95.18 [discount] => 1.24 [surcharges] => Array ( [0] => Array ( [type] => RESIDENTIAL ADDRESS [amount] => 4.55 ) [1] => Array ( [type] => INSURANCE [amount] => 4.2 ) [2] => Array ( [type] => HAZMAT ACCESSORIAL [amount] => 98 ) [3] => Array ( [type] => FUEL [amount] => 8.11 ) ) [totalSurcharges] => 114.86 [totalCharge] => 238.80 ) [5] => Array ( [service] => UPS Next Day Air [serviceCode] => 01 [delivery] => Array ( [dayOfWeek] => Thu 01-10-2019 [dateTime] => 10:30 AM [guaranteed] => 1 ) [baseCharge] => 95.18 [discount] => 67.98 [surcharges] => Array ( [0] => Array ( [type] => RESIDENTIAL ADDRESS [amount] => 4.55 ) [1] => Array ( [type] => INSURANCE [amount] => 4.2 ) [2] => Array ( [type] => HAZMAT ACCESSORIAL [amount] => 98 ) [3] => Array ( [type] => FUEL [amount] => 6.23 ) ) [totalSurcharges] => 112.98 [totalCharge] => 140.18 ) ) ) ) ) [message] => Array ( ) [notice] => Array ( ) )
Full Example
<?php /** *Parcel Rate Full Example (Using Array Format) */ require_once "../../restClient.class.php"; $resource = "https://tms.targetfmi.com/index.php"; $user = "API_KEY"; $pass = ""; $separator = "?"; $rest = new restClient($resource, $user, $pass, $separator); $data = array( 'shipper' => array( 'state' => 'PA', 'zip' => '15236', 'country' => 'US', ), 'consignee' => array( 'state' => 'PA', 'zip' => '15129', 'country' => 'US', ), 'residential' => TRUE, 'packagingType' => 'BOX', 'dropoffType' => 'REGULAR_PICKUP', 'warehouseCode' => 'CODE', 'packages' => array( array( 'length' => '10', 'width' => '10', 'height' => '10', 'weight' => '5', 'declaredValue' => 400, 'qty' => 1, ), ), ); $res = $rest->post("p=api&r=text&c=parcelRateRequest&m=getParcelRates", $data); ?>