(CarrierAccounts)
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.
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.
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
ListCarrierAccountsRequest req = new ListCarrierAccountsRequest() {};
var res = await sdk.CarrierAccounts.ListAsync(req);
// handle response
CarrierAccountPaginatedList
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Creates a new carrier account or connects an existing carrier account to the Shippo account.
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
using System.Collections.Generic;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.CarrierAccounts.CreateAsync(
connectExistingOwnAccountRequest: new ConnectExistingOwnAccountRequest() {
AccountId = "321123",
Carrier = "fedex",
Metadata = "FEDEX Account",
Parameters = ConnectExistingOwnAccountRequestParameters.CreateFedExConnectExistingOwnAccountParameters(
new FedExConnectExistingOwnAccountParameters() {
FirstName = "Loyal",
LastName = "Collier",
PhoneNumber = "(890) 307-8579",
FromAddressSt = "<value>",
FromAddressCity = "<value>",
FromAddressState = "<value>",
FromAddressZip = "<value>",
FromAddressCountryIso2 = "<value>",
}
),
Test = false,
},
shippoApiVersion: "2018-02-08"
);
// handle response
Parameter |
Type |
Required |
Description |
Example |
ConnectExistingOwnAccountRequest |
ConnectExistingOwnAccountRequest |
✔️ |
Examples. |
|
ShippoApiVersion |
string |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
CarrierAccount
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Returns an existing carrier account using an object ID.
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.CarrierAccounts.GetAsync(
carrierAccountId: "<id>",
shippoApiVersion: "2018-02-08"
);
// handle response
Parameter |
Type |
Required |
Description |
Example |
CarrierAccountId |
string |
✔️ |
Object ID of the carrier account |
|
ShippoApiVersion |
string |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
CarrierAccount
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Updates an existing carrier account object. The account_id and carrier can't be updated. This is because they form the unique identifier together.
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
using System.Collections.Generic;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.CarrierAccounts.UpdateAsync(
carrierAccountId: "<id>",
shippoApiVersion: "2018-02-08",
carrierAccountBase: new CarrierAccountBase() {
AccountId = "****",
Carrier = "usps",
Parameters = CarrierAccountBaseParameters.CreateUPSConnectExistingOwnAccountParameters(
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 = "[email protected]",
FullName = "Shippo Meister",
HasInvoice = false,
InvoiceControlid = "1234",
InvoiceDate = "20210529",
InvoiceNumber = "1112234",
InvoiceValue = "11.23",
Phone = "1112223333",
Title = "Manager",
UpsAgreements = false,
}
),
}
);
// handle response
Parameter |
Type |
Required |
Description |
Example |
CarrierAccountId |
string |
✔️ |
Object ID of the carrier account |
|
ShippoApiVersion |
string |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
CarrierAccountBase |
CarrierAccountBase |
➖ |
Examples. |
|
CarrierAccount
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Used by client applications to setup or reconnect an existing carrier account with carriers that support OAuth 2.0
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
InitiateOauth2SigninRequest req = new InitiateOauth2SigninRequest() {
CarrierAccountObjectId = "<id>",
RedirectUri = "https://enlightened-mortise.com/",
};
var res = await sdk.CarrierAccounts.InitiateOauth2SigninAsync(req);
// handle response
InitiateOauth2SigninResponse
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.InitiateOauth2SigninResponseBody |
400 |
application/json |
Shippo.Models.Errors.InitiateOauth2SigninCarrierAccountsResponseBody |
401 |
application/json |
Shippo.Models.Errors.InitiateOauth2SigninCarrierAccountsResponseResponseBody |
404 |
application/json |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Adds a Shippo carrier account
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.CarrierAccounts.RegisterAsync(
requestBody: RegisterCarrierAccountRequestBody.CreateCarrierAccountCorreosCreateRequest(
new CarrierAccountCorreosCreateRequest() {
Carrier = "correos",
Parameters = new CarrierAccountCorreosCreateRequestParameters() {},
}
),
shippoApiVersion: "2018-02-08"
);
// handle response
Parameter |
Type |
Required |
Description |
Example |
RequestBody |
RegisterCarrierAccountRequestBody |
✔️ |
Examples. |
|
ShippoApiVersion |
string |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
CarrierAccount
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Returns the registration status for the given account for the given carrier
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.CarrierAccounts.GetRegistrationStatusAsync(
carrier: Shippo.Models.Requests.Carrier.Usps,
shippoApiVersion: "2018-02-08"
);
// handle response
Parameter |
Type |
Required |
Description |
Example |
Carrier |
Carrier |
✔️ |
filter by specific carrier |
|
ShippoApiVersion |
string |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
CarrierAccountRegistrationStatus
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |