Skip to main content

Rate Shop API

Try Now

POST https://api.piyovi.io/v1/shipment/rate

Overview

The Rate Shop API allows you to retrieve and compare shipping rates from multiple carriers based on shipment details. This helps identify the most cost-effective or time-efficient shipping options for your needs.

Authentication

This API requires authentication using one of the following methods:

  • Bearer Token: Include JWT with Bearer prefix in the Authorization header
  • API Key: Include X-API-KEY header with your API key

For more details, see Authentication Guide.

Request Format

POST /v1/shipment/rate
Content-Type: application/json
Authorization: Bearer {token}

Request Body

{
"client": "MyClient",
"shipDate": "2025-03-20T14:00:00Z",
"shipFrom": {
"companyName": "Your Company",
"contactName": "Jane Smith",
"address1": "456 Warehouse Blvd",
"city": "Chicago",
"stateProvince": "IL",
"country": "US",
"zipPostalCode": "60601"
},
"shipTo": {
"companyName": "Client Corp",
"contactName": "Bob Johnson",
"address1": "789 Client St",
"city": "Los Angeles",
"stateProvince": "CA",
"country": "US",
"zipPostalCode": "90001"
},
"packages": [
{
"weight": 10.5,
"length": 15,
"width": 12,
"height": 8,
"type": "Box"
}
],
"shipmentInfo": {
"shipMethod": "Ground",
"paymentType": "Prepaid"
},
"unitOfWeight": "LB",
"unitOfLength": "IN"
}

Response Format

Success Response (200 OK)

{
"success": true,
"responses": [
{
"carrierDisplayName": "FedEx",
"carrierName": "FEDEX",
"rates": [
{
"serviceDisplayName": "FedEx Ground",
"serviceName": "GROUND",
"serviceDescription": "1-5 business days",
"shipMethod": "Ground",
"freight": 45.67,
"discountFrieght": 41.10,
"baseCharge": 39.99,
"totalSurcharges": 5.68,
"totalTaxes": 0.00,
"currencycode": "USD",
"transitDays": "3",
"estimatedDelivery": "2025-03-23T17:00:00Z",
"surcharges": [
{
"name": "Fuel Surcharge",
"code": "FUEL",
"amount": 3.45,
"currencyCode": "USD"
}
]
},
{
"serviceDisplayName": "FedEx Express Saver",
"serviceName": "EXPRESS_SAVER",
"serviceDescription": "3 business days",
"shipMethod": "Express",
"freight": 65.43,
"discountFrieght": 58.89,
"baseCharge": 55.65,
"totalSurcharges": 9.78,
"transitDays": "3",
"estimatedDelivery": "2025-03-23T12:00:00Z"
}
]
},
{
"carrierDisplayName": "UPS",
"carrierName": "UPS",
"rates": [
{
"serviceDisplayName": "UPS Ground",
"serviceName": "GROUND",
"serviceDescription": "1-5 business days",
"shipMethod": "Ground",
"freight": 48.32,
"discountFrieght": 43.49,
"baseCharge": 41.22,
"totalSurcharges": 7.10,
"transitDays": "3",
"estimatedDelivery": "2025-03-23T17:00:00Z"
}
]
}
]
}

Error Response (400 Bad Request)

{
"success": false,
"errors": [
{
"code": "InvalidShipment",
"message": "Unable to retrieve rates for the provided shipment details",
"type": "ValidationError"
}
]
}

Field Reference

Request Fields

FieldTypeRequiredDescription
clientstringNoClient identifier
shipDatedatetimeYesDate when the shipment will be sent
shipToobjectYesDestination address details
shipFromobjectYesOrigin address details
packagesarrayYesPackage details
shipmentInfoobjectNoShipping method and carrier preferences
unitOfWeightstringNoUnit of measurement for weight (e.g., KG, LB)
unitOfLengthstringNoUnit of measurement for dimensions (e.g., CM, IN)
internationalDetailobjectNoInternational shipping information (required for international shipments)
specialServiceobjectNoSpecial service requirements
notesstringNoSpecial instructions

Address Object Fields (shipTo, shipFrom)

FieldTypeRequiredDescription
companyNamestringNoCompany name
contactNamestringNoContact person's name
emailAddressstringNoEmail address
phoneNumber1stringNoPrimary phone number
address1stringYesStreet address line 1
address2stringNoStreet address line 2
citystringYesCity name
stateProvincestringYesState or province
countrystringYesCountry code (2-letter ISO code recommended)
zipPostalCodestringYesPostal or ZIP code

Package Object Fields

FieldTypeRequiredDescription
weightnumberYesWeight of the package
lengthnumberYesLength of the package
widthnumberYesWidth of the package
heightnumberYesHeight of the package
typestringNoType of package (e.g., Box, Pallet)
freightClassstringNoFreight classification (for LTL shipments)
nmfcCodestringNoNMFC code for freight
declaredValuenumberNoDeclared value for insurance
countintegerNoCount of packages

Shipment Info Object Fields

FieldTypeRequiredDescription
shipMethodstringNoMethod of shipment (e.g., Ground, Express)
carrierstringNoPreferred carrier name
serviceLevelstringNoPreferred service level
paymentTypestringNoPayment method (e.g., Prepaid, Collect)

Response Fields

FieldTypeDescription
successbooleanIndicates if rate retrieval was successful
responsesarrayArray of carrier rate responses

Carrier Response Object Fields

FieldTypeDescription
carrierDisplayNamestringDisplay name of the carrier
carrierNamestringInternal name of the carrier
ratesarrayArray of rate options

Rate Object Fields

FieldTypeDescription
serviceDisplayNamestringDisplay name of the service level
serviceNamestringInternal name of the service level
serviceDescriptionstringDescription of the service
shipMethodstringShipping method
freightnumberPublished freight cost
discountFrieghtnumberDiscounted freight cost
baseChargenumberBase charge before surcharges
totalSurchargesnumberTotal of all surcharges
totalTaxesnumberTotal taxes
transitDaysstringEstimated transit time in days
currencycodestringCurrency code for monetary values
estimatedDeliverydatetimeEstimated delivery date and time
surchargesarrayDetailed breakdown of surcharges

Examples

Basic Domestic Rate Request

{
"client": "ExampleClient",
"shipDate": "2025-03-20T14:00:00Z",
"shipFrom": {
"companyName": "Sender Inc",
"address1": "123 Shipping Ave",
"city": "Chicago",
"stateProvince": "IL",
"country": "US",
"zipPostalCode": "60601"
},
"shipTo": {
"companyName": "Recipient Corp",
"address1": "456 Delivery St",
"city": "Los Angeles",
"stateProvince": "CA",
"country": "US",
"zipPostalCode": "90001"
},
"packages": [
{
"weight": 15.5,
"length": 18,
"width": 12,
"height": 10,
"type": "Box"
}
],
"unitOfWeight": "LB",
"unitOfLength": "IN"
}

International Rate Request

{
"client": "GlobalClient",
"shipDate": "2025-03-25T10:00:00Z",
"shipFrom": {
"companyName": "Exporter Inc",
"address1": "789 Export Road",
"city": "New York",
"stateProvince": "NY",
"country": "US",
"zipPostalCode": "10001"
},
"shipTo": {
"companyName": "International Corp",
"address1": "123 Global Street",
"city": "Berlin",
"stateProvince": "Berlin",
"country": "DE",
"zipPostalCode": "10115"
},
"packages": [
{
"weight": 5.2,
"length": 15,
"width": 10,
"height": 8,
"type": "Box"
},
{
"weight": 7.8,
"length": 20,
"width": 12,
"height": 10,
"type": "Box"
}
],
"internationalDetail": {
"dutiesPaidBy": "Sender",
"totalCustomValue": 600,
"reasonToExport": "Commercial Sample",
"incoTerm1": "DAP",
"currencyCode": "USD",
"commodities": [
{
"description": "Product Samples",
"numberOfBoxes": 2,
"quantity": 10,
"unitWeight": 1.3,
"unitPrice": 60,
"customValue": 600,
"countryOfOrigin": "US"
}
]
},
"unitOfWeight": "KG",
"unitOfLength": "CM"
}

Rate Request with Carrier Preferences

{
"client": "PreferredClient",
"shipDate": "2025-03-22T09:00:00Z",
"shipFrom": {
"companyName": "Origin Corp",
"address1": "100 Start St",
"city": "Dallas",
"stateProvince": "TX",
"country": "US",
"zipPostalCode": "75201"
},
"shipTo": {
"companyName": "Destination LLC",
"address1": "200 End Blvd",
"city": "Miami",
"stateProvince": "FL",
"country": "US",
"zipPostalCode": "33101"
},
"packages": [
{
"weight": 12.0,
"length": 16,
"width": 14,
"height": 9,
"type": "Box"
}
],
"shipmentInfo": {
"shipMethod": "Express",
"carrier": "FedEx",
"serviceLevel": "PRIORITY"
},
"unitOfWeight": "LB",
"unitOfLength": "IN"
}

Notes

  • Always provide accurate dimensions and weight to get precise rate quotes.
  • For international shipments, include complete customs information in the internationalDetail object.
  • The response includes rates from multiple carriers and service levels to allow for comparison.
  • Transit times and estimated delivery dates are approximations and may vary based on actual shipping conditions.
  • Currency codes in the response match the carrier's default currency or the currency specified in the request.