curl https://api.goshippo.com/live-rates \
-H "Authorization: ShippoToken <API_TOKEN>" \
-H "Content-Type: application/json"
--data-raw '{
"address_from": {
"name": "S. Hippo",
"company": "Shippo",
"street1": "731 Market St #200",
"street_no": "",
"street2": "",
"street3": "",
"city": "San Francisco",
"state": "CA",
"zip": "94103",
"country": "US"
},
"address_to": {
"name": "Bob Bloat",
"company": "SF Zoo",
"street1": "Sloat Blvd. & Upper Great Hwy.",
"street_no": "",
"street2": "",
"street3": "",
"city": "San Francisco",
"state": "CA",
"zip": "94132",
"country": "US"
},
"line_items": [
{
"quantity": 1,
"total_price": "12.00",
"currency": "USD",
"weight": "1.0",
"weight_unit": "lb",
"title": "Hippo Snax",
"manufacture_country": "US",
"sku": "HM-123"
}
],
"parcel": {
"length": "10",
"width": "15",
"height": "10",
"distance_unit": "in",
"weight": "1",
"mass_unit": "lb"
}
}'import dateutil.parser
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header='ShippoToken <API_TOKEN>',
shippo_api_version='2018-02-08',
)
res = s.rates_at_checkout.create(request=components.LiveRateCreateRequest(
address_from='<value>',
address_to=components.AddressCompleteCreateRequest(
name='Shwan Ippotle',
company='Shippo',
street1='215 Clayton St.',
street3='',
street_no='',
city='San Francisco',
state='CA',
zip='94117',
country='US',
phone='+1 555 341 9393',
email='shippotle@shippo.com',
is_residential=True,
metadata='Customer ID 123456',
validate=True,
),
line_items=[
components.LineItem(
currency='USD',
manufacture_country='US',
max_delivery_time=dateutil.parser.isoparse('2016-07-23T00:00:00Z'),
max_ship_time=dateutil.parser.isoparse('2016-07-23T00:00:00Z'),
quantity=20,
sku='HM-123',
title='Hippo Magazines',
total_price='12.1',
variant_title='June Edition',
weight='0.4',
weight_unit=components.WeightUnitEnum.LB,
object_id='abf7d5675d744b6ea9fdb6f796b28f28',
),
],
parcel='5df144dca289442cv7a06',
))
if res is not None:
# handle response
passimport { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken <API_TOKEN>",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.ratesAtCheckout.create({
addressFrom: "<value>",
addressTo: {
name: "Shwan Ippotle",
company: "Shippo",
street1: "215 Clayton St.",
street3: "",
streetNo: "",
city: "San Francisco",
state: "CA",
zip: "94117",
country: "US",
phone: "+1 555 341 9393",
email: "shippotle@shippo.com",
isResidential: true,
metadata: "Customer ID 123456",
validate: true,
},
lineItems: [
{
currency: "USD",
manufactureCountry: "US",
maxDeliveryTime: new Date("2016-07-23T00:00:00Z"),
maxShipTime: new Date("2016-07-23T00:00:00Z"),
quantity: 20,
sku: "HM-123",
title: "Hippo Magazines",
totalPrice: "12.1",
variantTitle: "June Edition",
weight: "0.4",
weightUnit: "lb",
objectId: "abf7d5675d744b6ea9fdb6f796b28f28",
},
],
parcel: "5df144dca289442cv7a06",
});
// Handle the result
console.log(result);
}
run();using Shippo;
using Shippo.Models.Components;
using System;
using System.Collections.Generic;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken <API_TOKEN>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.RatesAtCheckout.CreateAsync(
liveRateCreateRequest: new LiveRateCreateRequest() {
AddressFrom = LiveRateCreateRequestAddressFrom.CreateStr(
"<value>"
),
AddressTo = LiveRateCreateRequestAddressTo.CreateAddressCompleteCreateRequest(
new AddressCompleteCreateRequest() {
Name = "Shwan Ippotle",
Company = "Shippo",
Street1 = "215 Clayton St.",
Street3 = "",
StreetNo = "",
City = "San Francisco",
State = "CA",
Zip = "94117",
Country = "US",
Phone = "+1 555 341 9393",
Email = "shippotle@shippo.com",
IsResidential = true,
Metadata = "Customer ID 123456",
Validate = true,
}
),
LineItems = new List<LineItem>() {
new LineItem() {
Currency = "USD",
ManufactureCountry = "US",
MaxDeliveryTime = System.DateTime.Parse("2016-07-23T00:00:00Z"),
MaxShipTime = System.DateTime.Parse("2016-07-23T00:00:00Z"),
Quantity = 20,
Sku = "HM-123",
Title = "Hippo Magazines",
TotalPrice = "12.1",
VariantTitle = "June Edition",
Weight = "0.4",
WeightUnit = WeightUnitEnum.Lb,
ObjectId = "abf7d5675d744b6ea9fdb6f796b28f28",
},
},
Parcel = LiveRateCreateRequestParcel.CreateStr(
"5df144dca289442cv7a06"
),
},
shippoApiVersion: "2018-02-08"
);
// handle responsedeclare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Components;
use Shippo\API\Utils;
$sdk = API\Shippo::builder()
->setSecurity(
'ShippoToken <API_TOKEN>'
)
->setShippoApiVersion('2018-02-08')
->build();
$liveRateCreateRequest = new Components\LiveRateCreateRequest(
addressFrom: '<value>',
addressTo: new Components\AddressCompleteCreateRequest(
name: 'Shwan Ippotle',
company: 'Shippo',
street1: '215 Clayton St.',
street3: '',
streetNo: '',
city: 'San Francisco',
state: 'CA',
zip: '94117',
country: 'US',
phone: '+1 555 341 9393',
email: 'shippotle@shippo.com',
isResidential: true,
metadata: 'Customer ID 123456',
validate: true,
),
lineItems: [
new Components\LineItem(
currency: 'USD',
manufactureCountry: 'US',
maxDeliveryTime: Utils\Utils::parseDateTime('2016-07-23T00:00:00Z'),
maxShipTime: Utils\Utils::parseDateTime('2016-07-23T00:00:00Z'),
quantity: 20,
sku: 'HM-123',
title: 'Hippo Magazines',
totalPrice: '12.1',
variantTitle: 'June Edition',
weight: '0.4',
weightUnit: Components\WeightUnitEnum::Lb,
objectId: 'abf7d5675d744b6ea9fdb6f796b28f28',
),
],
parcel: '5df144dca289442cv7a06',
);
$response = $sdk->ratesAtCheckout->create(
liveRateCreateRequest: $liveRateCreateRequest,
shippoApiVersion: '2018-02-08'
);
if ($response->liveRatePaginatedList !== null) {
// handle response
}package hello.world;
import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.components.AddressCompleteCreateRequest;
import com.goshippo.shippo_sdk.models.components.LineItem;
import com.goshippo.shippo_sdk.models.components.LiveRateCreateRequest;
import com.goshippo.shippo_sdk.models.components.LiveRateCreateRequestAddressFrom;
import com.goshippo.shippo_sdk.models.components.LiveRateCreateRequestAddressTo;
import com.goshippo.shippo_sdk.models.components.LiveRateCreateRequestParcel;
import com.goshippo.shippo_sdk.models.components.WeightUnitEnum;
import com.goshippo.shippo_sdk.models.operations.CreateLiveRateResponse;
import java.lang.Exception;
import java.time.OffsetDateTime;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken <API_TOKEN>")
.shippoApiVersion("2018-02-08")
.build();
CreateLiveRateResponse res = sdk.ratesAtCheckout().create()
.shippoApiVersion("2018-02-08")
.liveRateCreateRequest(LiveRateCreateRequest.builder()
.addressTo(LiveRateCreateRequestAddressTo.of(AddressCompleteCreateRequest.builder()
.name("Shwan Ippotle")
.street1("215 Clayton St.")
.city("San Francisco")
.state("CA")
.zip("94117")
.country("US")
.company("Shippo")
.street3("")
.streetNo("")
.phone("+1 555 341 9393")
.email("shippotle@shippo.com")
.isResidential(true)
.metadata("Customer ID 123456")
.validate(true)
.build()))
.lineItems(List.of(
LineItem.builder()
.currency("USD")
.manufactureCountry("US")
.maxDeliveryTime(OffsetDateTime.parse("2016-07-23T00:00:00Z"))
.maxShipTime(OffsetDateTime.parse("2016-07-23T00:00:00Z"))
.quantity(20L)
.sku("HM-123")
.title("Hippo Magazines")
.totalPrice("12.1")
.variantTitle("June Edition")
.weight("0.4")
.weightUnit(WeightUnitEnum.LB)
.objectId("abf7d5675d744b6ea9fdb6f796b28f28")
.build()))
.addressFrom(LiveRateCreateRequestAddressFrom.of("<value>"))
.parcel(LiveRateCreateRequestParcel.of("5df144dca289442cv7a06"))
.build())
.call();
if (res.liveRatePaginatedList().isPresent()) {
// handle response
}
}
}const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
address_to: '<string>',
line_items: [
{
currency: 'USD',
manufacture_country: 'US',
max_delivery_time: '2016-07-23T00:00:00Z',
max_ship_time: '2016-07-23T00:00:00Z',
quantity: 20,
sku: 'HM-123',
title: 'Hippo Magazines',
total_price: '12.1',
variant_title: 'June Edition',
weight: '0.4',
weight_unit: 'lb',
object_id: 'abf7d5675d744b6ea9fdb6f796b28f28'
}
],
address_from: '<string>',
parcel: '5df144dca289442cv7a06'
})
};
fetch('https://api.goshippo.com/live-rates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.goshippo.com/live-rates"
payload := strings.NewReader("{\n \"address_to\": \"<string>\",\n \"line_items\": [\n {\n \"currency\": \"USD\",\n \"manufacture_country\": \"US\",\n \"max_delivery_time\": \"2016-07-23T00:00:00Z\",\n \"max_ship_time\": \"2016-07-23T00:00:00Z\",\n \"quantity\": 20,\n \"sku\": \"HM-123\",\n \"title\": \"Hippo Magazines\",\n \"total_price\": \"12.1\",\n \"variant_title\": \"June Edition\",\n \"weight\": \"0.4\",\n \"weight_unit\": \"lb\",\n \"object_id\": \"abf7d5675d744b6ea9fdb6f796b28f28\"\n }\n ],\n \"address_from\": \"<string>\",\n \"parcel\": \"5df144dca289442cv7a06\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.goshippo.com/live-rates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"address_to\": \"<string>\",\n \"line_items\": [\n {\n \"currency\": \"USD\",\n \"manufacture_country\": \"US\",\n \"max_delivery_time\": \"2016-07-23T00:00:00Z\",\n \"max_ship_time\": \"2016-07-23T00:00:00Z\",\n \"quantity\": 20,\n \"sku\": \"HM-123\",\n \"title\": \"Hippo Magazines\",\n \"total_price\": \"12.1\",\n \"variant_title\": \"June Edition\",\n \"weight\": \"0.4\",\n \"weight_unit\": \"lb\",\n \"object_id\": \"abf7d5675d744b6ea9fdb6f796b28f28\"\n }\n ],\n \"address_from\": \"<string>\",\n \"parcel\": \"5df144dca289442cv7a06\"\n}"
response = http.request(request)
puts response.read_body{
"next": "baseurl?page=3&results=10",
"previous": "baseurl?page=1&results=10",
"count": 123,
"results": [
{
"amount": "5.5",
"amount_local": "5.5",
"currency": "USD",
"currency_local": "USD",
"estimated_days": 2,
"title": "Shipping Option 1"
}
]
}{}Generate a live rates request
Initiates a live rates request. Include either the object ID for an existing address record or a fully formed address object when entering an address value. You can also enter the object ID of an existing user parcel template or a fully formed user parcel template object as the parcel value.
curl https://api.goshippo.com/live-rates \
-H "Authorization: ShippoToken <API_TOKEN>" \
-H "Content-Type: application/json"
--data-raw '{
"address_from": {
"name": "S. Hippo",
"company": "Shippo",
"street1": "731 Market St #200",
"street_no": "",
"street2": "",
"street3": "",
"city": "San Francisco",
"state": "CA",
"zip": "94103",
"country": "US"
},
"address_to": {
"name": "Bob Bloat",
"company": "SF Zoo",
"street1": "Sloat Blvd. & Upper Great Hwy.",
"street_no": "",
"street2": "",
"street3": "",
"city": "San Francisco",
"state": "CA",
"zip": "94132",
"country": "US"
},
"line_items": [
{
"quantity": 1,
"total_price": "12.00",
"currency": "USD",
"weight": "1.0",
"weight_unit": "lb",
"title": "Hippo Snax",
"manufacture_country": "US",
"sku": "HM-123"
}
],
"parcel": {
"length": "10",
"width": "15",
"height": "10",
"distance_unit": "in",
"weight": "1",
"mass_unit": "lb"
}
}'import dateutil.parser
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header='ShippoToken <API_TOKEN>',
shippo_api_version='2018-02-08',
)
res = s.rates_at_checkout.create(request=components.LiveRateCreateRequest(
address_from='<value>',
address_to=components.AddressCompleteCreateRequest(
name='Shwan Ippotle',
company='Shippo',
street1='215 Clayton St.',
street3='',
street_no='',
city='San Francisco',
state='CA',
zip='94117',
country='US',
phone='+1 555 341 9393',
email='shippotle@shippo.com',
is_residential=True,
metadata='Customer ID 123456',
validate=True,
),
line_items=[
components.LineItem(
currency='USD',
manufacture_country='US',
max_delivery_time=dateutil.parser.isoparse('2016-07-23T00:00:00Z'),
max_ship_time=dateutil.parser.isoparse('2016-07-23T00:00:00Z'),
quantity=20,
sku='HM-123',
title='Hippo Magazines',
total_price='12.1',
variant_title='June Edition',
weight='0.4',
weight_unit=components.WeightUnitEnum.LB,
object_id='abf7d5675d744b6ea9fdb6f796b28f28',
),
],
parcel='5df144dca289442cv7a06',
))
if res is not None:
# handle response
passimport { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken <API_TOKEN>",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.ratesAtCheckout.create({
addressFrom: "<value>",
addressTo: {
name: "Shwan Ippotle",
company: "Shippo",
street1: "215 Clayton St.",
street3: "",
streetNo: "",
city: "San Francisco",
state: "CA",
zip: "94117",
country: "US",
phone: "+1 555 341 9393",
email: "shippotle@shippo.com",
isResidential: true,
metadata: "Customer ID 123456",
validate: true,
},
lineItems: [
{
currency: "USD",
manufactureCountry: "US",
maxDeliveryTime: new Date("2016-07-23T00:00:00Z"),
maxShipTime: new Date("2016-07-23T00:00:00Z"),
quantity: 20,
sku: "HM-123",
title: "Hippo Magazines",
totalPrice: "12.1",
variantTitle: "June Edition",
weight: "0.4",
weightUnit: "lb",
objectId: "abf7d5675d744b6ea9fdb6f796b28f28",
},
],
parcel: "5df144dca289442cv7a06",
});
// Handle the result
console.log(result);
}
run();using Shippo;
using Shippo.Models.Components;
using System;
using System.Collections.Generic;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken <API_TOKEN>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.RatesAtCheckout.CreateAsync(
liveRateCreateRequest: new LiveRateCreateRequest() {
AddressFrom = LiveRateCreateRequestAddressFrom.CreateStr(
"<value>"
),
AddressTo = LiveRateCreateRequestAddressTo.CreateAddressCompleteCreateRequest(
new AddressCompleteCreateRequest() {
Name = "Shwan Ippotle",
Company = "Shippo",
Street1 = "215 Clayton St.",
Street3 = "",
StreetNo = "",
City = "San Francisco",
State = "CA",
Zip = "94117",
Country = "US",
Phone = "+1 555 341 9393",
Email = "shippotle@shippo.com",
IsResidential = true,
Metadata = "Customer ID 123456",
Validate = true,
}
),
LineItems = new List<LineItem>() {
new LineItem() {
Currency = "USD",
ManufactureCountry = "US",
MaxDeliveryTime = System.DateTime.Parse("2016-07-23T00:00:00Z"),
MaxShipTime = System.DateTime.Parse("2016-07-23T00:00:00Z"),
Quantity = 20,
Sku = "HM-123",
Title = "Hippo Magazines",
TotalPrice = "12.1",
VariantTitle = "June Edition",
Weight = "0.4",
WeightUnit = WeightUnitEnum.Lb,
ObjectId = "abf7d5675d744b6ea9fdb6f796b28f28",
},
},
Parcel = LiveRateCreateRequestParcel.CreateStr(
"5df144dca289442cv7a06"
),
},
shippoApiVersion: "2018-02-08"
);
// handle responsedeclare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Components;
use Shippo\API\Utils;
$sdk = API\Shippo::builder()
->setSecurity(
'ShippoToken <API_TOKEN>'
)
->setShippoApiVersion('2018-02-08')
->build();
$liveRateCreateRequest = new Components\LiveRateCreateRequest(
addressFrom: '<value>',
addressTo: new Components\AddressCompleteCreateRequest(
name: 'Shwan Ippotle',
company: 'Shippo',
street1: '215 Clayton St.',
street3: '',
streetNo: '',
city: 'San Francisco',
state: 'CA',
zip: '94117',
country: 'US',
phone: '+1 555 341 9393',
email: 'shippotle@shippo.com',
isResidential: true,
metadata: 'Customer ID 123456',
validate: true,
),
lineItems: [
new Components\LineItem(
currency: 'USD',
manufactureCountry: 'US',
maxDeliveryTime: Utils\Utils::parseDateTime('2016-07-23T00:00:00Z'),
maxShipTime: Utils\Utils::parseDateTime('2016-07-23T00:00:00Z'),
quantity: 20,
sku: 'HM-123',
title: 'Hippo Magazines',
totalPrice: '12.1',
variantTitle: 'June Edition',
weight: '0.4',
weightUnit: Components\WeightUnitEnum::Lb,
objectId: 'abf7d5675d744b6ea9fdb6f796b28f28',
),
],
parcel: '5df144dca289442cv7a06',
);
$response = $sdk->ratesAtCheckout->create(
liveRateCreateRequest: $liveRateCreateRequest,
shippoApiVersion: '2018-02-08'
);
if ($response->liveRatePaginatedList !== null) {
// handle response
}package hello.world;
import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.components.AddressCompleteCreateRequest;
import com.goshippo.shippo_sdk.models.components.LineItem;
import com.goshippo.shippo_sdk.models.components.LiveRateCreateRequest;
import com.goshippo.shippo_sdk.models.components.LiveRateCreateRequestAddressFrom;
import com.goshippo.shippo_sdk.models.components.LiveRateCreateRequestAddressTo;
import com.goshippo.shippo_sdk.models.components.LiveRateCreateRequestParcel;
import com.goshippo.shippo_sdk.models.components.WeightUnitEnum;
import com.goshippo.shippo_sdk.models.operations.CreateLiveRateResponse;
import java.lang.Exception;
import java.time.OffsetDateTime;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken <API_TOKEN>")
.shippoApiVersion("2018-02-08")
.build();
CreateLiveRateResponse res = sdk.ratesAtCheckout().create()
.shippoApiVersion("2018-02-08")
.liveRateCreateRequest(LiveRateCreateRequest.builder()
.addressTo(LiveRateCreateRequestAddressTo.of(AddressCompleteCreateRequest.builder()
.name("Shwan Ippotle")
.street1("215 Clayton St.")
.city("San Francisco")
.state("CA")
.zip("94117")
.country("US")
.company("Shippo")
.street3("")
.streetNo("")
.phone("+1 555 341 9393")
.email("shippotle@shippo.com")
.isResidential(true)
.metadata("Customer ID 123456")
.validate(true)
.build()))
.lineItems(List.of(
LineItem.builder()
.currency("USD")
.manufactureCountry("US")
.maxDeliveryTime(OffsetDateTime.parse("2016-07-23T00:00:00Z"))
.maxShipTime(OffsetDateTime.parse("2016-07-23T00:00:00Z"))
.quantity(20L)
.sku("HM-123")
.title("Hippo Magazines")
.totalPrice("12.1")
.variantTitle("June Edition")
.weight("0.4")
.weightUnit(WeightUnitEnum.LB)
.objectId("abf7d5675d744b6ea9fdb6f796b28f28")
.build()))
.addressFrom(LiveRateCreateRequestAddressFrom.of("<value>"))
.parcel(LiveRateCreateRequestParcel.of("5df144dca289442cv7a06"))
.build())
.call();
if (res.liveRatePaginatedList().isPresent()) {
// handle response
}
}
}const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
address_to: '<string>',
line_items: [
{
currency: 'USD',
manufacture_country: 'US',
max_delivery_time: '2016-07-23T00:00:00Z',
max_ship_time: '2016-07-23T00:00:00Z',
quantity: 20,
sku: 'HM-123',
title: 'Hippo Magazines',
total_price: '12.1',
variant_title: 'June Edition',
weight: '0.4',
weight_unit: 'lb',
object_id: 'abf7d5675d744b6ea9fdb6f796b28f28'
}
],
address_from: '<string>',
parcel: '5df144dca289442cv7a06'
})
};
fetch('https://api.goshippo.com/live-rates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.goshippo.com/live-rates"
payload := strings.NewReader("{\n \"address_to\": \"<string>\",\n \"line_items\": [\n {\n \"currency\": \"USD\",\n \"manufacture_country\": \"US\",\n \"max_delivery_time\": \"2016-07-23T00:00:00Z\",\n \"max_ship_time\": \"2016-07-23T00:00:00Z\",\n \"quantity\": 20,\n \"sku\": \"HM-123\",\n \"title\": \"Hippo Magazines\",\n \"total_price\": \"12.1\",\n \"variant_title\": \"June Edition\",\n \"weight\": \"0.4\",\n \"weight_unit\": \"lb\",\n \"object_id\": \"abf7d5675d744b6ea9fdb6f796b28f28\"\n }\n ],\n \"address_from\": \"<string>\",\n \"parcel\": \"5df144dca289442cv7a06\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.goshippo.com/live-rates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"address_to\": \"<string>\",\n \"line_items\": [\n {\n \"currency\": \"USD\",\n \"manufacture_country\": \"US\",\n \"max_delivery_time\": \"2016-07-23T00:00:00Z\",\n \"max_ship_time\": \"2016-07-23T00:00:00Z\",\n \"quantity\": 20,\n \"sku\": \"HM-123\",\n \"title\": \"Hippo Magazines\",\n \"total_price\": \"12.1\",\n \"variant_title\": \"June Edition\",\n \"weight\": \"0.4\",\n \"weight_unit\": \"lb\",\n \"object_id\": \"abf7d5675d744b6ea9fdb6f796b28f28\"\n }\n ],\n \"address_from\": \"<string>\",\n \"parcel\": \"5df144dca289442cv7a06\"\n}"
response = http.request(request)
puts response.read_body{
"next": "baseurl?page=3&results=10",
"previous": "baseurl?page=1&results=10",
"count": 123,
"results": [
{
"amount": "5.5",
"amount_local": "5.5",
"currency": "USD",
"currency_local": "USD",
"estimated_days": 2,
"title": "Shipping Option 1"
}
]
}{}Authorizations
API key authentication using the ShippoToken scheme. Format: Authorization: ShippoToken <API_TOKEN> Example: Authorization: ShippoToken shippo_live_abc123
Headers
Optional string used to pick a non-default API version to use. See our API version guide.
"2018-02-08"
Body
Generate rates at checkout
The recipient address, which includes the recipient's name, company name, street address, city, state, zip code, country, phone number, and email address (strings). Special characters should not be included in any address element, especially name, company, and email.
Array of Line Item objects
Show child attributes
Show child attributes
The sender address, which includes your name, company name, street address, city, state, zip code, country, phone number, and email address (strings). Special characters should not be included in any address element, especially name, company, and email.
Object ID for an existing User Parcel Template OR a fully formed Parcel object.
"5df144dca289442cv7a06"
Was this page helpful?