openapi: 3.1.0
info:
title: Shippo external API.
version: '2018-02-08'
x-logo:
url: https://docs.goshippo.com/images/shippo-logo.svg
contact:
name: Shippo Developer Platform
url: https://goshippo.com/contact/
description: Use this API to integrate with the Shippo service
servers:
- url: https://api.goshippo.com
security:
- APIKeyHeader: []
tags:
- name: Overview
description: |-
First-time users and those looking for specific integration tutorials,
see our full API documentation and guides.
Download the API Specification yaml file
API Resources
All API URLs listed in this documentation are relative to https://api.goshippo.com/.
For example, the `/addresses/` resource is reachable at `https://api.goshippo.com/addresses/`.
Authentication
The API requires Shippo's token HTTP Authentication with your Shippo token (live or test).
In order to authenticate properly, please put `Authorization: ShippoToken ` in your header. You can find your token on the
Shippo API settings page.
For more information about authentication and test mode,
please visit our Authentication guide.
The API is available via Secure Socket Layer (SSL) only. All requests to the Shippo API must use TLS version 1.2 or higher.
Request & Response Data
Request data is passed to the API by POSTing JSON objects with the appropriate key/value-pairs to the respective
resource. The documentation for each API resource contains more details on the values accepted by a given resource.
Response data also formatted as JSON object. You can specify how many results per page are to be returned. For instance,
`/rates/?results=25` will return up to 25 results.
REST & Disposable Objects
The Shippo API is built around REST principles.
Use POST requests to create objects, GET requests to retrieve objects, and PUT requests to update objects.
Only the Carrier Accounts object can be updated via PUT requests. All other objects such as Addresses, Parcels,
Shipments, Rates, Transactions, Refunds, Customs Items, and Customs Declarations are disposable. This means that
once you have created an object, you cannot change it. Instead, create a new one with the desired values.
API Version
This reference guide supports the Shippo API version: `2018-02-08` .
To see reference guides for older API versions, see our legacy reference guide.
For more information about Shippo API versions, see our API versions guide.
- name: Addresses
description: |-
Addresses are the locations a parcel is being shipped **from** and **to**. They represent company and residential places. Among other things, you can use address objects to create shipments, calculate shipping rates, and purchase shipping labels.
- name: Parcels
description: |-
A parcel is an item you are shipping. The parcel object includes details about its physical make-up of the parcel. It includes dimensions and weight that Shippo uses to calculate rates.
# Parcel Extras
The following values are supported for the `extra` field of the parcel object.
- name: Shipments
description: |-
A shipment is the act of transporting goods. A shipment object contains **to** and **from** addresses, and the parcel details that you are shipping. You can use the shipment object to retrieve shipping rates and purchase a shipping label.
# Shipment Extras
The following values are supported for the `extra` field of the shipment object.
- name: Rates
description: |-
A rate is the cost to ship a parcel from a carrier. The rate object details the service level including the cost and transit time.
- name: Transactions
x-displayName: Transactions (shipping labels)
description: |-
A transaction is the purchase of a shipping label from a shipping provider for a specific service. You can print purchased labels and used them to ship a parcel with a carrier, such as USPS or FedEx.
- name: Customs Items
description: |-
Customs declarations are relevant information, including one or multiple customs items, you need to provide for customs clearance for your international shipments.
- name: Customs Declarations
description: |-
Customs declarations are relevant information, including one or multiple customs items, you need to provide for
customs clearance for your international shipments.
- name: Refunds
description: |-
Refunds are reimbursements for successfully created but unused shipping labels or other charges.
- name: Manifests
description: |-
A manifest is a single-page document with a barcode that carriers can scan to accept all packages into transit without the need to scan each item individually.
They are close-outs of shipping labels of a certain day. Some carriers require manifests to process the shipments.
# Manifest Errors
The following codes and messages are the possible errors that may occur when creating Manifests.
- name: Carrier Accounts
description: |-
Carriers are the companies who deliver your package. Shippo uses Carrier account objects as credentials to retrieve shipping rates and purchase labels from shipping Carriers.
- name: Webhooks
description: |-
Webhooks are a way for Shippo to notify your application when a specific event occurs. For example, when a label is purchased or when a shipment tracking status has changed. You can use webhooks to trigger actions in your application, such as sending an email or updating a database.
# Webhook Payload
The payload is the body of the POST request Shippo sends to the URL specified at the time of webhook registration.
- name: Tracking Status
description: |-
If you purchased your shipping label through Shippo, you can also get all the tracking details of your Shipment
from the Transaction object.
A tracking status of a package is an indication of current location of a package in the supply chain. For example, sorting, warehousing, or out for delivery. Use the tracking status object to track the location of your shipments.
When using your Test token for tracking, you need to use Shippo's
predefined tokens for testing different tracking statuses. You can find more information in our
Tracking tutorial on how to do this, and what the
payloads look like.
- name: Batches
description: |-
A batch is a technique for creating multiple labels at once. Use the batch object to create and purchase many shipments in two API calls. After creating the batch, retrieve the batch to verify that all shipments are valid. You can add and remove shipments after you have created the batch. When all shipments are valid you can purchase the batch and retrieve all the shipping labels.
# Batch Shipment
The batch shipment object is a wrapper around a shipment object, which include shipment-specific information
for batch processing.
Note: batch shipments can only be created on the batch endpoint, either when creating a batch object or by through
the `/batches/{BATCH_OBJECT_ID}/add_shipments` endpoint
- name: Orders
x-displayName: Orders (beta)
description: |-
An order is a request from a customer to purchase goods from a merchant.
Use the orders object to load orders from your system to the Shippo dashboard.
You can use the orders object to create, retrieve, list, and manage orders programmatically.
You can also retrieve shipping rates, purchase labels, and track shipments for each order.
# Line Item
Line Items, and their corresponding abstract Products and Variants, might be exposed as a separate resource
in the future. Currently it's a nested object within the order resource.
A line item is an individual object in an order. For example, if your order contains a t-shirt, shorts, and a jacket, each item is represented by a line item.
- name: Pickups
description: |-
A pickup is when you schedule a carrier to collect a package for delivery.
Use Shippo’s pickups endpoint to schedule pickups with USPS and DHL Express for eligible shipments that you have already created.
- name: Service Groups
description: |-
A service group is a set of service levels grouped together.
Rates at checkout uses services groups to present available shipping options to customers in their shopping basket.
- name: Carrier Parcel Templates
description: |-
A carrier parcel template represents a package used for shipping that has preset dimensions defined by a carrier. Some examples of a carrier parcel template include USPS Flat Rate Box and Fedex Small Pak. When using a carrier parcel template, the rates returned may be limited to the carrier that provides the box. You can create user parcel templates using a carrier parcel template. Shippo takes the dimensions of the carrier parcel template but you must configure the weight.
- name: User Parcel Templates
description: |-
A user parcel template represents a package used for shipping that has preset dimensions and attributes defined
by you. They are useful for capturing attributes of parcel-types you frequently use for shipping, allowing
them to be defined once and then used for many shipments. These parcel templates can also be used for live rates.
User parcel templates can also be created using a carrier parcel template, where the dimensions will be copied from
the carrier presets, but the weight can be configured by you.
- name: Rates at Checkout
description: |-
Rates at checkout is a tool for merchants to display up-to-date shipping estimates based on what's in their customers cart and where they’re shipping to.
Merchants set up curated shipping options for customers in the checkout flow based on data in the shopping cart. The request must include the **to** address and item information. Optional fields are the **from** address and package information. If the optional fields are not included, the service will use the default address and/or package configured for rates at checkout. The response is a list of shipping options based on the Service Group configuration.
(see Service Group configuration for details).
# Default Parcel Template
Assign one of your user parcel templates to be the default used when generating Live Rates. This template will be used by default when generating Live Rates, unless you explicitly provide a parcel in the Live Rates request.
- name: Carriers
description:
- name: Service Levels
description:
- name: Parcel Templates
description: |-
A predefined package used by one or multiple carriers. See below for all available values and the corresponding tokens.
When a template is given, the parcel dimensions do not have to be sent, the dimensions below will instead be used.
The parcel weight is not affected by the use of a template.
- name: Shippo Accounts
description: |-
Shippo Accounts are used by Shippo Platform Accounts to create and manage Managed Shippo Accounts.
Managed Shippo Accounts are headless accounts that represent your customers. They are opaque to your end customers, meaning customers do not need to create their own Shippo login or have a billing relationship with Shippo.
They can be used by marketplaces, e-commerce platforms, and third-party logistics providers who want to offer, seamless, built-in shipping functionality to their customers. See our guide for more details.
- name: Customs Declaration B13A Filing Option
description:
- name: Customs Declaration Contents Type
description:
- name: Customs Declaration EEL/PFC
description:
- name: Customs Declaration Incoterm
description:
- name: Customs Declaration Non Delivery Option
description:
- name: Address Validation Source
description:
- name: Address Validation Codes
description:
paths:
/addresses:
get:
description: Returns a list of all address objects that have been created in this account.
operationId: ListAddresses
parameters:
- $ref: '#/components/parameters/PageNumberQueryParam'
- $ref: '#/components/parameters/ResultsPerPageDefault5QueryParam'
- $ref: '#/components/parameters/ShippoApiVersionHeader'
responses:
'200':
$ref: '#/components/responses/addressPaginatedResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: List all addresses
tags:
- Addresses
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/addresses/ \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396"
- lang: python
label: Python
source: |-
import shippo
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.addresses.list(page=1, results=5)
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.addresses.list(1, 5);
// Handle the result
console.log(result)
}
run();
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$response = $sdk->addresses->list(
page: 1,
results: 5,
shippoApiVersion: '2018-02-08'
);
if ($response->addressPaginatedList !== null) {
// handle response
}
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.Addresses.ListAsync(
page: 1,
results: 5,
shippoApiVersion: "2018-02-08");
// handle response
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.operations.ListAddressesResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
ListAddressesResponse res = sdk.addresses().list()
.page(1L)
.results(5L)
.shippoApiVersion("2018-02-08")
.call();
if (res.addressPaginatedList().isPresent()) {
// handle response
}
}
}
post:
description: Creates a new address object. You can use address objects to create new shipments, calculate rates, and to create orders.
operationId: CreateAddress
parameters:
- $ref: '#/components/parameters/ShippoApiVersionHeader'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AddressCreateRequest'
description: Address details.
responses:
'201':
$ref: '#/components/responses/addressResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Create a new address
tags:
- Addresses
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/addresses/ \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396" \
-d name="Shawn Ippotle" \
-d company="Shippo" \
-d street1="215 Clayton St." \
-d street2="" \
-d city="San Francisco" \
-d state="CA" \
-d zip=94117 \
-d country="US" \
-d phone="+1 555 341 9393" \
-d email="shippotle@shippo.com"\
-d is_residential=True\
-d metadata="Customer ID 123456"
- lang: python
label: Python
source: |-
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.addresses.create(request=components.AddressCreateRequest(
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,
))
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.addresses.create({
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,
});
// Handle the result
console.log(result)
}
run();
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Components;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$addressCreateRequest = new Components\AddressCreateRequest(
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,
);
$response = $sdk->addresses->create(
addressCreateRequest: $addressCreateRequest,
shippoApiVersion: '2018-02-08'
);
if ($response->address !== null) {
// handle response
}
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.Addresses.CreateAsync(
addressCreateRequest: new AddressCreateRequest() {
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,
},
shippoApiVersion: "2018-02-08");
// handle response
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.components.AddressCreateRequest;
import com.goshippo.sdk.models.operations.CreateAddressResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
CreateAddressResponse res = sdk.addresses().create()
.shippoApiVersion("2018-02-08")
.addressCreateRequest(AddressCreateRequest.builder()
.country("US")
.name("Shwan Ippotle")
.company("Shippo")
.street1("215 Clayton St.")
.street3("")
.streetNo("")
.city("San Francisco")
.state("CA")
.zip("94117")
.phone("+1 555 341 9393")
.email("shippotle@shippo.com")
.isResidential(true)
.metadata("Customer ID 123456")
.validate(true)
.build())
.call();
if (res.address().isPresent()) {
// handle response
}
}
}
/addresses/{AddressId}:
get:
description: Returns an existing address using an object ID.
operationId: GetAddress
parameters:
- description: Object ID of the address
in: path
name: AddressId
required: true
schema:
type: string
- $ref: '#/components/parameters/ShippoApiVersionHeader'
responses:
'200':
$ref: '#/components/responses/addressResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Retrieve an address
tags:
- Addresses
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/addresses/d799c2679e644279b59fe661ac8fa488/ \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396"
- lang: python
label: Python
source: |-
import shippo
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.addresses.get(address_id='')
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.addresses.get("");
// Handle the result
console.log(result)
}
run();
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$response = $sdk->addresses->get(
addressId: '',
shippoApiVersion: '2018-02-08'
);
if ($response->address !== null) {
// handle response
}
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.Addresses.GetAsync(
addressId: "",
shippoApiVersion: "2018-02-08");
// handle response
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.operations.GetAddressResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
GetAddressResponse res = sdk.addresses().get()
.addressId("")
.shippoApiVersion("2018-02-08")
.call();
if (res.address().isPresent()) {
// handle response
}
}
}
/addresses/{AddressId}/validate:
get:
description: Validates an existing address using an object ID
operationId: ValidateAddress
parameters:
- description: Object ID of the address
in: path
name: AddressId
required: true
schema:
type: string
- $ref: '#/components/parameters/ShippoApiVersionHeader'
responses:
'200':
$ref: '#/components/responses/addressResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Validate an address
tags:
- Addresses
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/addresses/d799c2679e644279b59fe661ac8fa488/validate/ \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396"
- lang: python
label: Python
source: |-
import shippo
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.addresses.validate(address_id='')
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.addresses.validate("");
// Handle the result
console.log(result)
}
run();
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$response = $sdk->addresses->validate(
addressId: '',
shippoApiVersion: '2018-02-08'
);
if ($response->address !== null) {
// handle response
}
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.Addresses.ValidateAsync(
addressId: "",
shippoApiVersion: "2018-02-08");
// handle response
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.operations.ValidateAddressResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
ValidateAddressResponse res = sdk.addresses().validate()
.addressId("")
.shippoApiVersion("2018-02-08")
.call();
if (res.address().isPresent()) {
// handle response
}
}
}
x-speakeasy-name-override: validate
/batches:
post:
description: Creates a new batch object for purchasing shipping labels for many shipments at once. Batches are created asynchronously. This means that the API response won't include your batch shipments yet. You need to retrieve the batch later to verify that all batch shipments are valid.
operationId: CreateBatch
parameters:
- $ref: '#/components/parameters/ShippoApiVersionHeader'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BatchCreateRequest'
description: Batch details.
responses:
'201':
$ref: '#/components/responses/batchResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Create a batch
tags:
- Batches
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/batches/ \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396" \
-H "Content-Type: application/json" \
-d '{
"default_carrier_account": "078870331023437cb917f5187429b093",
"default_servicelevel_token": "usps_priority",
"label_filetype": "PDF_4x6",
"metadata": "BATCH #170",
"batch_shipments": [
{
"shipment": {
"address_from": {
"name": "Mr Hippo",
"street1": "965 Mission St",
"street2": "Ste 201",
"city": "San Francisco",
"state": "CA",
"zip": "94103",
"country": "US",
"phone": "4151234567",
"email": "mrhippo@shippo.com"
},
"address_to": {
"name": "Mrs Hippo",
"company": "",
"street1": "Broadway 1",
"street2": "",
"city": "New York",
"state": "NY",
"zip": "10007",
"country": "US",
"phone": "4151234567",
"email": "mrshippo@shippo.com"
},
"parcels": [{
"length": "5",
"width": "5",
"height": "5",
"distance_unit": "in",
"weight": "2",
"mass_unit": "oz"
}]
}
},
{
"shipment": {
"address_from": {
"name": "Mr Hippo",
"street1": "1092 Indian Summer Ct",
"city": "San Jose",
"state": "CA",
"zip": "95122",
"country": "US",
"phone": "4151234567",
"email": "mrhippo@shippo.com"
},
"address_to": {
"name": "Mrs Hippo",
"company": "",
"street1": "Broadway 1",
"street2": "",
"city": "New York",
"state": "NY",
"zip": "10007",
"country": "US",
"phone": "4151234567",
"email": "mrshippo@shippo.com"
},
"parcels": [{
"length": "5",
"width": "5",
"height": "5",
"distance_unit": "in",
"weight": "20",
"mass_unit": "lb"
}]
},
"carrier_account": "a4391cd4ab974f478f55dc08b5c8e3b3",
"servicelevel_token": "fedex_2_day"
}
]
}'
- lang: python
label: Python
source: |-
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.batches.create(request=components.BatchCreateRequest(
default_carrier_account='078870331023437cb917f5187429b093',
default_servicelevel_token='usps_priority',
label_filetype=components.LabelFileTypeEnum.PDF_4X6,
metadata='BATCH #1',
batch_shipments=[
components.BatchShipmentCreateRequest(
carrier_account='a4391cd4ab974f478f55dc08b5c8e3b3',
metadata='SHIPMENT #1',
servicelevel_token='fedex_ground',
shipment=components.ShipmentCreateRequest(
extra=components.ShipmentExtra(
accounts_receivable_customer_account=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
appropriation_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
bill_of_lading_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
cod=components.Cod(
amount='5.5',
currency='USD',
payment_method=components.PaymentMethod.CASH,
),
cod_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
customer_reference=components.CustomerReference(
ref_sort=1,
),
dealer_order_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
dept_number=components.DepartmentNumber(
ref_sort=3,
),
fda_product_code=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
insurance=components.Insurance(
amount='5.5',
currency='USD',
),
invoice_number=components.InvoiceNumber(
ref_sort=2,
),
manifest_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
model_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
part_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
po_number=components.PoNumber(
ref_sort=2,
),
production_code=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
purchase_request_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
rma_number=components.RmaNumber(
ref_sort=1,
),
salesperson_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
serial_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
store_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
transaction_reference_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
),
metadata='Customer ID 123456',
shipment_date='2021-03-22T12:00:00Z',
address_from=components.AddressCreateRequest(
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,
),
address_return=components.AddressCreateRequest(
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,
),
address_to='d799c2679e644279b59fe661ac8fa489',
customs_declaration='adcfdddf8ec64b84ad22772bce3ea37a',
carrier_accounts=[
'065a4a8c10d24a34ab932163a1b87f52',
'73f706f4bdb94b54a337563840ce52b0',
],
parcels=[
components.ParcelCreateFromTemplateRequest(
extra=components.ParcelExtra(
cod=components.Cod(
amount='5.5',
currency='USD',
payment_method=components.PaymentMethod.CASH,
),
insurance=components.ParcelInsurance(
amount='5.5',
content='Laptop',
currency='USD',
provider=components.ParcelInsuranceProvider.UPS,
),
),
metadata='Customer ID 123456',
mass_unit=components.WeightUnitEnum.LB,
weight='1',
template=components.USPSParcelTemplate.USPS_FLAT_RATE_GIFT_CARD_ENVELOPE,
),
],
),
),
],
))
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.batches.create({
defaultCarrierAccount: "078870331023437cb917f5187429b093",
defaultServicelevelToken: "usps_priority",
labelFiletype: "PDF_4x6",
metadata: "BATCH #1",
batchShipments: [
{
carrierAccount: "a4391cd4ab974f478f55dc08b5c8e3b3",
metadata: "SHIPMENT #1",
servicelevelToken: "fedex_ground",
shipment: {
extra: {
accountsReceivableCustomerAccount: {
prefix: "ABC",
value: "value",
refSort: 1,
},
appropriationNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
billOfLadingNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
cod: {
amount: "5.5",
currency: "USD",
paymentMethod: "CASH",
},
codNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
customerReference: {
refSort: 1,
},
dealerOrderNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
deptNumber: {
refSort: 3,
},
fdaProductCode: {
prefix: "ABC",
value: "value",
refSort: 1,
},
insurance: {
amount: "5.5",
currency: "USD",
},
invoiceNumber: {
refSort: 2,
},
manifestNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
modelNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
partNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
poNumber: {
refSort: 2,
},
productionCode: {
prefix: "ABC",
value: "value",
refSort: 1,
},
purchaseRequestNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
rmaNumber: {
refSort: 1,
},
salespersonNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
serialNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
storeNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
transactionReferenceNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
},
metadata: "Customer ID 123456",
shipmentDate: "2021-03-22T12:00:00Z",
addressFrom: {
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,
},
addressReturn: {
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,
},
addressTo: "d799c2679e644279b59fe661ac8fa489",
customsDeclaration: "adcfdddf8ec64b84ad22772bce3ea37a",
carrierAccounts: [
"065a4a8c10d24a34ab932163a1b87f52",
"73f706f4bdb94b54a337563840ce52b0",
],
parcels: [
{
extra: {
cod: {
amount: "5.5",
currency: "USD",
paymentMethod: "CASH",
},
insurance: {
amount: "5.5",
content: "Laptop",
currency: "USD",
provider: "UPS",
},
},
metadata: "Customer ID 123456",
massUnit: "lb",
weight: "1",
template: "USPS_FlatRateGiftCardEnvelope",
},
],
},
},
],
});
// Handle the result
console.log(result)
}
run();
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Components;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$batchCreateRequest = new Components\BatchCreateRequest(
defaultCarrierAccount: '078870331023437cb917f5187429b093',
defaultServicelevelToken: 'usps_priority',
labelFiletype: Components\LabelFileTypeEnum::PDF4x6,
metadata: 'BATCH #1',
batchShipments: [
new Components\BatchShipmentCreateRequest(
carrierAccount: 'a4391cd4ab974f478f55dc08b5c8e3b3',
metadata: 'SHIPMENT #1',
servicelevelToken: 'fedex_ground',
shipment: new Components\ShipmentCreateRequest(
extra: new Components\ShipmentExtra(
accountsReceivableCustomerAccount: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
appropriationNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
billOfLadingNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
cod: new Components\Cod(
amount: '5.5',
currency: 'USD',
paymentMethod: Components\PaymentMethod::Cash,
),
codNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
customerReference: new Components\CustomerReference(
refSort: 1,
),
dealerOrderNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
deptNumber: new Components\DepartmentNumber(
refSort: 3,
),
fdaProductCode: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
insurance: new Components\Insurance(
amount: '5.5',
currency: 'USD',
),
invoiceNumber: new Components\InvoiceNumber(
refSort: 2,
),
manifestNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
modelNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
partNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
poNumber: new Components\PoNumber(
refSort: 2,
),
productionCode: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
purchaseRequestNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
rmaNumber: new Components\RmaNumber(
refSort: 1,
),
salespersonNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
serialNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
storeNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
transactionReferenceNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
),
metadata: 'Customer ID 123456',
shipmentDate: '2021-03-22T12:00:00Z',
addressFrom: new Components\AddressCreateRequest(
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,
),
addressReturn: 'd799c2679e644279b59fe661ac8fa488',
addressTo: new Components\AddressCreateRequest(
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,
),
customsDeclaration: new Components\CustomsDeclarationCreateRequest(
b13aFilingOption: Components\CustomsDeclarationB13AFilingOptionEnum::FiledElectronically,
certify: true,
certifySigner: 'Shawn Ippotle',
contentsExplanation: 'T-Shirt purchase',
dutiesPayor: new Components\DutiesPayor(
account: '2323434543',
type: Components\CustomsDeclarationCreateRequestType::ThirdParty,
address: new Components\CustomsDeclarationCreateRequestAddress(
name: 'Patrick Kavanagh',
zip: '80331',
country: 'DE',
),
),
exporterIdentification: new Components\CustomsExporterIdentification(
eoriNumber: 'PL123456790ABCDE',
taxId: new Components\CustomsTaxIdentification(
number: '123456789',
type: Components\CustomsTaxIdentificationType::Ein,
),
),
invoice: '#123123',
metadata: 'Order ID #123123',
addressImporter: new Components\AddressImporter(
name: 'Shwan Ippotle',
company: 'Shippo',
street1: 'Blumenstraße',
street3: '',
streetNo: '22',
city: 'München',
state: 'CA',
zip: '80331',
country: 'DE',
phone: '80331',
email: 'shippotle@shippo.com',
isResidential: true,
),
contentsType: Components\CustomsDeclarationContentsTypeEnum::Merchandise,
eelPfc: Components\CustomsDeclarationEelPfcEnum::NOEEI3037A,
incoterm: Components\CustomsDeclarationIncotermEnum::Ddp,
items: [
new Components\CustomsItemCreateRequest(
description: 'T-Shirt',
massUnit: Components\WeightUnitEnum::Lb,
metadata: 'Order ID "123454"',
netWeight: '5',
originCountry: '',
quantity: 20,
skuCode: 'HM-123',
hsCode: '0901.21',
valueAmount: '200',
valueCurrency: 'USD',
),
],
nonDeliveryOption: Components\CustomsDeclarationNonDeliveryOptionEnum::Return,
test: true,
),
carrierAccounts: [
'065a4a8c10d24a34ab932163a1b87f52',
'73f706f4bdb94b54a337563840ce52b0',
],
parcels: [
new Components\ParcelCreateRequest(
extra: new Components\ParcelExtra(
cod: new Components\Cod(
amount: '5.5',
currency: 'USD',
paymentMethod: Components\PaymentMethod::Cash,
),
insurance: new Components\ParcelInsurance(
amount: '5.5',
content: 'Laptop',
currency: 'USD',
provider: Components\ParcelInsuranceProvider::Ups,
),
),
metadata: 'Customer ID 123456',
massUnit: Components\WeightUnitEnum::Lb,
weight: '1',
distanceUnit: Components\DistanceUnitEnum::In,
height: '1',
length: '1',
width: '1',
),
],
),
),
],
);
$response = $sdk->batches->create(
batchCreateRequest: $batchCreateRequest,
shippoApiVersion: '2018-02-08'
);
if ($response->batch !== null) {
// handle response
}
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
using System.Collections.Generic;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.Batches.CreateAsync(
batchCreateRequest: new BatchCreateRequest() {
DefaultCarrierAccount = "078870331023437cb917f5187429b093",
DefaultServicelevelToken = "usps_priority",
LabelFiletype = LabelFileTypeEnum.Pdf4x6,
Metadata = "BATCH #1",
BatchShipments = new List() {
new BatchShipmentCreateRequest() {
CarrierAccount = "a4391cd4ab974f478f55dc08b5c8e3b3",
Metadata = "SHIPMENT #1",
ServicelevelToken = "fedex_ground",
Shipment = new ShipmentCreateRequest() {
Extra = new ShipmentExtra() {
AccountsReceivableCustomerAccount = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
AppropriationNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
BillOfLadingNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
Cod = new Cod() {
Amount = "5.5",
Currency = "USD",
PaymentMethod = PaymentMethod.Cash,
},
CodNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
CustomerReference = new CustomerReference() {
RefSort = 1,
},
DealerOrderNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
DeptNumber = new DepartmentNumber() {
RefSort = 3,
},
FdaProductCode = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
Insurance = new Insurance() {
Amount = "5.5",
Currency = "USD",
},
InvoiceNumber = new InvoiceNumber() {
RefSort = 2,
},
ManifestNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
ModelNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
PartNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
PoNumber = new PoNumber() {
RefSort = 2,
},
ProductionCode = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
PurchaseRequestNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
RmaNumber = new RmaNumber() {
RefSort = 1,
},
SalespersonNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
SerialNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
StoreNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
TransactionReferenceNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
},
Metadata = "Customer ID 123456",
ShipmentDate = "2021-03-22T12:00:00Z",
AddressFrom = AddressFrom.CreateAddressFromAddressCreateRequest(
new AddressCreateRequest() {
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,
},
),
AddressReturn = AddressReturn.CreateAddressReturnAddressCreateRequest(
new AddressCreateRequest() {
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,
},
),
AddressTo = AddressTo.CreateAddressToStr(
"d799c2679e644279b59fe661ac8fa489",
),
CustomsDeclaration = ShipmentCreateRequestCustomsDeclaration.CreateShipmentCreateRequestCustomsDeclarationStr(
"adcfdddf8ec64b84ad22772bce3ea37a",
),
CarrierAccounts = new List() {
"065a4a8c10d24a34ab932163a1b87f52",
"73f706f4bdb94b54a337563840ce52b0",
},
Parcels = new List() {
Parcels.CreateParcelsParcelCreateFromTemplateRequest(
new ParcelCreateFromTemplateRequest() {
Extra = new ParcelExtra() {
Cod = new Cod() {
Amount = "5.5",
Currency = "USD",
PaymentMethod = PaymentMethod.Cash,
},
Insurance = new ParcelInsurance() {
Amount = "5.5",
Content = "Laptop",
Currency = "USD",
Provider = ParcelInsuranceProvider.Ups,
},
},
Metadata = "Customer ID 123456",
MassUnit = Shippo.Models.Components.WeightUnitEnum.Lb,
Weight = "1",
Template = ParcelTemplateEnumSet.CreateParcelTemplateEnumSetUSPSParcelTemplate(
Shippo.Models.Components.USPSParcelTemplate.USPSFlatRateGiftCardEnvelope,
),
},
),
},
},
},
},
},
shippoApiVersion: "2018-02-08");
// handle response
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.components.AddressCreateRequest;
import com.goshippo.sdk.models.components.AddressFrom;
import com.goshippo.sdk.models.components.AddressReturn;
import com.goshippo.sdk.models.components.AddressTo;
import com.goshippo.sdk.models.components.BatchCreateRequest;
import com.goshippo.sdk.models.components.BatchShipmentCreateRequest;
import com.goshippo.sdk.models.components.Cod;
import com.goshippo.sdk.models.components.CustomerReference;
import com.goshippo.sdk.models.components.DepartmentNumber;
import com.goshippo.sdk.models.components.Insurance;
import com.goshippo.sdk.models.components.InvoiceNumber;
import com.goshippo.sdk.models.components.LabelFileTypeEnum;
import com.goshippo.sdk.models.components.ParcelCreateFromTemplateRequest;
import com.goshippo.sdk.models.components.ParcelExtra;
import com.goshippo.sdk.models.components.ParcelInsurance;
import com.goshippo.sdk.models.components.ParcelInsuranceProvider;
import com.goshippo.sdk.models.components.ParcelTemplateEnumSet;
import com.goshippo.sdk.models.components.ParcelTemplateFedExEnum;
import com.goshippo.sdk.models.components.Parcels;
import com.goshippo.sdk.models.components.PaymentMethod;
import com.goshippo.sdk.models.components.PoNumber;
import com.goshippo.sdk.models.components.RmaNumber;
import com.goshippo.sdk.models.components.ShipmentCreateRequest;
import com.goshippo.sdk.models.components.ShipmentCreateRequestCustomsDeclaration;
import com.goshippo.sdk.models.components.ShipmentExtra;
import com.goshippo.sdk.models.components.UPSReferenceFields;
import com.goshippo.sdk.models.components.WeightUnitEnum;
import com.goshippo.sdk.models.operations.CreateBatchResponse;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
CreateBatchResponse res = sdk.batches().create()
.shippoApiVersion("2018-02-08")
.batchCreateRequest(BatchCreateRequest.builder()
.defaultCarrierAccount("078870331023437cb917f5187429b093")
.defaultServicelevelToken("usps_priority")
.batchShipments(List.of(
BatchShipmentCreateRequest.builder()
.shipment(ShipmentCreateRequest.builder()
.addressFrom(AddressFrom.of(AddressCreateRequest.builder()
.country("US")
.name("Shwan Ippotle")
.company("Shippo")
.street1("215 Clayton St.")
.street3("")
.streetNo("")
.city("San Francisco")
.state("CA")
.zip("94117")
.phone("+1 555 341 9393")
.email("shippotle@shippo.com")
.isResidential(true)
.metadata("Customer ID 123456")
.validate(true)
.build()))
.addressTo(AddressTo.of("d799c2679e644279b59fe661ac8fa489"))
.parcels(List.of(
Parcels.of(ParcelCreateFromTemplateRequest.builder()
.massUnit(WeightUnitEnum.LB)
.weight("1")
.template(ParcelTemplateEnumSet.of(ParcelTemplateFedExEnum.FED_EX_BOX25KG))
.extra(ParcelExtra.builder()
.cod(Cod.builder()
.amount("5.5")
.currency("USD")
.paymentMethod(PaymentMethod.CASH)
.build())
.insurance(ParcelInsurance.builder()
.amount("5.5")
.content("Laptop")
.currency("USD")
.provider(ParcelInsuranceProvider.UPS)
.build())
.build())
.metadata("Customer ID 123456")
.build())))
.extra(ShipmentExtra.builder()
.accountsReceivableCustomerAccount(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.appropriationNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.billOfLadingNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.cod(Cod.builder()
.amount("5.5")
.currency("USD")
.paymentMethod(PaymentMethod.CASH)
.build())
.codNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.customerReference(CustomerReference.builder()
.refSort(1L)
.build())
.dealerOrderNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.deptNumber(DepartmentNumber.builder()
.refSort(3L)
.build())
.fdaProductCode(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.insurance(Insurance.builder()
.amount("5.5")
.currency("USD")
.build())
.invoiceNumber(InvoiceNumber.builder()
.refSort(2L)
.build())
.manifestNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.modelNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.partNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.poNumber(PoNumber.builder()
.refSort(2L)
.build())
.productionCode(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.purchaseRequestNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.rmaNumber(RmaNumber.builder()
.refSort(1L)
.build())
.salespersonNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.serialNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.storeNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.transactionReferenceNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.build())
.metadata("Customer ID 123456")
.shipmentDate("2021-03-22T12:00:00Z")
.addressReturn(AddressReturn.of("d799c2679e644279b59fe661ac8fa488"))
.customsDeclaration(ShipmentCreateRequestCustomsDeclaration.of("adcfdddf8ec64b84ad22772bce3ea37a"))
.carrierAccounts(List.of(
"065a4a8c10d24a34ab932163a1b87f52",
"73f706f4bdb94b54a337563840ce52b0"))
.build())
.carrierAccount("a4391cd4ab974f478f55dc08b5c8e3b3")
.metadata("SHIPMENT #1")
.servicelevelToken("fedex_ground")
.build()))
.labelFiletype(LabelFileTypeEnum.PDF4X6)
.metadata("BATCH #1")
.build())
.call();
if (res.batch().isPresent()) {
// handle response
}
}
}
/batches/{BatchId}:
get:
description: |-
Returns a batch using an object ID.
Batch shipments are displayed 100 at a time. You can iterate
through each `page` using the `?page= query` parameter. You can also filter based on batch shipment
status, for example, by passing a query param like `?object_results=creation_failed`.
For more details on filtering results, see our guide on filtering.
operationId: GetBatch
parameters:
- description: Object ID of the batch
in: path
name: BatchId
required: true
schema:
type: string
- $ref: '#/components/parameters/PageNumberQueryParam'
- $ref: '#/components/parameters/ResultsPerPageDefault5QueryParam'
- $ref: '#/components/parameters/ShippoApiVersionHeader'
responses:
'200':
$ref: '#/components/responses/batchResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Retrieve a batch
tags:
- Batches
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/batches/?page=2&object_results=creation_failed \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396"
- lang: python
label: Python
source: |-
import shippo
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.batches.get(batch_id='')
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.batches.get("");
// Handle the result
console.log(result)
}
run();
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$response = $sdk->batches->get(
batchId: '',
shippoApiVersion: '2018-02-08'
);
if ($response->batch !== null) {
// handle response
}
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.Batches.GetAsync(
batchId: "",
shippoApiVersion: "2018-02-08");
// handle response
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.operations.GetBatchResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
GetBatchResponse res = sdk.batches().get()
.batchId("")
.page(1L)
.results(5L)
.shippoApiVersion("2018-02-08")
.call();
if (res.batch().isPresent()) {
// handle response
}
}
}
/batches/{BatchId}/add_shipments:
post:
description: Adds batch shipments to an existing batch.
operationId: AddShipmentsToBatch
parameters:
- description: Object ID of the batch
in: path
name: BatchId
required: true
schema:
type: string
- $ref: '#/components/parameters/ShippoApiVersionHeader'
requestBody:
required: true
content:
application/json:
schema:
items:
$ref: '#/components/schemas/BatchShipmentCreateRequest'
type: array
description: Array of shipments to add to the batch
responses:
'200':
$ref: '#/components/responses/batchResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Add shipments to a batch
tags:
- Batches
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl -X POST https://api.goshippo.com/batches//add_shipments \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396" \
-H "Content-Type: application/json" \
-d '[
{
"shipment": {
"address_from": {
"name": "Mr Hippo",
"street1": "965 Mission St",
"street2": "Ste 201",
"city": "San Francisco",
"state": "CA",
"zip": "94103",
"country": "US",
"phone": "4151234567",
},
"address_to": {
"name": "Hippo Jr",
"street1": "915 Broadway",
"street2": "19th Floor",
"city": "New York",
"state": "NY",
"zip": "10010",
"country": "US",
"phone": "2129947880",
},
"parcels": [{
"length": "12",
"width": "12",
"height": "12",
"distance_unit": "in",
"weight": "12",
"mass_unit": "oz"
}]
}
},
{
"shipment": {
"address_from": {
"name": "Ms Hippo",
"street1": "1092 Indian Summer Ct",
"city": "San Jose",
"state": "CA",
"zip": "95122",
"country": "US",
"phone": "4151234567",
},
"address_to": {
"name": "Mr Hippo",
"street1": "965 Mission St",
"street2": "Ste 201",
"city": "San Francisco",
"state": "CA",
"zip": "94103",
"country": "US",
"phone": "4151234567",
},
"parcels": [{
"length": "5",
"width": "5",
"height": "5",
"distance_unit": "in",
"weight": "2",
"mass_unit": "lb"
}]
},
"carrier_account": "a4391cd4ab974f478f55dc08b5c8e3b3",
"servicelevel_token": "fedex_2_day"
}
]'
- lang: python
label: Python
source: |-
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.batches.add_shipments(batch_id='', request_body=[
components.BatchShipmentCreateRequest(
carrier_account='a4391cd4ab974f478f55dc08b5c8e3b3',
metadata='SHIPMENT #1',
servicelevel_token='fedex_ground',
shipment=components.ShipmentCreateRequest(
extra=components.ShipmentExtra(
accounts_receivable_customer_account=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
appropriation_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
bill_of_lading_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
cod=components.Cod(
amount='5.5',
currency='USD',
payment_method=components.PaymentMethod.CASH,
),
cod_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
customer_reference=components.CustomerReference(
ref_sort=1,
),
dealer_order_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
dept_number=components.DepartmentNumber(
ref_sort=3,
),
fda_product_code=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
insurance=components.Insurance(
amount='5.5',
currency='USD',
),
invoice_number=components.InvoiceNumber(
ref_sort=2,
),
manifest_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
model_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
part_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
po_number=components.PoNumber(
ref_sort=2,
),
production_code=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
purchase_request_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
rma_number=components.RmaNumber(
ref_sort=1,
),
salesperson_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
serial_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
store_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
transaction_reference_number=components.UPSReferenceFields(
prefix='ABC',
value='value',
ref_sort=1,
),
),
metadata='Customer ID 123456',
shipment_date='2021-03-22T12:00:00Z',
address_from='d799c2679e644279b59fe661ac8fa488',
address_return='d799c2679e644279b59fe661ac8fa488',
address_to=components.AddressCreateRequest(
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,
),
customs_declaration='adcfdddf8ec64b84ad22772bce3ea37a',
carrier_accounts=[
'065a4a8c10d24a34ab932163a1b87f52',
'73f706f4bdb94b54a337563840ce52b0',
],
parcels=[
components.ParcelCreateRequest(
extra=components.ParcelExtra(
cod=components.Cod(
amount='5.5',
currency='USD',
payment_method=components.PaymentMethod.CASH,
),
insurance=components.ParcelInsurance(
amount='5.5',
content='Laptop',
currency='USD',
provider=components.ParcelInsuranceProvider.UPS,
),
),
metadata='Customer ID 123456',
mass_unit=components.WeightUnitEnum.LB,
weight='1',
distance_unit=components.DistanceUnitEnum.IN,
height='1',
length='1',
width='1',
),
],
),
),
])
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.batches.addShipments("", [
{
carrierAccount: "a4391cd4ab974f478f55dc08b5c8e3b3",
metadata: "SHIPMENT #1",
servicelevelToken: "fedex_ground",
shipment: {
extra: {
accountsReceivableCustomerAccount: {
prefix: "ABC",
value: "value",
refSort: 1,
},
appropriationNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
billOfLadingNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
cod: {
amount: "5.5",
currency: "USD",
paymentMethod: "CASH",
},
codNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
customerReference: {
refSort: 1,
},
dealerOrderNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
deptNumber: {
refSort: 3,
},
fdaProductCode: {
prefix: "ABC",
value: "value",
refSort: 1,
},
insurance: {
amount: "5.5",
currency: "USD",
},
invoiceNumber: {
refSort: 2,
},
manifestNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
modelNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
partNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
poNumber: {
refSort: 2,
},
productionCode: {
prefix: "ABC",
value: "value",
refSort: 1,
},
purchaseRequestNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
rmaNumber: {
refSort: 1,
},
salespersonNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
serialNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
storeNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
transactionReferenceNumber: {
prefix: "ABC",
value: "value",
refSort: 1,
},
},
metadata: "Customer ID 123456",
shipmentDate: "2021-03-22T12:00:00Z",
addressFrom: "d799c2679e644279b59fe661ac8fa488",
addressReturn: "d799c2679e644279b59fe661ac8fa488",
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,
},
customsDeclaration: "adcfdddf8ec64b84ad22772bce3ea37a",
carrierAccounts: [
"065a4a8c10d24a34ab932163a1b87f52",
"73f706f4bdb94b54a337563840ce52b0",
],
parcels: [
{
extra: {
cod: {
amount: "5.5",
currency: "USD",
paymentMethod: "CASH",
},
insurance: {
amount: "5.5",
content: "Laptop",
currency: "USD",
provider: "UPS",
},
},
metadata: "Customer ID 123456",
massUnit: "lb",
weight: "1",
distanceUnit: "in",
height: "1",
length: "1",
width: "1",
},
],
},
},
]);
// Handle the result
console.log(result)
}
run();
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
using System.Collections.Generic;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.Batches.AddShipmentsAsync(
batchId: "",
requestBody: new List() {
new BatchShipmentCreateRequest() {
CarrierAccount = "a4391cd4ab974f478f55dc08b5c8e3b3",
Metadata = "SHIPMENT #1",
ServicelevelToken = "fedex_ground",
Shipment = new ShipmentCreateRequest() {
Extra = new ShipmentExtra() {
AccountsReceivableCustomerAccount = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
AppropriationNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
BillOfLadingNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
Cod = new Cod() {
Amount = "5.5",
Currency = "USD",
PaymentMethod = PaymentMethod.Cash,
},
CodNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
CustomerReference = new CustomerReference() {
RefSort = 1,
},
DealerOrderNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
DeptNumber = new DepartmentNumber() {
RefSort = 3,
},
FdaProductCode = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
Insurance = new Insurance() {
Amount = "5.5",
Currency = "USD",
},
InvoiceNumber = new InvoiceNumber() {
RefSort = 2,
},
ManifestNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
ModelNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
PartNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
PoNumber = new PoNumber() {
RefSort = 2,
},
ProductionCode = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
PurchaseRequestNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
RmaNumber = new RmaNumber() {
RefSort = 1,
},
SalespersonNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
SerialNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
StoreNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
TransactionReferenceNumber = new UPSReferenceFields() {
Prefix = "ABC",
Value = "value",
RefSort = 1,
},
},
Metadata = "Customer ID 123456",
ShipmentDate = "2021-03-22T12:00:00Z",
AddressFrom = AddressFrom.CreateAddressFromStr(
"d799c2679e644279b59fe661ac8fa488",
),
AddressReturn = AddressReturn.CreateAddressReturnStr(
"d799c2679e644279b59fe661ac8fa488",
),
AddressTo = AddressTo.CreateAddressToAddressCreateRequest(
new AddressCreateRequest() {
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,
},
),
CustomsDeclaration = ShipmentCreateRequestCustomsDeclaration.CreateShipmentCreateRequestCustomsDeclarationStr(
"adcfdddf8ec64b84ad22772bce3ea37a",
),
CarrierAccounts = new List() {
"065a4a8c10d24a34ab932163a1b87f52",
"73f706f4bdb94b54a337563840ce52b0",
},
Parcels = new List() {
Parcels.CreateParcelsParcelCreateRequest(
new ParcelCreateRequest() {
Extra = new ParcelExtra() {
Cod = new Cod() {
Amount = "5.5",
Currency = "USD",
PaymentMethod = PaymentMethod.Cash,
},
Insurance = new ParcelInsurance() {
Amount = "5.5",
Content = "Laptop",
Currency = "USD",
Provider = ParcelInsuranceProvider.Ups,
},
},
Metadata = "Customer ID 123456",
MassUnit = Shippo.Models.Components.WeightUnitEnum.Lb,
Weight = "1",
DistanceUnit = Shippo.Models.Components.DistanceUnitEnum.In,
Height = "1",
Length = "1",
Width = "1",
},
),
},
},
},
},
shippoApiVersion: "2018-02-08");
// handle response
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Components;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$response = $sdk->batches->addShipments(
batchId: '',
requestBody: [
new Components\BatchShipmentCreateRequest(
carrierAccount: 'a4391cd4ab974f478f55dc08b5c8e3b3',
metadata: 'SHIPMENT #1',
servicelevelToken: 'fedex_ground',
shipment: new Components\ShipmentCreateRequest(
extra: new Components\ShipmentExtra(
accountsReceivableCustomerAccount: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
appropriationNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
billOfLadingNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
cod: new Components\Cod(
amount: '5.5',
currency: 'USD',
paymentMethod: Components\PaymentMethod::Cash,
),
codNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
customerReference: new Components\CustomerReference(
refSort: 1,
),
dealerOrderNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
deptNumber: new Components\DepartmentNumber(
refSort: 3,
),
fdaProductCode: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
insurance: new Components\Insurance(
amount: '5.5',
currency: 'USD',
),
invoiceNumber: new Components\InvoiceNumber(
refSort: 2,
),
manifestNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
modelNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
partNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
poNumber: new Components\PoNumber(
refSort: 2,
),
productionCode: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
purchaseRequestNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
rmaNumber: new Components\RmaNumber(
refSort: 1,
),
salespersonNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
serialNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
storeNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
transactionReferenceNumber: new Components\UPSReferenceFields(
prefix: 'ABC',
value: 'value',
refSort: 1,
),
),
metadata: 'Customer ID 123456',
shipmentDate: '2021-03-22T12:00:00Z',
addressFrom: 'd799c2679e644279b59fe661ac8fa488',
addressReturn: new Components\AddressCreateRequest(
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,
),
addressTo: new Components\AddressCreateRequest(
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,
),
customsDeclaration: 'adcfdddf8ec64b84ad22772bce3ea37a',
carrierAccounts: [
'065a4a8c10d24a34ab932163a1b87f52',
'73f706f4bdb94b54a337563840ce52b0',
],
parcels: [
'',
],
),
),
],
shippoApiVersion: '2018-02-08'
);
if ($response->batch !== null) {
// handle response
}
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.components.AddressCreateRequest;
import com.goshippo.sdk.models.components.AddressFrom;
import com.goshippo.sdk.models.components.AddressReturn;
import com.goshippo.sdk.models.components.AddressTo;
import com.goshippo.sdk.models.components.BatchShipmentCreateRequest;
import com.goshippo.sdk.models.components.Cod;
import com.goshippo.sdk.models.components.CustomerReference;
import com.goshippo.sdk.models.components.DepartmentNumber;
import com.goshippo.sdk.models.components.DistanceUnitEnum;
import com.goshippo.sdk.models.components.Insurance;
import com.goshippo.sdk.models.components.InvoiceNumber;
import com.goshippo.sdk.models.components.ParcelCreateRequest;
import com.goshippo.sdk.models.components.ParcelExtra;
import com.goshippo.sdk.models.components.ParcelInsurance;
import com.goshippo.sdk.models.components.ParcelInsuranceProvider;
import com.goshippo.sdk.models.components.Parcels;
import com.goshippo.sdk.models.components.PaymentMethod;
import com.goshippo.sdk.models.components.PoNumber;
import com.goshippo.sdk.models.components.RmaNumber;
import com.goshippo.sdk.models.components.ShipmentCreateRequest;
import com.goshippo.sdk.models.components.ShipmentCreateRequestCustomsDeclaration;
import com.goshippo.sdk.models.components.ShipmentExtra;
import com.goshippo.sdk.models.components.UPSReferenceFields;
import com.goshippo.sdk.models.components.WeightUnitEnum;
import com.goshippo.sdk.models.operations.AddShipmentsToBatchResponse;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
AddShipmentsToBatchResponse res = sdk.batches().addShipments()
.batchId("")
.shippoApiVersion("2018-02-08")
.requestBody(List.of(
BatchShipmentCreateRequest.builder()
.shipment(ShipmentCreateRequest.builder()
.addressFrom(AddressFrom.of("d799c2679e644279b59fe661ac8fa488"))
.addressTo(AddressTo.of(AddressCreateRequest.builder()
.country("US")
.name("Shwan Ippotle")
.company("Shippo")
.street1("215 Clayton St.")
.street3("")
.streetNo("")
.city("San Francisco")
.state("CA")
.zip("94117")
.phone("+1 555 341 9393")
.email("shippotle@shippo.com")
.isResidential(true)
.metadata("Customer ID 123456")
.validate(true)
.build()))
.parcels(List.of(
Parcels.of(ParcelCreateRequest.builder()
.massUnit(WeightUnitEnum.LB)
.weight("1")
.distanceUnit(DistanceUnitEnum.IN)
.height("1")
.length("1")
.width("1")
.extra(ParcelExtra.builder()
.cod(Cod.builder()
.amount("5.5")
.currency("USD")
.paymentMethod(PaymentMethod.CASH)
.build())
.insurance(ParcelInsurance.builder()
.amount("5.5")
.content("Laptop")
.currency("USD")
.provider(ParcelInsuranceProvider.UPS)
.build())
.build())
.metadata("Customer ID 123456")
.build())))
.extra(ShipmentExtra.builder()
.accountsReceivableCustomerAccount(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.appropriationNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.billOfLadingNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.cod(Cod.builder()
.amount("5.5")
.currency("USD")
.paymentMethod(PaymentMethod.CASH)
.build())
.codNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.customerReference(CustomerReference.builder()
.refSort(1L)
.build())
.dealerOrderNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.deptNumber(DepartmentNumber.builder()
.refSort(3L)
.build())
.fdaProductCode(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.insurance(Insurance.builder()
.amount("5.5")
.currency("USD")
.build())
.invoiceNumber(InvoiceNumber.builder()
.refSort(2L)
.build())
.manifestNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.modelNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.partNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.poNumber(PoNumber.builder()
.refSort(2L)
.build())
.productionCode(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.purchaseRequestNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.rmaNumber(RmaNumber.builder()
.refSort(1L)
.build())
.salespersonNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.serialNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.storeNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.transactionReferenceNumber(UPSReferenceFields.builder()
.prefix("ABC")
.value("value")
.refSort(1L)
.build())
.build())
.metadata("Customer ID 123456")
.shipmentDate("2021-03-22T12:00:00Z")
.addressReturn(AddressReturn.of("d799c2679e644279b59fe661ac8fa488"))
.customsDeclaration(ShipmentCreateRequestCustomsDeclaration.of("adcfdddf8ec64b84ad22772bce3ea37a"))
.carrierAccounts(List.of(
"065a4a8c10d24a34ab932163a1b87f52",
"73f706f4bdb94b54a337563840ce52b0"))
.build())
.carrierAccount("a4391cd4ab974f478f55dc08b5c8e3b3")
.metadata("SHIPMENT #1")
.servicelevelToken("fedex_ground")
.build()))
.call();
if (res.batch().isPresent()) {
// handle response
}
}
}
x-speakeasy-name-override: addShipments
/batches/{BatchId}/purchase:
post:
description: |-
Purchases an existing batch with a status of `VALID`.
Once you send a POST request to the purchase endpoint the batch status will change to `PURCHASING`.
When all the shipments are purchased, the status will change to `PURCHASED` and you will receive a
`batch_purchased` webhook indicating that the batch has been purchased
operationId: PurchaseBatch
parameters:
- description: Object ID of the batch
in: path
name: BatchId
required: true
schema:
type: string
- $ref: '#/components/parameters/ShippoApiVersionHeader'
responses:
'202':
$ref: '#/components/responses/batchResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Purchase a batch
tags:
- Batches
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl -X POST https://api.goshippo.com/batches//purchase \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396"
- lang: python
label: Python
source: |-
import shippo
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.batches.purchase(batch_id='')
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.batches.purchase("");
// Handle the result
console.log(result)
}
run();
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.Batches.PurchaseAsync(
batchId: "",
shippoApiVersion: "2018-02-08");
// handle response
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$response = $sdk->batches->purchase(
batchId: '',
shippoApiVersion: '2018-02-08'
);
if ($response->batch !== null) {
// handle response
}
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.operations.PurchaseBatchResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
PurchaseBatchResponse res = sdk.batches().purchase()
.batchId("")
.shippoApiVersion("2018-02-08")
.call();
if (res.batch().isPresent()) {
// handle response
}
}
}
x-speakeasy-name-override: purchase
/batches/{BatchId}/remove_shipments:
post:
description: Removes shipments from an existing batch shipment.
operationId: RemoveShipmentsFromBatch
parameters:
- description: Object ID of the batch
in: path
name: BatchId
required: true
schema:
type: string
- $ref: '#/components/parameters/ShippoApiVersionHeader'
requestBody:
required: true
content:
application/json:
schema:
items:
type: string
type: array
description: Array of shipments object ids to remove from the batch
responses:
'200':
$ref: '#/components/responses/batchResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Remove shipments from a batch
tags:
- Batches
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl -X POST https://api.goshippo.com/batches//remove_shipments \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396" \
-H "Content-Type: application/json" \
-d '[
"aa7dea463a5a48b0b8fb21f90e72d779",
"f11b46440c144ce3b97fb5ddf02b8c71",
"5400f9078f764b1bbb121bcd08de127f",
"2ab2b452392545908d2cef8861a39c35"
]'
- lang: python
label: Python
source: |-
import shippo
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.batches.remove_shipments(batch_id='', request_body=[
'',
])
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.batches.removeShipments("", [
"",
]);
// Handle the result
console.log(result)
}
run();
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
using System.Collections.Generic;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.Batches.RemoveShipmentsAsync(
batchId: "",
requestBody: new List() {
"",
},
shippoApiVersion: "2018-02-08");
// handle response
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$response = $sdk->batches->removeShipments(
batchId: '',
requestBody: [
'',
],
shippoApiVersion: '2018-02-08'
);
if ($response->batch !== null) {
// handle response
}
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.operations.RemoveShipmentsFromBatchResponse;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
RemoveShipmentsFromBatchResponse res = sdk.batches().removeShipments()
.batchId("")
.shippoApiVersion("2018-02-08")
.requestBody(List.of(
""))
.call();
if (res.batch().isPresent()) {
// handle response
}
}
}
x-speakeasy-name-override: removeShipments
/carrier_accounts:
get:
description: |-
Returns a list of all carrier accounts connected to your Shippo account. These carrier accounts include both Shippo carrier accounts and your own carrier accounts that you have connected to your Shippo account.
Additionally, you can get information about the service levels associated with each carrier account by passing in the `?service_levels=true` query parameter.
Using it appends the property `service_levels` to each carrier account.
By default, if the query parameter is omitted, the `service_levels` property will not be included in the response.
operationId: ListCarrierAccounts
parameters:
- description: Appends the property `service_levels` to each returned carrier account
in: query
name: service_levels
required: false
schema:
type: boolean
- description: Filter the response by the specified carrier
in: query
name: carrier
required: false
schema:
$ref: '#/components/schemas/CarriersEnum'
- description: Filter the response by the specified carrier account Id
in: query
name: account_id
required: false
schema:
type: string
- $ref: '#/components/parameters/PageNumberQueryParam'
- $ref: '#/components/parameters/ResultsPerPageDefault5QueryParam'
- $ref: '#/components/parameters/ShippoApiVersionHeader'
responses:
'200':
$ref: '#/components/responses/carrierAccountPaginatedResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: List all carrier accounts
tags:
- Carrier Accounts
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/carrier_accounts?service_levels=true \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396"
- lang: python
label: Python
source: |-
import shippo
from shippo.models import operations
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.carrier_accounts.list(request=operations.ListCarrierAccountsRequest())
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.carrierAccounts.list({});
// Handle the result
console.log(result)
}
run();
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Operations;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$request = new Operations\ListCarrierAccountsRequest();
$response = $sdk->carrierAccounts->list(
request: $request
);
if ($response->carrierAccountPaginatedList !== null) {
// handle response
}
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
ListCarrierAccountsRequest req = new ListCarrierAccountsRequest() {};
var res = await sdk.CarrierAccounts.ListAsync(req);
// handle response
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.operations.ListCarrierAccountsRequest;
import com.goshippo.sdk.models.operations.ListCarrierAccountsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
ListCarrierAccountsRequest req = ListCarrierAccountsRequest.builder()
.build();
ListCarrierAccountsResponse res = sdk.carrierAccounts().list()
.request(req)
.call();
if (res.carrierAccountPaginatedList().isPresent()) {
// handle response
}
}
}
post:
description: Creates a new carrier account or connects an existing carrier account to the Shippo account.
operationId: CreateCarrierAccount
parameters:
- $ref: '#/components/parameters/ShippoApiVersionHeader'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ConnectExistingOwnAccountRequest'
description: Examples.
x-examples:
application/json:
fedex-existing-account-example:
summary: Connect an existing Fedex account to Shippo
value:
account_id: 321123
carrier: fedex
metadata: FedEx Account
parameters:
first_name: Hippo
from_address_city: San Francisco
from_address_country_iso2: US
from_address_st: 250 Union St
from_address_state: CA
from_address_zip: 94133
last_name: Hippovich
meter: 118599345
phone_number: 1112223333
smartpost_id: 5902
test: false
ups-existing-account-example:
summary: Connect an existing UPS account to Shippo
value:
account_id: 123456
active: true
carrier: ups
metadata: UPS Account
parameters:
account_number: 94567e
aia_country_iso2: US
billing_address_city: San Francisco
billing_address_country_iso2: US
billing_address_state: CA
billing_address_street1: 731 Market St
billing_address_street2: STE 200
billing_address_zip: 94103
collec_country_iso2: US
collec_zip: 94103
company: Shippo
currency_code: USD
email: hippo@shippo.com
full_name: Shippo Meister
has_invoice: false
invoice_controlid: 1234
invoice_date: 20210529
invoice_number: 1112234
invoice_value: 11.23
phone: 1112223333
title: Manager
ups_agreements: true
test: false
ups-new-account-example:
summary: Create a new UPS account
value:
account_id: 123456
active: true
carrier: ups
metadata: UPS Account
parameters:
billing_address_city: San Francisco
billing_address_country_iso2: US
billing_address_state: CA
billing_address_street1: 731 Market St
billing_address_street2: STE 200
billing_address_zip: 94103
company: Shippo
email: hippo@shippo.com
full_name: Shippo Meister
phone: 1112223333
pickup_address_city: San Francisco
pickup_address_country_iso2: US
pickup_address_same_as_billing_address: false
pickup_address_state: CA
pickup_address_street1: 731 Market St
pickup_address_street2: STE 200
pickup_address_zip: 94103
ups_agreements: true
test: false
responses:
'201':
$ref: '#/components/responses/carrierAccountResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Create a new carrier account
tags:
- Carrier Accounts
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl --location --request POST 'https://api.goshippo.com/carrier_accounts/' \
--header 'Authorization: ShippoToken {{token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"account_id": "string",
"active": true,
"carrier": "ups",
"metadata": "UPS Account",
"parameters": {
"billing_address_city": "San Francisco",
"billing_address_country_iso2": "US",
"billing_address_state": "CA",
"billing_address_street1": "731 Market St",
"billing_address_street2": "STE 200",
"billing_address_zip": "94103",
"company": "Shippo",
"email": "hippo@shippo.com",
"full_name": "Thorn Hall",
"phone": "1112223333",
"pickup_address_city": "San Francisco",
"pickup_address_country_iso2": "US",
"pickup_address_same_as_billing_address": false,
"pickup_address_state": "CA",
"pickup_address_street1": "731 Market St",
"pickup_address_street2": "STE 200",
"pickup_address_zip": "94103",
"ups_agreements": true
},
"test": false
}'
- lang: python
label: Python
source: |-
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.carrier_accounts.create(request=components.ConnectExistingOwnAccountRequest(
account_id='321123',
carrier='fedex',
metadata='FEDEX Account',
parameters=components.FedExConnectExistingOwnAccountParameters(
first_name='Jena',
last_name='Nienow',
phone_number='',
from_address_st='',
from_address_city='',
from_address_state='',
from_address_zip='',
from_address_country_iso2='',
),
test=False,
))
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.carrierAccounts.create({
accountId: "321123",
carrier: "fedex",
metadata: "FEDEX Account",
parameters: {
firstName: "Jena",
lastName: "Nienow",
phoneNumber: "",
fromAddressSt: "",
fromAddressCity: "",
fromAddressState: "",
fromAddressZip: "",
fromAddressCountryIso2: "",
},
test: false,
});
// Handle the result
console.log(result)
}
run();
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Components;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$connectExistingOwnAccountRequest = new Components\ConnectExistingOwnAccountRequest(
accountId: '321123',
carrier: 'fedex',
metadata: 'FEDEX Account',
parameters: new Components\FedExConnectExistingOwnAccountParameters(
firstName: 'Loyal',
lastName: 'Collier',
phoneNumber: '(890) 307-8579',
fromAddressSt: '',
fromAddressCity: '',
fromAddressState: '',
fromAddressZip: '',
fromAddressCountryIso2: '',
),
test: false,
);
$response = $sdk->carrierAccounts->create(
connectExistingOwnAccountRequest: $connectExistingOwnAccountRequest,
shippoApiVersion: '2018-02-08'
);
if ($response->carrierAccount !== null) {
// handle response
}
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.CarrierAccounts.CreateAsync(
connectExistingOwnAccountRequest: new ConnectExistingOwnAccountRequest() {
AccountId = "321123",
Carrier = "fedex",
Metadata = "FEDEX Account",
Parameters = ConnectExistingOwnAccountRequestParameters.CreateConnectExistingOwnAccountRequestParametersFedExConnectExistingOwnAccountParameters(
new FedExConnectExistingOwnAccountParameters() {
FirstName = "Jena",
LastName = "Nienow",
PhoneNumber = "",
FromAddressSt = "",
FromAddressCity = "",
FromAddressState = "",
FromAddressZip = "",
FromAddressCountryIso2 = "",
},
),
Test = false,
},
shippoApiVersion: "2018-02-08");
// handle response
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.components.ConnectExistingOwnAccountRequest;
import com.goshippo.sdk.models.components.ConnectExistingOwnAccountRequestParameters;
import com.goshippo.sdk.models.components.FedExConnectExistingOwnAccountParameters;
import com.goshippo.sdk.models.operations.CreateCarrierAccountResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
CreateCarrierAccountResponse res = sdk.carrierAccounts().create()
.shippoApiVersion("2018-02-08")
.connectExistingOwnAccountRequest(ConnectExistingOwnAccountRequest.builder()
.accountId("321123")
.carrier("fedex")
.parameters(ConnectExistingOwnAccountRequestParameters.of(FedExConnectExistingOwnAccountParameters.builder()
.firstName("Loyal")
.lastName("Collier")
.phoneNumber("(890) 307-8579")
.fromAddressSt("")
.fromAddressCity("")
.fromAddressState("")
.fromAddressZip("")
.fromAddressCountryIso2("")
.build()))
.metadata("FEDEX Account")
.test(false)
.build())
.call();
if (res.carrierAccount().isPresent()) {
// handle response
}
}
}
/carrier_accounts/{CarrierAccountId}:
get:
description: Returns an existing carrier account using an object ID.
operationId: GetCarrierAccount
parameters:
- description: Object ID of the carrier account
in: path
name: CarrierAccountId
required: true
schema:
type: string
- $ref: '#/components/parameters/ShippoApiVersionHeader'
responses:
'200':
$ref: '#/components/responses/carrierAccountResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Retrieve a carrier account
tags:
- Carrier Accounts
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/carrier_accounts/b741b99f95e841639b54272834bc478c \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396"
- lang: python
label: Python
source: |-
import shippo
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.carrier_accounts.get(carrier_account_id='')
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.carrierAccounts.get("");
// Handle the result
console.log(result)
}
run();
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$response = $sdk->carrierAccounts->get(
carrierAccountId: '',
shippoApiVersion: '2018-02-08'
);
if ($response->carrierAccount !== null) {
// handle response
}
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.CarrierAccounts.GetAsync(
carrierAccountId: "",
shippoApiVersion: "2018-02-08");
// handle response
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.operations.GetCarrierAccountResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
GetCarrierAccountResponse res = sdk.carrierAccounts().get()
.carrierAccountId("")
.shippoApiVersion("2018-02-08")
.call();
if (res.carrierAccount().isPresent()) {
// handle response
}
}
}
put:
description: Updates an existing carrier account object. The account_id and carrier can't be updated. This is because they form the unique identifier together.
operationId: UpdateCarrierAccount
parameters:
- description: Object ID of the carrier account
in: path
name: CarrierAccountId
required: true
schema:
type: string
- $ref: '#/components/parameters/ShippoApiVersionHeader'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CarrierAccountUpdateRequest'
description: Examples.
x-examples:
application/json:
update-carrier-account:
summary: Update a carrier account
value:
account_id: 123356
active: true
carrier: ups
parameters: {}
responses:
'200':
$ref: '#/components/responses/carrierAccountResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Update a carrier account
tags:
- Carrier Accounts
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/carrier_accounts/b741b99f95e841639b54272834bc478c/ \
-X PUT \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396" \
-d parameters='{
"meter": "123987"
}'
- lang: python
label: Python
source: |-
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.carrier_accounts.update(carrier_account_id='', carrier_account_base=components.CarrierAccountBase(
account_id='****',
carrier='usps',
parameters=components.UPSConnectExistingOwnAccountParameters(
account_number='94567e',
aia_country_iso2='US',
billing_address_city='San Francisco',
billing_address_country_iso2='US',
billing_address_state='CA',
billing_address_street1='731 Market St',
billing_address_street2='STE 200',
billing_address_zip='94103',
collec_country_iso2='US',
collec_zip='94103',
company='Shippo',
currency_code='USD',
email='hippo@shippo.com',
full_name='Shippo Meister',
has_invoice=False,
invoice_controlid='1234',
invoice_date='20210529',
invoice_number='1112234',
invoice_value='11.23',
phone='1112223333',
title='Manager',
ups_agreements=False,
),
))
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.carrierAccounts.update("", {
accountId: "****",
carrier: "usps",
parameters: {
accountNumber: "94567e",
aiaCountryIso2: "US",
billingAddressCity: "San Francisco",
billingAddressCountryIso2: "US",
billingAddressState: "CA",
billingAddressStreet1: "731 Market St",
billingAddressStreet2: "STE 200",
billingAddressZip: "94103",
collecCountryIso2: "US",
collecZip: "94103",
company: "Shippo",
currencyCode: "USD",
email: "hippo@shippo.com",
fullName: "Shippo Meister",
hasInvoice: false,
invoiceControlid: "1234",
invoiceDate: "20210529",
invoiceNumber: "1112234",
invoiceValue: "11.23",
phone: "1112223333",
title: "Manager",
upsAgreements: false,
},
});
// Handle the result
console.log(result)
}
run();
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Components;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$carrierAccountBase = new Components\CarrierAccountBase(
accountId: '****',
carrier: 'usps',
parameters: new Components\UPSConnectExistingOwnAccountParameters(
accountNumber: '94567e',
aiaCountryIso2: 'US',
billingAddressCity: 'San Francisco',
billingAddressCountryIso2: 'US',
billingAddressState: 'CA',
billingAddressStreet1: '731 Market St',
billingAddressStreet2: 'STE 200',
billingAddressZip: '94103',
collecCountryIso2: 'US',
collecZip: '94103',
company: 'Shippo',
currencyCode: 'USD',
email: 'hippo@shippo.com',
fullName: 'Shippo Meister',
hasInvoice: false,
invoiceControlid: '1234',
invoiceDate: '20210529',
invoiceNumber: '1112234',
invoiceValue: '11.23',
phone: '1112223333',
title: 'Manager',
upsAgreements: false,
),
);
$response = $sdk->carrierAccounts->update(
carrierAccountId: '',
shippoApiVersion: '2018-02-08',
carrierAccountBase: $carrierAccountBase
);
if ($response->carrierAccount !== null) {
// handle response
}
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.CarrierAccounts.UpdateAsync(
carrierAccountId: "",
shippoApiVersion: "2018-02-08",
carrierAccountBase: new CarrierAccountBase() {
AccountId = "****",
Carrier = "usps",
Parameters = CarrierAccountBaseParameters.CreateCarrierAccountBaseParametersUPSConnectExistingOwnAccountParameters(
new UPSConnectExistingOwnAccountParameters() {
AccountNumber = "94567e",
AiaCountryIso2 = "US",
BillingAddressCity = "San Francisco",
BillingAddressCountryIso2 = "US",
BillingAddressState = "CA",
BillingAddressStreet1 = "731 Market St",
BillingAddressStreet2 = "STE 200",
BillingAddressZip = "94103",
CollecCountryIso2 = "US",
CollecZip = "94103",
Company = "Shippo",
CurrencyCode = "USD",
Email = "hippo@shippo.com",
FullName = "Shippo Meister",
HasInvoice = false,
InvoiceControlid = "1234",
InvoiceDate = "20210529",
InvoiceNumber = "1112234",
InvoiceValue = "11.23",
Phone = "1112223333",
Title = "Manager",
UpsAgreements = false,
},
),
});
// handle response
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.components.CarrierAccountBase;
import com.goshippo.sdk.models.components.CarrierAccountBaseParameters;
import com.goshippo.sdk.models.components.UPSConnectExistingOwnAccountParameters;
import com.goshippo.sdk.models.operations.UpdateCarrierAccountResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
UpdateCarrierAccountResponse res = sdk.carrierAccounts().update()
.carrierAccountId("")
.shippoApiVersion("2018-02-08")
.carrierAccountBase(CarrierAccountBase.builder()
.accountId("****")
.carrier("usps")
.parameters(CarrierAccountBaseParameters.of(UPSConnectExistingOwnAccountParameters.builder()
.accountNumber("94567e")
.billingAddressCity("San Francisco")
.billingAddressCountryIso2("US")
.billingAddressState("CA")
.billingAddressStreet1("731 Market St")
.billingAddressZip("94103")
.collecCountryIso2("US")
.collecZip("94103")
.company("Shippo")
.email("hippo@shippo.com")
.fullName("Shippo Meister")
.hasInvoice(false)
.phone("1112223333")
.title("Manager")
.upsAgreements(false)
.aiaCountryIso2("US")
.billingAddressStreet2("STE 200")
.currencyCode("USD")
.invoiceControlid("1234")
.invoiceDate("20210529")
.invoiceNumber("1112234")
.invoiceValue("11.23")
.build()))
.build())
.call();
if (res.carrierAccount().isPresent()) {
// handle response
}
}
}
/carrier_accounts/{CarrierAccountObjectId}/signin/initiate:
get:
description: Used by client applications to setup or reconnect an existing carrier account with carriers that support OAuth 2.0
summary: Connect an existing carrier account using OAuth 2.0
operationId: InitiateOauth2Signin
parameters:
- description: The carrier account ID (UUID) to start a signin process.
in: path
name: CarrierAccountObjectId
required: true
schema:
type: string
- description: Callback URL. The URL that tells the authorization server where to send the user back to after they approve the request.
in: query
name: redirect_uri
required: true
schema:
type: string
format: uri
- description: A random string generated by the consuming application and included in the request to prevent CSRF attacks. The consuming application checks that the same value is returned after the user authorizes Shippo.
in: query
name: state
required: false
schema:
type: string
- $ref: '#/components/parameters/ShippoApiVersionHeader'
responses:
'302':
description: Redirects the browser to the carrier login page, with the needed parameters
headers:
Location:
description: Carrier login page URI, with the needed parameters set as query string
schema:
type: string
format: uri
example: https://www.ups.com/lasso/signin?client_id=testClientID&redirect_uri=https://client.example.com/cb&response_type=code&scope=read&type=ups_com_api
'400':
description: Invalid parameters provided by the user
content:
application/json:
schema:
properties:
title:
type: string
example: Missing required parameter
detail:
type: string
example: redirect_uri
'401':
description: Invalid ShippoToken or unsupported carrier account provided by the user
content:
application/json:
schema:
properties:
title:
type: string
example: Unsupported OAuth Carrier Account
detail:
type: string
example: The carrier account 3c49f998b1234a2097ea0911a7e95bea does not support OAuth authorization
'404':
description: Invalid carrier account provided by the user
content:
application/json:
schema:
properties:
title:
type: string
example: Carrier Account not found
detail:
type: string
example: 'Carrier Account not found for object_id: 3c49f998b1234a2097ea0911a7e95bea'
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl "https://api.goshippo.com/carrier_accounts/2ccf5af209bb484cb20190d9cadbb61c/signin/initiate?redirect_uri=https://client.example.com/cb&state=SplxlOBeZQQYbYS6WxSbIA" \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396"
- lang: python
label: Python
source: |-
import shippo
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.carrier_accounts.initiate_oauth2_signin(carrier_account_object_id='', redirect_uri='http://fine-cummerbund.biz', state='')
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.carrierAccounts.initiateOauth2Signin("", "http://fine-cummerbund.biz", "");
// Handle the result
console.log(result)
}
run();
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
InitiateOauth2SigninRequest req = new InitiateOauth2SigninRequest() {
CarrierAccountObjectId = "",
RedirectUri = "http://fine-cummerbund.biz",
};
var res = await sdk.CarrierAccounts.InitiateOauth2SigninAsync(req);
// handle response
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Operations;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$request = new Operations\InitiateOauth2SigninRequest(
carrierAccountObjectId: '',
redirectUri: 'https://enlightened-mortise.com/',
);
$response = $sdk->carrierAccounts->initiateOauth2Signin(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.errors.InitiateOauth2SigninCarrierAccountsResponseBody;
import com.goshippo.sdk.models.errors.InitiateOauth2SigninCarrierAccountsResponseResponseBody;
import com.goshippo.sdk.models.errors.InitiateOauth2SigninResponseBody;
import com.goshippo.sdk.models.operations.InitiateOauth2SigninResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws InitiateOauth2SigninResponseBody, InitiateOauth2SigninCarrierAccountsResponseResponseBody, InitiateOauth2SigninCarrierAccountsResponseBody, Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
InitiateOauth2SigninResponse res = sdk.carrierAccounts().initiateOauth2Signin()
.carrierAccountObjectId("")
.redirectUri("https://enlightened-mortise.com/")
.state("Louisiana")
.shippoApiVersion("2018-02-08")
.call();
// handle response
}
}
tags:
- Carrier Accounts
/carrier_accounts/register/new:
post:
description: Adds a Shippo carrier account
operationId: RegisterCarrierAccount
parameters:
- $ref: '#/components/parameters/ShippoApiVersionHeader'
requestBody:
required: true
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/CarrierAccountCanadaPostCreateRequest'
- $ref: '#/components/schemas/CarrierAccountChronopostCreateRequest'
- $ref: '#/components/schemas/CarrierAccountColissimoCreateRequest'
- $ref: '#/components/schemas/CarrierAccountCorreosCreateRequest'
- $ref: '#/components/schemas/CarrierAccountDeutschePostCreateRequest'
- $ref: '#/components/schemas/CarrierAccountDHLExpressCreateRequest'
- $ref: '#/components/schemas/CarrierAccountDpdDeCreateRequest'
- $ref: '#/components/schemas/CarrierAccountDPDUKCreateRequest'
- $ref: '#/components/schemas/CarrierAccountFedExCreateRequest'
- $ref: '#/components/schemas/CarrierAccountHermesUKCreateRequest'
- $ref: '#/components/schemas/CarrierAccountMondialRelayCreateRequest'
- $ref: '#/components/schemas/CarrierAccountPosteItalianeCreateRequest'
- $ref: '#/components/schemas/CarrierAccountUPSCreateRequest'
- $ref: '#/components/schemas/CarrierAccountUSPSCreateRequest'
- $ref: '#/components/schemas/CarrierAccountSendleCreateRequest'
description: Examples.
responses:
'201':
$ref: '#/components/responses/carrierAccountResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Add a Shippo carrier account
tags:
- Carrier Accounts
x-codeSamples:
- label: CLI
lang: cURL
source: |-
curl --location --request POST '/carrier_accounts/register/new' \
--header 'Authorization: ShippoToken {{token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"carrier": "canada_post",
"parameters": {
"company": "Shippo",
"full_name": "Shippo Meister",
"email": "hippo@shippo.com",
"phone": "1112221122",
"canada_post_terms": true
}
}'
- lang: python
label: Python
source: |-
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.carrier_accounts.register(request=components.CarrierAccountColissimoCreateRequest(
carrier='colissimo',
parameters=components.CarrierAccountColissimoCreateRequestParameters(),
))
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.carrierAccounts.register({
carrier: "colissimo",
parameters: {},
});
// Handle the result
console.log(result)
}
run();
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.CarrierAccounts.RegisterAsync(
requestBody: RegisterCarrierAccountRequestBody.CreateRegisterCarrierAccountRequestBodyCarrierAccountColissimoCreateRequest(
new CarrierAccountColissimoCreateRequest() {
Carrier = "colissimo",
Parameters = new CarrierAccountColissimoCreateRequestParameters() {},
},
),
shippoApiVersion: "2018-02-08");
// handle response
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Components;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$response = $sdk->carrierAccounts->register(
requestBody: new Components\CarrierAccountCorreosCreateRequest(
carrier: 'correos',
parameters: new Components\CarrierAccountCorreosCreateRequestParameters(),
),
shippoApiVersion: '2018-02-08'
);
if ($response->carrierAccount !== null) {
// handle response
}
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.components.CarrierAccountCorreosCreateRequest;
import com.goshippo.sdk.models.components.CarrierAccountCorreosCreateRequestParameters;
import com.goshippo.sdk.models.operations.RegisterCarrierAccountRequestBody;
import com.goshippo.sdk.models.operations.RegisterCarrierAccountResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
RegisterCarrierAccountResponse res = sdk.carrierAccounts().register()
.shippoApiVersion("2018-02-08")
.requestBody(RegisterCarrierAccountRequestBody.of(CarrierAccountCorreosCreateRequest.builder()
.carrier("correos")
.parameters(CarrierAccountCorreosCreateRequestParameters.builder()
.build())
.build()))
.call();
if (res.carrierAccount().isPresent()) {
// handle response
}
}
}
x-speakeasy-name-override: register
/carrier_accounts/reg-status:
get:
description: Returns the registration status for the given account for the given carrier
operationId: GetCarrierRegistrationStatus
parameters:
- in: query
description: filter by specific carrier
name: carrier
required: true
schema:
type: string
enum:
- ups
- usps
- canada_post
- $ref: '#/components/parameters/ShippoApiVersionHeader'
responses:
'200':
$ref: '#/components/responses/carrierAccountRegistrationStatusResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Get Carrier Registration status
tags:
- Carrier Accounts
x-speakeasy-name-override: getRegistrationStatus
x-codeSamples:
- lang: python
label: Python
source: |-
import shippo
from shippo.models import operations
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.carrier_accounts.get_registration_status(carrier=operations.Carrier.USPS)
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.carrierAccounts.getRegistrationStatus("usps");
// Handle the result
console.log(result)
}
run();
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.CarrierAccounts.GetRegistrationStatusAsync(
carrier: Shippo.Models.Requests.Carrier.Usps,
shippoApiVersion: "2018-02-08");
// handle response
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Operations;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$response = $sdk->carrierAccounts->getRegistrationStatus(
carrier: Operations\Carrier::Usps,
shippoApiVersion: '2018-02-08'
);
if ($response->carrierAccountRegistrationStatus !== null) {
// handle response
}
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.operations.Carrier;
import com.goshippo.sdk.models.operations.GetCarrierRegistrationStatusResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
GetCarrierRegistrationStatusResponse res = sdk.carrierAccounts().getRegistrationStatus()
.carrier(Carrier.USPS)
.shippoApiVersion("2018-02-08")
.call();
if (res.carrierAccountRegistrationStatus().isPresent()) {
// handle response
}
}
}
/customs/declarations:
get:
description: Returns a a list of all customs declaration objects
operationId: ListCustomsDeclarations
parameters:
- $ref: '#/components/parameters/PageNumberQueryParam'
- $ref: '#/components/parameters/ResultsPerPageDefault5QueryParam'
- $ref: '#/components/parameters/ShippoApiVersionHeader'
responses:
'200':
$ref: '#/components/responses/customsDeclarationPaginatedResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: List all customs declarations
tags:
- Customs Declarations
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/customs/declarations/ \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396"
- lang: python
label: Python
source: |-
import shippo
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.customs_declarations.list(page=1, results=5)
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.customsDeclarations.list(1, 5);
// Handle the result
console.log(result)
}
run();
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$response = $sdk->customsDeclarations->list(
page: 1,
results: 5,
shippoApiVersion: '2018-02-08'
);
if ($response->customsDeclarationPaginatedList !== null) {
// handle response
}
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.CustomsDeclarations.ListAsync(
page: 1,
results: 5,
shippoApiVersion: "2018-02-08");
// handle response
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.operations.ListCustomsDeclarationsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
ListCustomsDeclarationsResponse res = sdk.customsDeclarations().list()
.page(1L)
.results(5L)
.shippoApiVersion("2018-02-08")
.call();
if (res.customsDeclarationPaginatedList().isPresent()) {
// handle response
}
}
}
post:
description: Creates a new customs declaration object
operationId: CreateCustomsDeclaration
parameters:
- $ref: '#/components/parameters/ShippoApiVersionHeader'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CustomsDeclarationCreateRequest'
description: CustomsDeclaration details.
responses:
'201':
$ref: '#/components/responses/customsDeclarationResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Create a new customs declaration
tags:
- Customs Declarations
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/customs/declarations/ \
-H "Authorization: ShippoToken " \
-H "Content-Type: application/json" \
-d '{
"contents_type": "MERCHANDISE",
"non_delivery_option": "RETURN",
"certify": true,
"certify_signer": "Simon Kreuz",
"incoterm": "DDU",
"items": [{
"description": "T-shirt",
"quantity": 20,
"net_weight": "5",
"mass_unit": "lb",
"value_amount": "200",
"value_currency": "USD",
"tariff_number": "",
"origin_country": "US"
}]
}'
- lang: python
label: Python
source: |-
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.customs_declarations.create(request=components.CustomsDeclarationCreateRequest(
b13a_filing_option=components.CustomsDeclarationB13AFilingOptionEnum.FILED_ELECTRONICALLY,
certify=True,
certify_signer='Shawn Ippotle',
contents_explanation='T-Shirt purchase',
exporter_identification=components.CustomsExporterIdentification(
eori_number='PL123456790ABCDE',
tax_id=components.CustomsTaxIdentification(
number='123456789',
type=components.CustomsTaxIdentificationType.EIN,
),
),
invoice='#123123',
metadata='Order ID #123123',
address_importer=components.AddressImporter(
name='Shwan Ippotle',
company='Shippo',
street1='Blumenstraße',
street3='',
street_no='22',
city='München',
state='CA',
zip='80331',
country='DE',
phone='80331',
email='shippotle@shippo.com',
is_residential=True,
),
contents_type=components.CustomsDeclarationContentsTypeEnum.MERCHANDISE,
eel_pfc=components.CustomsDeclarationEelPfcEnum.NOEEI_30_37_A,
incoterm=components.CustomsDeclarationIncotermEnum.DDP,
items=[
components.CustomsItemCreateRequest(
description='T-Shirt',
mass_unit=components.WeightUnitEnum.LB,
metadata='Order ID "123454"',
net_weight='5',
origin_country='',
quantity=20,
sku_code='HM-123',
hs_code='0901.21',
value_amount='200',
value_currency='USD',
),
],
non_delivery_option=components.CustomsDeclarationNonDeliveryOptionEnum.RETURN,
test=True,
))
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.customsDeclarations.create({
b13aFilingOption: "FILED_ELECTRONICALLY",
certify: true,
certifySigner: "Shawn Ippotle",
contentsExplanation: "T-Shirt purchase",
exporterIdentification: {
eoriNumber: "PL123456790ABCDE",
taxId: {
number: "123456789",
type: "EIN",
},
},
invoice: "#123123",
metadata: "Order ID #123123",
addressImporter: {
name: "Shwan Ippotle",
company: "Shippo",
street1: "Blumenstraße",
street3: "",
streetNo: "22",
city: "München",
state: "CA",
zip: "80331",
country: "DE",
phone: "80331",
email: "shippotle@shippo.com",
isResidential: true,
},
contentsType: "MERCHANDISE",
eelPfc: "NOEEI_30_37_a",
incoterm: "DDP",
items: [
{
description: "T-Shirt",
massUnit: "lb",
metadata: "Order ID \"123454\"",
netWeight: "5",
originCountry: "",
quantity: 20,
skuCode: "HM-123",
hsCode: "0901.21",
valueAmount: "200",
valueCurrency: "USD",
},
],
nonDeliveryOption: "RETURN",
test: true,
});
// Handle the result
console.log(result)
}
run();
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Components;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$customsDeclarationCreateRequest = new Components\CustomsDeclarationCreateRequest(
b13aFilingOption: Components\CustomsDeclarationB13AFilingOptionEnum::FiledElectronically,
certify: true,
certifySigner: 'Shawn Ippotle',
contentsExplanation: 'T-Shirt purchase',
dutiesPayor: new Components\DutiesPayor(
account: '2323434543',
type: Components\CustomsDeclarationCreateRequestType::ThirdParty,
address: new Components\CustomsDeclarationCreateRequestAddress(
name: 'Patrick Kavanagh',
zip: '80331',
country: 'DE',
),
),
exporterIdentification: new Components\CustomsExporterIdentification(
eoriNumber: 'PL123456790ABCDE',
taxId: new Components\CustomsTaxIdentification(
number: '123456789',
type: Components\CustomsTaxIdentificationType::Ein,
),
),
invoice: '#123123',
metadata: 'Order ID #123123',
addressImporter: new Components\AddressImporter(
name: 'Shwan Ippotle',
company: 'Shippo',
street1: 'Blumenstraße',
street3: '',
streetNo: '22',
city: 'München',
state: 'CA',
zip: '80331',
country: 'DE',
phone: '80331',
email: 'shippotle@shippo.com',
isResidential: true,
),
contentsType: Components\CustomsDeclarationContentsTypeEnum::Merchandise,
eelPfc: Components\CustomsDeclarationEelPfcEnum::NOEEI3037A,
incoterm: Components\CustomsDeclarationIncotermEnum::Ddp,
items: [
new Components\CustomsItemCreateRequest(
description: 'T-Shirt',
massUnit: Components\WeightUnitEnum::Lb,
metadata: 'Order ID "123454"',
netWeight: '5',
originCountry: '',
quantity: 20,
skuCode: 'HM-123',
hsCode: '0901.21',
valueAmount: '200',
valueCurrency: 'USD',
),
],
nonDeliveryOption: Components\CustomsDeclarationNonDeliveryOptionEnum::Return,
test: true,
);
$response = $sdk->customsDeclarations->create(
customsDeclarationCreateRequest: $customsDeclarationCreateRequest,
shippoApiVersion: '2018-02-08'
);
if ($response->customsDeclaration !== null) {
// handle response
}
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
using System.Collections.Generic;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.CustomsDeclarations.CreateAsync(
customsDeclarationCreateRequest: new CustomsDeclarationCreateRequest() {
B13aFilingOption = CustomsDeclarationB13AFilingOptionEnum.FiledElectronically,
Certify = true,
CertifySigner = "Shawn Ippotle",
ContentsExplanation = "T-Shirt purchase",
ExporterIdentification = new CustomsExporterIdentification() {
EoriNumber = "PL123456790ABCDE",
TaxId = new CustomsTaxIdentification() {
Number = "123456789",
Type = CustomsTaxIdentificationType.Ein,
},
},
Invoice = "#123123",
Metadata = "Order ID #123123",
AddressImporter = new AddressImporter() {
Name = "Shwan Ippotle",
Company = "Shippo",
Street1 = "Blumenstraße",
Street3 = "",
StreetNo = "22",
City = "München",
State = "CA",
Zip = "80331",
Country = "DE",
Phone = "80331",
Email = "shippotle@shippo.com",
IsResidential = true,
},
ContentsType = Shippo.Models.Components.CustomsDeclarationContentsTypeEnum.Merchandise,
EelPfc = CustomsDeclarationEelPfcEnum.Noeei3037A,
Incoterm = CustomsDeclarationIncotermEnum.Ddp,
Items = new List() {
new CustomsItemCreateRequest() {
Description = "T-Shirt",
MassUnit = Shippo.Models.Components.WeightUnitEnum.Lb,
Metadata = "Order ID \"123454\"",
NetWeight = "5",
OriginCountry = "",
Quantity = 20,
SkuCode = "HM-123",
HsCode = "0901.21",
ValueAmount = "200",
ValueCurrency = "USD",
},
},
NonDeliveryOption = Shippo.Models.Components.CustomsDeclarationNonDeliveryOptionEnum.Return,
Test = true,
},
shippoApiVersion: "2018-02-08");
// handle response
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.components.AddressImporter;
import com.goshippo.sdk.models.components.CustomsDeclarationB13AFilingOptionEnum;
import com.goshippo.sdk.models.components.CustomsDeclarationContentsTypeEnum;
import com.goshippo.sdk.models.components.CustomsDeclarationCreateRequest;
import com.goshippo.sdk.models.components.CustomsDeclarationCreateRequestAddress;
import com.goshippo.sdk.models.components.CustomsDeclarationCreateRequestType;
import com.goshippo.sdk.models.components.CustomsDeclarationEelPfcEnum;
import com.goshippo.sdk.models.components.CustomsDeclarationIncotermEnum;
import com.goshippo.sdk.models.components.CustomsDeclarationNonDeliveryOptionEnum;
import com.goshippo.sdk.models.components.CustomsExporterIdentification;
import com.goshippo.sdk.models.components.CustomsItemCreateRequest;
import com.goshippo.sdk.models.components.CustomsTaxIdentification;
import com.goshippo.sdk.models.components.CustomsTaxIdentificationType;
import com.goshippo.sdk.models.components.DutiesPayor;
import com.goshippo.sdk.models.components.WeightUnitEnum;
import com.goshippo.sdk.models.operations.CreateCustomsDeclarationResponse;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
CreateCustomsDeclarationResponse res = sdk.customsDeclarations().create()
.shippoApiVersion("2018-02-08")
.customsDeclarationCreateRequest(CustomsDeclarationCreateRequest.builder()
.certify(true)
.certifySigner("Shawn Ippotle")
.contentsType(CustomsDeclarationContentsTypeEnum.MERCHANDISE)
.items(List.of(
CustomsItemCreateRequest.builder()
.description("T-Shirt")
.massUnit(WeightUnitEnum.LB)
.netWeight("5")
.originCountry("")
.quantity(20L)
.valueAmount("200")
.valueCurrency("USD")
.metadata("Order ID \"123454\"")
.skuCode("HM-123")
.hsCode("0901.21")
.build()))
.nonDeliveryOption(CustomsDeclarationNonDeliveryOptionEnum.RETURN)
.b13aFilingOption(CustomsDeclarationB13AFilingOptionEnum.FILED_ELECTRONICALLY)
.contentsExplanation("T-Shirt purchase")
.dutiesPayor(DutiesPayor.builder()
.account("2323434543")
.type(CustomsDeclarationCreateRequestType.THIRD_PARTY)
.address(CustomsDeclarationCreateRequestAddress.builder()
.name("Patrick Kavanagh")
.zip("80331")
.country("DE")
.build())
.build())
.exporterIdentification(CustomsExporterIdentification.builder()
.eoriNumber("PL123456790ABCDE")
.taxId(CustomsTaxIdentification.builder()
.number("123456789")
.type(CustomsTaxIdentificationType.EIN)
.build())
.build())
.invoice("#123123")
.metadata("Order ID #123123")
.addressImporter(AddressImporter.builder()
.name("Shwan Ippotle")
.company("Shippo")
.street1("Blumenstraße")
.street3("")
.streetNo("22")
.city("München")
.state("CA")
.zip("80331")
.country("DE")
.phone("80331")
.email("shippotle@shippo.com")
.isResidential(true)
.build())
.eelPfc(CustomsDeclarationEelPfcEnum.NOEEI3037_A)
.incoterm(CustomsDeclarationIncotermEnum.DDP)
.test(true)
.build())
.call();
if (res.customsDeclaration().isPresent()) {
// handle response
}
}
}
/customs/declarations/{CustomsDeclarationId}:
get:
description: Returns an existing customs declaration using an object ID
operationId: GetCustomsDeclaration
parameters:
- description: Object ID of the customs declaration
in: path
name: CustomsDeclarationId
required: true
schema:
type: string
- $ref: '#/components/parameters/PageNumberQueryParam'
- $ref: '#/components/parameters/ShippoApiVersionHeader'
responses:
'200':
$ref: '#/components/responses/customsDeclarationResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Retrieve a customs declaration
tags:
- Customs Declarations
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/customs/declarations/e2197a54da9d470480f4f8796cc419cb \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396"
- lang: python
label: Python
source: |-
import shippo
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.customs_declarations.get(customs_declaration_id='', page=1)
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.customsDeclarations.get("", 1);
// Handle the result
console.log(result)
}
run();
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$response = $sdk->customsDeclarations->get(
customsDeclarationId: '',
page: 1,
shippoApiVersion: '2018-02-08'
);
if ($response->customsDeclaration !== null) {
// handle response
}
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.CustomsDeclarations.GetAsync(
customsDeclarationId: "",
page: 1,
shippoApiVersion: "2018-02-08");
// handle response
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.operations.GetCustomsDeclarationResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
GetCustomsDeclarationResponse res = sdk.customsDeclarations().get()
.customsDeclarationId("")
.page(1L)
.shippoApiVersion("2018-02-08")
.call();
if (res.customsDeclaration().isPresent()) {
// handle response
}
}
}
/customs/items:
get:
description: Returns a list all customs items objects.
operationId: ListCustomsItems
parameters:
- $ref: '#/components/parameters/PageNumberQueryParam'
- $ref: '#/components/parameters/ResultsPerPageQueryParam'
- $ref: '#/components/parameters/ShippoApiVersionHeader'
responses:
'200':
$ref: '#/components/responses/customsItemPaginatedResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: List all customs items
tags:
- Customs Items
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/customs/items/ \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396"
- lang: python
label: Python
source: |-
import shippo
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.customs_items.list(page=1, results=25)
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.customsItems.list(1, 25);
// Handle the result
console.log(result)
}
run();
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$response = $sdk->customsItems->list(
page: 1,
results: 25,
shippoApiVersion: '2018-02-08'
);
if ($response->customsItemPaginatedList !== null) {
// handle response
}
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.CustomsItems.ListAsync(
page: 1,
results: 25,
shippoApiVersion: "2018-02-08");
// handle response
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.operations.ListCustomsItemsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
ListCustomsItemsResponse res = sdk.customsItems().list()
.page(1L)
.results(25L)
.shippoApiVersion("2018-02-08")
.call();
if (res.customsItemPaginatedList().isPresent()) {
// handle response
}
}
}
post:
description: Creates a new customs item object.
operationId: CreateCustomsItem
parameters:
- $ref: '#/components/parameters/ShippoApiVersionHeader'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CustomsItemCreateRequest'
description: CustomsItem details.
responses:
'201':
$ref: '#/components/responses/customsItemResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Create a new customs item
tags:
- Customs Items
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/customs/items/ \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396" \
-d description="T-Shirt" \
-d quantity=2 \
-d net_weight="400" \
-d mass_unit="g" \
-d value_amount="20" \
-d value_currency="USD" \
-d tariff_number="" \
-d origin_country="US" \
-d metadata="Order ID '123123'"
- lang: python
label: Python
source: |-
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.customs_items.create(request=components.CustomsItemCreateRequest(
description='T-Shirt',
mass_unit=components.WeightUnitEnum.LB,
metadata='Order ID "123454"',
net_weight='5',
origin_country='',
quantity=20,
sku_code='HM-123',
hs_code='0901.21',
value_amount='200',
value_currency='USD',
))
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.customsItems.create({
description: "T-Shirt",
massUnit: "lb",
metadata: "Order ID \"123454\"",
netWeight: "5",
originCountry: "",
quantity: 20,
skuCode: "HM-123",
hsCode: "0901.21",
valueAmount: "200",
valueCurrency: "USD",
});
// Handle the result
console.log(result)
}
run();
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Components;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$customsItemCreateRequest = new Components\CustomsItemCreateRequest(
description: 'T-Shirt',
massUnit: Components\WeightUnitEnum::Lb,
metadata: 'Order ID "123454"',
netWeight: '5',
originCountry: '',
quantity: 20,
skuCode: 'HM-123',
hsCode: '0901.21',
valueAmount: '200',
valueCurrency: 'USD',
);
$response = $sdk->customsItems->create(
customsItemCreateRequest: $customsItemCreateRequest,
shippoApiVersion: '2018-02-08'
);
if ($response->customsItem !== null) {
// handle response
}
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.CustomsItems.CreateAsync(
customsItemCreateRequest: new CustomsItemCreateRequest() {
Description = "T-Shirt",
MassUnit = Shippo.Models.Components.WeightUnitEnum.Lb,
Metadata = "Order ID \"123454\"",
NetWeight = "5",
OriginCountry = "",
Quantity = 20,
SkuCode = "HM-123",
HsCode = "0901.21",
ValueAmount = "200",
ValueCurrency = "USD",
},
shippoApiVersion: "2018-02-08");
// handle response
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.components.CustomsItemCreateRequest;
import com.goshippo.sdk.models.components.WeightUnitEnum;
import com.goshippo.sdk.models.operations.CreateCustomsItemResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
CreateCustomsItemResponse res = sdk.customsItems().create()
.shippoApiVersion("2018-02-08")
.customsItemCreateRequest(CustomsItemCreateRequest.builder()
.description("T-Shirt")
.massUnit(WeightUnitEnum.LB)
.netWeight("5")
.originCountry("")
.quantity(20L)
.valueAmount("200")
.valueCurrency("USD")
.metadata("Order ID \"123454\"")
.skuCode("HM-123")
.hsCode("0901.21")
.build())
.call();
if (res.customsItem().isPresent()) {
// handle response
}
}
}
/customs/items/{CustomsItemId}:
get:
description: Returns an existing customs item using an object ID
operationId: GetCustomsItem
parameters:
- description: Object ID of the customs item
in: path
name: CustomsItemId
required: true
schema:
type: string
- $ref: '#/components/parameters/PageNumberQueryParam'
- $ref: '#/components/parameters/ShippoApiVersionHeader'
responses:
'200':
$ref: '#/components/responses/customsItemResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Retrieve a customs item
tags:
- Customs Items
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/customs/items/55358464c7b740aca199b395536981bd \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396"
- lang: python
label: Python
source: |-
import shippo
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.customs_items.get(customs_item_id='', page=1)
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.customsItems.get("", 1);
// Handle the result
console.log(result)
}
run();
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$response = $sdk->customsItems->get(
customsItemId: '',
page: 1,
shippoApiVersion: '2018-02-08'
);
if ($response->customsItem !== null) {
// handle response
}
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.CustomsItems.GetAsync(
customsItemId: "",
page: 1,
shippoApiVersion: "2018-02-08");
// handle response
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.operations.GetCustomsItemResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
GetCustomsItemResponse res = sdk.customsItems().get()
.customsItemId("")
.page(1L)
.shippoApiVersion("2018-02-08")
.call();
if (res.customsItem().isPresent()) {
// handle response
}
}
}
/live-rates:
post:
description: |-
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.
operationId: CreateLiveRate
parameters:
- $ref: '#/components/parameters/ShippoApiVersionHeader'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/LiveRateCreateRequest'
description: Generate rates at checkout
responses:
'200':
$ref: '#/components/responses/liveRatePaginatedResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Generate a live rates request
tags:
- Rates at Checkout
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/live-rates \
-H "Authorization: ShippoToken " \
-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"
}
}'
- lang: python
label: Python
source: |-
import dateutil.parser
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.rates_at_checkout.create(request=components.LiveRateCreateRequest(
address_from='',
address_to='',
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
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.ratesAtCheckout.create({
addressFrom: "",
addressTo: "",
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();
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
using System.Collections.Generic;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.RatesAtCheckout.CreateAsync(
liveRateCreateRequest: new LiveRateCreateRequest() {
AddressFrom = LiveRateCreateRequestAddressFrom.CreateLiveRateCreateRequestAddressFromStr(
"",
),
AddressTo = LiveRateCreateRequestAddressTo.CreateLiveRateCreateRequestAddressToStr(
"",
),
LineItems = new List() {
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.CreateLiveRateCreateRequestParcelStr(
"5df144dca289442cv7a06",
),
},
shippoApiVersion: "2018-02-08");
// handle response
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Components;
use Shippo\API\Utils;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$liveRateCreateRequest = new Components\LiveRateCreateRequest(
addressFrom: '',
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
}
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.components.AddressCompleteCreateRequest;
import com.goshippo.sdk.models.components.LineItem;
import com.goshippo.sdk.models.components.LiveRateCreateRequest;
import com.goshippo.sdk.models.components.LiveRateCreateRequestAddressFrom;
import com.goshippo.sdk.models.components.LiveRateCreateRequestAddressTo;
import com.goshippo.sdk.models.components.LiveRateCreateRequestParcel;
import com.goshippo.sdk.models.components.WeightUnitEnum;
import com.goshippo.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 ")
.shippoApiVersion("2018-02-08")
.build();
CreateLiveRateResponse res = sdk.ratesAtCheckout().create()
.shippoApiVersion("2018-02-08")
.liveRateCreateRequest(LiveRateCreateRequest.builder()
.addressTo(LiveRateCreateRequestAddressTo.of(""))
.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(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()))
.parcel(LiveRateCreateRequestParcel.of("5df144dca289442cv7a06"))
.build())
.call();
if (res.liveRatePaginatedList().isPresent()) {
// handle response
}
}
}
/live-rates/settings/parcel-template:
get:
description: Retrieve and display the currently configured default parcel template for live rates.
operationId: GetDefaultParcelTemplate
parameters:
- $ref: '#/components/parameters/ShippoApiVersionHeader'
responses:
'200':
$ref: '#/components/responses/defaultParcelTemplateResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Show current default parcel template
tags:
- Rates at Checkout
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl https://api.goshippo.com/live-rates/settings/parcel-template \
-H "Authorization: ShippoToken " \
-H "Content-Type: application/json"
- lang: python
label: Python
source: |-
import shippo
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.rates_at_checkout.get_default_parcel_template()
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.ratesAtCheckout.getDefaultParcelTemplate();
// Handle the result
console.log(result)
}
run();
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.RatesAtCheckout.GetDefaultParcelTemplateAsync(shippoApiVersion: "2018-02-08");
// handle response
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$response = $sdk->ratesAtCheckout->getDefaultParcelTemplate(
shippoApiVersion: '2018-02-08'
);
if ($response->defaultParcelTemplate !== null) {
// handle response
}
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.operations.GetDefaultParcelTemplateResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
GetDefaultParcelTemplateResponse res = sdk.ratesAtCheckout().getDefaultParcelTemplate()
.shippoApiVersion("2018-02-08")
.call();
if (res.defaultParcelTemplate().isPresent()) {
// handle response
}
}
}
x-speakeasy-name-override: getDefaultParcelTemplate
put:
description: Update the currently configured default parcel template for live rates. The object_id in the request payload should identify the user parcel template to be the new default.
operationId: UpdateDefaultParcelTemplate
parameters:
- $ref: '#/components/parameters/ShippoApiVersionHeader'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DefaultParcelTemplateUpdateRequest'
responses:
'200':
$ref: '#/components/responses/defaultParcelTemplateResponse'
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Update default parcel template
tags:
- Rates at Checkout
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl -X PUT https://api.goshippo.com/live-rates/settings/parcel-template \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396" \
-d '
{
"object_id": "b958d3690bb04bb8b2986724872750f5"
}
'
- lang: python
label: Python
source: |-
import shippo
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
res = s.rates_at_checkout.update_default_parcel_template(object_id='b958d3690bb04bb8b2986724872750f5')
if res is not None:
# handle response
pass
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.ratesAtCheckout.updateDefaultParcelTemplate("b958d3690bb04bb8b2986724872750f5");
// Handle the result
console.log(result)
}
run();
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08");
var res = await sdk.RatesAtCheckout.UpdateDefaultParcelTemplateAsync(
shippoApiVersion: "2018-02-08",
defaultParcelTemplateUpdateRequest: new DefaultParcelTemplateUpdateRequest() {
ObjectId = "b958d3690bb04bb8b2986724872750f5",
});
// handle response
- lang: php
label: PHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Components;
$security = 'ShippoToken ';
$sdk = API\Shippo::builder()
->setShippoApiVersion('2018-02-08')
->setSecurity($security)->build();
$defaultParcelTemplateUpdateRequest = new Components\DefaultParcelTemplateUpdateRequest(
objectId: 'b958d3690bb04bb8b2986724872750f5',
);
$response = $sdk->ratesAtCheckout->updateDefaultParcelTemplate(
shippoApiVersion: '2018-02-08',
defaultParcelTemplateUpdateRequest: $defaultParcelTemplateUpdateRequest
);
if ($response->defaultParcelTemplate !== null) {
// handle response
}
- lang: java
label: Java
source: |-
package hello.world;
import com.goshippo.sdk.Shippo;
import com.goshippo.sdk.models.components.DefaultParcelTemplateUpdateRequest;
import com.goshippo.sdk.models.operations.UpdateDefaultParcelTemplateResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken ")
.shippoApiVersion("2018-02-08")
.build();
UpdateDefaultParcelTemplateResponse res = sdk.ratesAtCheckout().updateDefaultParcelTemplate()
.shippoApiVersion("2018-02-08")
.defaultParcelTemplateUpdateRequest(DefaultParcelTemplateUpdateRequest.builder()
.objectId("b958d3690bb04bb8b2986724872750f5")
.build())
.call();
if (res.defaultParcelTemplate().isPresent()) {
// handle response
}
}
}
x-speakeasy-name-override: updateDefaultParcelTemplate
delete:
description: Clears the currently configured default parcel template for live rates.
operationId: DeleteDefaultParcelTemplate
parameters:
- $ref: '#/components/parameters/ShippoApiVersionHeader'
responses:
'204':
description: The parcel template was successfully deleted.
'400':
$ref: '#/components/responses/badRequestResponse'
summary: Clear current default parcel template
tags:
- Rates at Checkout
x-codeSamples:
- label: cURL
lang: cURL
source: |-
curl -X DELETE https://api.goshippo.com/live-rates/settings/parcel-template \
-H "Authorization: ShippoToken shippo_test_3a47d23c032ca626fce863c48d0f93d63a394396" \
- lang: python
label: Python
source: |-
import shippo
s = shippo.Shippo(
api_key_header="ShippoToken ",
shippo_api_version='2018-02-08',
)
s.rates_at_checkout.delete_default_parcel_template()
# Use the SDK ...
- lang: typescript
label: Typescript
source: |-
import { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken ",
shippoApiVersion: "2018-02-08",
});
async function run() {
await shippo.ratesAtCheckout.deleteDefaultParcelTemplate();
}
run();
- lang: csharp
label: C#
source: |-
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken