API Documentation
Everything you need to integrate RateShip into your application.
Everything you need to integrate RateShip into your application.
/api/v1/labelsPurchase a shipping label through your chosen provider.
| Field | Type | Required | Description |
|---|---|---|---|
| provider | "shippo" | "easypost" | "shipengine" | Yes | Provider to purchase through |
| rate_id | string | Yes | Rate ID from a previous rate request |
| carrier | string | Yes | Carrier name e.g. "USPS", "UPS" |
| service | string | Yes | Service level name |
| price_cents | number | Yes | Expected price in USD cents |
| from_address | Address | Yes | Sender address object |
| to_address | Address | Yes | Recipient address object |
| weight | number | Yes | Package weight |
| weight_unit | "lbs" | "oz" | Yes | Weight unit |
| length | number | Yes | Length in inches |
| width | number | Yes | Width in inches |
| height | number | Yes | Height in inches |
| package_count | number | Yes | Number of packages |
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Full name |
| street1 | string | Yes | Street address |
| city | string | Yes | City |
| state | string | Yes | 2-letter state code |
| zip | string | Yes | 5-digit ZIP code |
| country | string | No | Defaults to "US" |
import { RateShip } from "rateship";
const rateship = new RateShip({ apiKey: "rs_dev_your_key_here" });
const label = await rateship.labels.purchase({
provider: "shippo",
rate_id: "5e228fbf...",
carrier: "USPS",
service: "Ground Advantage",
price_cents: 965,
from_address: {
name: "Jane Smith",
street1: "123 Main St",
city: "New York",
state: "NY",
zip: "10001",
},
to_address: {
name: "John Doe",
street1: "456 Elm Ave",
city: "Beverly Hills",
state: "CA",
zip: "90210",
},
weight: 2.5,
weight_unit: "lbs",
length: 10,
width: 8,
height: 4,
package_count: 1,
});{
"success": true,
"data": {
"provider": "shippo",
"carrier": "USPS",
"service": "Ground Advantage",
"price_cents": 965,
"tracking_number": "9400111899223411922349",
"label_url": "https://cdn.goshippo.com/labels/...",
"rate_id": "5e228fbf..."
}
}/api/v1/labelsPurchase a shipping label through your chosen provider.
| Field | Type | Required | Description |
|---|---|---|---|
| provider | "shippo" | "easypost" | "shipengine" | Yes | Provider to purchase through |
| rate_id | string | Yes | Rate ID from a previous rate request |
| carrier | string | Yes | Carrier name e.g. "USPS", "UPS" |
| service | string | Yes | Service level name |
| price_cents | number | Yes | Expected price in USD cents |
| from_address | Address | Yes | Sender address object |
| to_address | Address | Yes | Recipient address object |
| weight | number | Yes | Package weight |
| weight_unit | "lbs" | "oz" | Yes | Weight unit |
| length | number | Yes | Length in inches |
| width | number | Yes | Width in inches |
| height | number | Yes | Height in inches |
| package_count | number | Yes | Number of packages |
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Full name |
| street1 | string | Yes | Street address |
| city | string | Yes | City |
| state | string | Yes | 2-letter state code |
| zip | string | Yes | 5-digit ZIP code |
| country | string | No | Defaults to "US" |
import { RateShip } from "rateship";
const rateship = new RateShip({ apiKey: "rs_dev_your_key_here" });
const label = await rateship.labels.purchase({
provider: "shippo",
rate_id: "5e228fbf...",
carrier: "USPS",
service: "Ground Advantage",
price_cents: 965,
from_address: {
name: "Jane Smith",
street1: "123 Main St",
city: "New York",
state: "NY",
zip: "10001",
},
to_address: {
name: "John Doe",
street1: "456 Elm Ave",
city: "Beverly Hills",
state: "CA",
zip: "90210",
},
weight: 2.5,
weight_unit: "lbs",
length: 10,
width: 8,
height: 4,
package_count: 1,
});{
"success": true,
"data": {
"provider": "shippo",
"carrier": "USPS",
"service": "Ground Advantage",
"price_cents": 965,
"tracking_number": "9400111899223411922349",
"label_url": "https://cdn.goshippo.com/labels/...",
"rate_id": "5e228fbf..."
}
}