Get Rates


This method is used to check pricing for parcel orders from all allowed providers. The method also automatically creates an order that isn't visible from the dashboard

The request accepts an optional carrier query param if preferred, it can be used like: https://api.deftship.com/parcel-orders/get-rates?carrier=ups. Selecting a specific carrier can significantly reduce the response time for rates.


Please note that this endpoint has rate-limiting, therefore, it will only allow 1000 requests per minute.


Available carriers are [Carriers are only available to registered users]

Endpoint

Method URI Headers
POST parcel-orders/get-rates default

Request

Field | Required | Type | Description
- | : | :- | from_address_id | No | Integer | This field is used to identify sender address. You can fetch your saved addresses from address-book. Addresses can be managed from the website on live dashboard or sandbox dashboard. Not required if a "from_address" object was used.

Note: If both "from_address_id" and "from_address" fields are defined system will prioritise the "from_address_id"
return_address_id | No | Integer | This field is used to identify return address. You should use the address which is in your saved from addresses. You can fetch your saved from addresses from address-book. Addresses can be managed from the website on live dashboard or sandbox dashboard. from_address {} | No
| Object | Sender address container. Condition: only required if a "from_address_id" was not used +name | Yes | String | Name of the sender +attention | No | String | Attention of the sender +street_1 | Yes | String | Street line 1 +street_2 | No | String | Street line 2 +street_3 | No | String | Street line 3 +city | Yes | String | City +zip | Yes | String | Postal Zip code +state | No | String | State - This field is required for US or Canada addresses please refer to country-codes +country | Yes | String | Country (code) for the list please refer to country-codes +telephone | Yes | String | Telephone Number - This field will will avoid special characters (max 10-15 digits) +email | No | String | Email to_address {} | Yes | Object | Receiver address container +name | Yes | String | Name of the receiver +attention | No | String | Attention of the receiver +street_1 | Yes | String | Street line 1 +street_2 | No | String | Street line 2 +street_3 | No | String | Street line 3 +city | Yes | String | City +zip | Yes | String | Postal Zip code +state | No | String | State - This field is required for US or Canada addresses please refer to country-codes +country | Yes | String | Country (code) for the list please refer to country-codes +telephone | Yes | String | Telephone Number - This field will will avoid special characters (max 10-15 digits) +email | No | String | Email weight_unit | No | String | By default, weight unit is taken from your preferences. However, it can be overwritten using this field. Valid values: LBS and KG length_unit | No | String | By default, length unit is taken from your preferences. However, it can be overwritten using this field. Valid values: IN and CM package_list [] | Yes | Array | An array containing all the package information +count | Yes | Integer | Pieces count +box_type | No | String | Carrier box types for the list please refer to Parcel Box Types +length | Yes | Float | Length +width | Yes | Float | Width +height | Yes | Float | Height +weight | Yes | Float | Weight +reference_1 | No | String | Reference that will appear on the label +reference_2 | No | String | Reference that will appear on the label +insurance | No | Boolean | Default is false. Setting this to true would require items information +is_hazmat | No | Boolean | If the item is hazmat, default is false +signature | No | String | Default is no_signature, other options are adult_signature and signature +items [] | No | Array | An array containing all items information. Condition: only required on international shipments and shipments with insurance ++quantity | No | Integer | Quantity of the item Condition: only required when items [] is used ++price | No | Float | Price of the item Condition: only required when items [] is used ++country_of_manufacture | No | String | Where the item is manufactured needs to be a country code please refer to country-codes. Condition: only required when items [] is used ++sku | No | String | SKU. Condition: only required when items [] is used ++hs_code | No | String | HS Tariff Code of item. The HS tariff code is an internationally standardized classification system for traded goods, used to determine tariffs and customs duties. Condition: only required when items [] is used ++description | No | String | A brief description for customs. Condition: only required when items [] is used ++content_type | No | String | Default is Merchandise, acceptable values are Merchandise, Gift, Documents, Sample. Condition: only required when items [] is used extra_services [] | No | Array | An array containing all the extra services +saturday_delivery | No | Boolean | Default is false. +certified_mail | No | Boolean | Default is false. +return_receipt | No | Boolean | Default is false. +return_receipt_electronic | No | Boolean | Default is false. +restricted_delivery | No | Boolean | Default is false. customs_details {} | No | Object | Customs details container +bill_type | No | String | Either DDU or DDP should be selected, default is DDP. +tax_id_type | No | String | Either VAT, EIN or SSN should be used, default is null. +tax_id | No | String | Default is null. +issuer_country | No | String | Default is null. +aes_itn | No | String | Default is null.

Request Example

{
    "from_address": {
        "name": "Example Corp",
        "attention": "John Doe",
        "city": "Los Angeles",
        "street_1": "123 S Main St",
        "zip": "90012",
        "state": "CA",
        "country": "US",
        "telephone": "9999999999"
    },
    "to_address": {
        "name": "Example Corp",
        "attention": "John Doe",
        "city": "Flushing",
        "street_1": "123 Main St",
        "zip": "11354",
        "state": "NY",
        "country": "US",
        "telephone": "9999999999"
    },
    "package_list": [
        {
            "length": 5,
            "width": 4,
            "count": 3,
            "weight": 2,
            "height": 1,
            "insurance": false,
            "signature": "no_signature",
            "items": [
                {
                    "quantity": 1,
                    "price": 12.5,
                    "sku": "SKU",
                    "hs_code": "620342",
                    "description": "Fryer",
                    "content_type": "Merchandise"
                }
            ]
        }
    ],
    "extra_services": {
        "saturday_delivery": false,
        "certified_mail": false,
        "return_receipt": false,
        "return_receipt_electronic": false,
        "restricted_delivery": false
    }
}

Response

Field | Type | Description
- | : | success | Boolean | true or false message | String | Error message (only exists if success is false) data | Array | An array containing received rates or if request has failed an object containing validation errors +id | Integer | This is the ID (rate_id) that you will need to use to ship this specific rate +carrier | String | Carrier of this rate +service | String | Service of this rate +service_code | String | Service code of this rate, please refer to service names +final_price | Float | Final price of the shipment including all costs +fuel_price | Float | Fuel price +restrictions | Array | Any extra information about this particular rate +miscellaneous_charges | Array | Any miscellaneous surcharges +freight_class | String | Only shown when the provider is UPS GFP type +channel_id | String | For own integrations only. This is the channel id is the name of the integrated account +eta | String | ETA of the shipment +has_enough_credits | Boolean | Shows if organisation has enough credits for this particular rate

Response Examples

Successful

{
    "success": true,
    "data": [
        {
            "id": 12345678,
            "carrier": "fedex",
            "service": "Fedex Ground",
            "service_code": "FEDEX-1",
            "final_price": "45.72",
            "fuel_price": "2.59",
            "restrictions": [],
            "miscellaneous_charges": [],
            "has_enough_credits": true,
            "channel_id": null,
            "eta": "3"
        },
        {
            "id": 12345678,
            "carrier": "fedex",
            "service": "Fedex Ground (MyOwnFedExAccount)",
            "service_code": "FEDEX-1",
            "final_price": "45.72",
            "fuel_price": "2.59",
            "restrictions": [],
            "miscellaneous_charges": [],
            "has_enough_credits": true,
            "channel_id": "MyOwnFedExAccount",
            "eta": "3"
        },
        {
            "id": 12345678,
            "carrier": "ups",
            "service": "UPS 3 Day Select",
            "service_code": "UPS-8",
            "final_price": "80.33",
            "fuel_price": "4.55",
            "restrictions": [],
            "miscellaneous_charges": [],
            "has_enough_credits": true,
            "channel_id": null,
            "eta": null
        }
    ]
}

Failed

{
    "success": false,
    "message": "The given data was invalid.",
    "data": {
        "to_address.city": [
            "The to address.city field is required."
        ]
    }
}

Parcel Box Types

Name Code Length (IN) Width (IN) Height (IN) Weight (LBS)
UPS Boxes
UPS Letter 01 15.00 🔒 9.50 🔒 1.00 🔒 0.90
Tube 03 38.00 🔒 6.00 🔒 9.00 🔒 150.00
25KG Box 24 19.75 🔒 17.75 🔒 13.25 🔒 55.12 🔒
10KG Box 25 16.50 🔒 13.25 🔒 10.75 🔒 22.05 🔒
Small Express Box 2a 13.00 🔒 11.00 🔒 2.00 🔒 150.00
Medium Express Box 2b 16.00 🔒 11.00 🔒 3.00 🔒 150.00
Large Express Box 2c 18.00 🔒 13.00 🔒 3.00 🔒 150.00
Express Pak 04 0.00 0.00 0.00 2.00 🔒
FedEx Boxes
FedEx Small Box FEDEX_SMALL_BOX 1.50 🔒 12.24 🔒 10.87 🔒 19.84
FedEx Medium Box FEDEX_MEDIUM_BOX 2.36 🔒 12.99 🔒 11.50 🔒 19.84
FedEx Large Box FEDEX_LARGE_BOX 2.99 🔒 17.87 🔒 12.36 🔒 20.00
FedEx Pak FEDEX_PAK 0.39 🔒 15.51 🔒 12.01 🔒 5.51
FedEx Tube FEDEX_TUBE 5.98 🔒 5.98 🔒 37.99 🔒 19.84
FedEx Envelope FEDEX_ENVELOPE 0.10 🔒 12.51 🔒 9.40 🔒 5.51
FedEx 10kg Box FEDEX_10KG_BOX 10.16 🔒 12.94 🔒 15.81 🔒 22.05 🔒
FedEx 25kg Box FEDEX_25KG_BOX 13.19 🔒 16.56 🔒 21.56 🔒 55.12 🔒
USPS Boxes
Small Flat Rate Box usps_small_flat_rate_box 8.62 🔒 5.37 🔒 1.62 🔒 70.00
Medium Flat Rate Box usps_medium_flat_rate_box 11.87 🔒 13.62 🔒 3.37 🔒 70.00
Large Flat Rate Box usps_large_flat_rate_box 12.00 🔒 12.00 🔒 5.50 🔒 70.00
Flat Rate Envelope usps_flat_rate_envelope 12.50 🔒 8.50 🔒 1.00 🔒 70.00
Padded Flat Rate Envelope usps_padded_flat_rate_envelope 12.50 🔒 8.50 🔒 1.00 🔒 70.00
Legal Flat Rate Envelope usps_legal_flat_rate_envelope 15.00 🔒 8.50 🔒 1.00 🔒 70.00
Regional Rate Box A usps_regional_rate_box_a 10.93 🔒 2.37 🔒 2.81 🔒 15.00
Regional Rate Box B usps_regional_rate_box_b 14.37 🔒 2.87 🔒 15.87 🔒 20.00