API Documentation

Authentication

Authentication and identification to the EasyPost API is done by providing an API Key on every request as your Basic Auth username (no password is required). EasyPost requires that all communication with the API is secured using TLS v1.2. Requests made over HTTP or without a proper API Key will fail.

EasyPost provides two types of API Key: Test and Production. You can test all EasyPost functionality using your Test key, for free, immediately after signing up.

You can manage your API Keys from your account.

Treat your API Keys as passwords—keep them secret. API Keys give full read/write access to your account, so they should not be included in public repositories, emails, client side code, etc. If yours gets leaked, you can disable it on the dashboard's API Keys Page.

EasyPost Objects

The EasyPost API consists of many object types. There are several attributes that are consistent across all objects:

  • id: Every EasyPost Object that can be created through the API has an id field that is used to refer to the object in other API calls. An id consists of a prefix based on the object type (e.g. Shipments have the prefix "shp_") followed by 32 hex characters. These id values may be used in many API endpoints to refer to an existing object rather than specifying the full object definition; for instance in Shipment creation, you may specify the to_address either with all fields (street1, city, zip, etc.) filled, or you may reuse an existing Address by specifying only the id field value as the matching Address's id, omitting all other fields.
  • object: Every first-class EasyPost object includes an object value. This can be useful for identifying the types of nested objects, or for cases like webhook Events which can contain many different types of result. For objects where there are many variant types, such as Fees, the object value represents the supertype, and the type represents the subtype for that object.
  • reference: Many API objects also have an optional reference field that may be assigned during creation. The reference values you assign may be used in place of id values in many API endpoints, but we recommend using the EasyPost-assigned id instead because ids are guaranteed to be unique within the system, while reference uniqueness is not enforced. If your system does not enforce uniqueness on the references you submit, this may result in the wrong one of many objects with the same reference being picked in EasyPost's handling of your API request.
  • created_at/updated_at: Most API objects also include values for created_at and updated_at. These two fields respectively specify the time the object in question was created and most recently updated. These datetime fields are formatted according to ISO 8601.

Errors

In the event of a client or server error, the response will contain the standard 4xx or 5xx respectively, accompanied by a well-formed JSON body describing the issue, e.g., a required field was omitted, a purchase failed, etc.

Each client library will encapsulate these errors and raise an exception, in addition to other exceptional cases, such as network failures. It is recommended to handle exceptions gracefully and to report any issues to support@easypost.com.

Full List of Error Codes

Error Object

attributetypespecification
codestringMachine readable description of the problem
messagestringHuman readable description of the problem
errorsFieldError arrayBreakdown of errors for specific fields in the request

FieldError Object

attributetypespecification
fieldstringField of the request that the error describes
messagestringHuman readable description of the problem

Common HTTP Status Codes

codereason-phrasedescription
200OKThe request was successful
201CreatedThe request was successful and one or more resources was created
400Bad RequestRequest not processed due to client error
401UnauthorizedAuthentication is required and has failed
402Payment RequiredLack of billing information or insufficient funds
404Not FoundThe requested resource could not be found
422Unprocessable EntityThe request was well-formed but unable to process the contained instructions

Addresses

Address objects are used to represent people, places, and organizations in a number of contexts. For example, a Shipment requires a to_address and from_address to accurately calculate rates and generate postage.

Additionally, EasyPost offers several verification tools that can be used to detect deliverability issues, correct minor errors in spelling/formatting, and determine if an Address is residential or not (which has a significant effect on Shipment rating for many carriers).

Address Object

attributetypespecification
idstringUnique identifier, begins with "adr_"
objectstring"Address"
modestringSet based on which api-key you used, either "test" or "production"
street1stringFirst line of the address
street2stringSecond line of the address
citystringCity the address is located in
statestringState or province the address is located in
zipstringZIP or postal code the address is located in
countrystringISO 3166 country code for the country the address is located in
residentialbooleanWhether or not this address would be considered residential
carrier_facilitystringThe specific designation for the address (only relevant if the address is a carrier facility)
namestringName of the person. Both name and company can be included
companystringName of the organization. Both name and company can be included
phonestringPhone number to reach the person or organization
emailstringEmail to reach the person or organization
federal_tax_idstringFederal tax identifier of the person or organization
state_tax_idstringState tax identifier of the person or organization
verificationsVerificationsThe result of any verifications requested

Verifications Object

attributetypespecification
zip4VerificationOnly applicable to US addresses - checks and sets the ZIP+4
deliveryVerificationChecks that the address is deliverable and makes minor corrections to spelling/format. US addresses will also have their "residential" status checked and set.

Verification Object

attributetypespecification
successbooleanThe success of the verification
errorsFieldError arrayAll errors that caused the verification to fail
detailsVerificationDetailsExtra data related to the verification

VerificationDetails Object

attributetypespecification
latitudenumberThe latitude
longitudenumberThe longitude
time_zoneTZ(string)The time zone the address is located in, IE: America/Los_Angeles

Address Verification by Country

Our address verification service supports 240+ countries. See our full listing to see which verification level is available for each country. We are constantly working to expand our coverage of addresses worldwide.

Full List of Countries & Levels

POST/addresses

Create and Verify Addresses

Depending on your use case an Address can be used in many different ways. Certain carriers allow rating between two zip codes, but full addresses are required to purchase postage. It is recommended to provide as much information as possible during creation and to reuse these objects whenever possible.

Address objects can also be created inline while creating another object, for example during Shipment Creation.

Verify an Address

Verifying an Address before you ship is a great way to reduce issues with delivery.

Creating a verified Address is as simple as providing verify or verify_strict in the parameters. If any of the strict verification checks fail, an error will be returned from the API. The example below demonstrates verifying delivery, which checks that the address is deliverable and sets its residential delivery indicator.

The most effective time to perform address verification is when your customer, or the person entering the delivery address, is present. When designing a shopping cart it is recommended to ask the shopper for their address and verify it on the spot. If verification fails, ask them to double check their input; if they confirm that their data is correct, assume they know their address more correctly than the verification process.

Create Address Request Parameters
paramexampleinfo
street1417 Montgomery StFirst line of the address
street2Floor 5Second line of the address
citySan FranciscoFull city name
stateCAState or province
zip94104ZIP or postal code
countryUSISO 3166 country code for the country the address is located in
nameHiro ProtagonistName of attention, if person. Both name and company can be included
companyEasyPostName of attention, if organization. Both name and company can be included
phone415-123-4567Phone number to reach the person or organization
emailexample@example.comEmail to reach the person or organization
residentialfalseResidential delivery indicator
carrier_facilityONDCThe specific designation for the address (only relevant if the address is a carrier facility)
federal_tax_id1234567890Federal tax identifier of the person or organization
state_tax_id9876543210State tax identifier of the person or organization
verifytrueInclude to perform verifications on delivery and zip code. verify_strict takes precedence if also included.
verify_stricttrueInclude to perform strict verifications on delivery and zip code. The failure of any of these verifications causes the whole request to fail.
Create Address Example
import com.easypost.EasyPost;
import com.easypost.exception.EasyPostException;

EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";

Map<String, Object> addressHash = new HashMap<String, Object>();

addressHash.put("street1", "417 Montgomery Street");
addressHash.put("street2", "5th Floor");
addressHash.put("city", "SF");
addressHash.put("state", "CA");
addressHash.put("zip", "94104");
addressHash.put("country", "US");
addressHash.put("company", "EasyPost");
addressHash.put("phone", "415-123-4567");

Address address = Address.create(addressHash);

System.out.println(address.getId());
// adr_...
{
  "id": "adr_...",
  "object": "Address",
  "mode": "test",
  "created_at": "2015-12-21T21:33:51Z",
  "updated_at": "2015-12-21T21:33:51Z",
  "street1": "417 MONTGOMERY ST",
  "street2": "FLOOR 5",
  "city": "SAN FRANCISCO",
  "state": "CA",
  "zip": "94104",
  "country": "US",
  "residential": null,
  "carrier_facility": null,
  "name": null,
  "company": "EasyPost",
  "phone": "4151234567",
  "email": null,
  "federal_tax_id": null,
  "state_tax_id": null,
  "verifications": {}
}
import com.easypost.EasyPost;
import com.easypost.exception.EasyPostException;

EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";

Map<String, Object> addressHash = new HashMap<String, Object>();

addressHash.put("street1", "417 Montgomery Street");
addressHash.put("street2", "5th Floor");
addressHash.put("city", "SF");
addressHash.put("state", "CA");
addressHash.put("zip", "94104");
addressHash.put("country", "US");
addressHash.put("company", "EasyPost");
addressHash.put("phone", "415-123-4567");

Address verifiedAddress = Address.createAndVerify(addressHash);
{
  "address": {
    "id": "adr_...",
    "object": "Address",
    "created_at": "2022-04-20T21:09:40+00:00",
    "updated_at": "2022-04-20T21:09:40+00:00",
    "name": null,
    "company": "EASYPOST",
    "street1": "417 MONTGOMERY ST FL 5",
    "street2": "",
    "city": "SAN FRANCISCO",
    "state": "CA",
    "zip": "94104-1129",
    "country": "US",
    "phone": "4151234567",
    "email": null,
    "mode": "test",
    "carrier_facility": null,
    "residential": false,
    "federal_tax_id": null,
    "state_tax_id": null,
    "verifications": {
      "zip4": {
        "success": true,
        "errors": [
          {
            "code": "E.SECONDARY_INFORMATION.INVALID",
            "field": "street2",
            "message": "Invalid secondary information(Apt/Suite#)",
            "suggestion": null
          }
        ],
        "details": null
      },
      "delivery": {
        "success": true,
        "errors": [
          {
            "code": "E.SECONDARY_INFORMATION.INVALID",
            "field": "street2",
            "message": "Invalid secondary information(Apt/Suite#)",
            "suggestion": null
          }
        ],
        "details": {
          "latitude": 37.79342,
          "longitude": -122.40288,
          "time_zone": "America/Los_Angeles"
        }
      }
    }
  }
}
import com.easypost.EasyPost;
import com.easypost.exception.EasyPostException;

EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";

Map<String, Object> addressHash = new HashMap<String, Object>();

addressHash.put("street1", "417 montgomery streat"); // street1 will get cleaned up
addressHash.put("street2", "5");
addressHash.put("city", "SF");
addressHash.put("state", "CA");
addressHash.put("zip", "94104");
addressHash.put("country", "US");
addressHash.put("company", "EasyPost");
addressHash.put("phone", "415-123-4567");
addressHash.put("verify", true);

// This address will be verified
Address address = Address.create(addressHash);

System.out.println(address.getStreet1());
// 118 MONTGOMERY ST FL 5
{
  "id": "adr_...",
  "object": "Address",
  "created_at": "2017-05-08T19:31:54Z",
  "updated_at": "2017-05-08T19:31:54Z",
  "name": null,
  "company": "EASYPOST",
  "street1": "417 MONTGOMERY ST STE 500",
  "street2": "",
  "city": "SAN FRANCISCO",
  "state": "CA",
  "zip": "94104-1100",
  "country": "US",
  "phone": "4151234567",
  "email": null,
  "mode": "test",
  "carrier_facility": null,
  "residential": false,
  "federal_tax_id": null,
  "state_tax_id": null,
  "verifications": {
    "delivery": {
      "success": true,
      "errors": [],
      "details": {
        "longitude": -122.40288,
        "latitude": 37.79298,
        "time_zone": "America/Los_Angeles"
      }
    }
  }
}
import com.easypost.EasyPost;
import com.easypost.exception.EasyPostException;

EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";

Map<String, Object> addressHash = new HashMap<String, Object>();

addressHash.put("street1", "UNDELIEVRABLE ST");
addressHash.put("city", "SF");
addressHash.put("state", "CA");
addressHash.put("zip", "94104");
addressHash.put("country", "US");
addressHash.put("company", "EasyPost");
addressHash.put("phone", "415-123-4567");
addressHash.put("verify", true);

// This address will not be verified
Address address = Address.create(addressHash);

System.out.println(address.getVerifications());
// {delivery=com.easypost.model.AddressVerification@4cf4d529}
{
  "id": "adr_...",
  "object": "Address",
  "created_at": "2017-05-08T19:43:41Z",
  "updated_at": "2017-05-08T19:43:41Z",
  "name": null,
  "company": "EasyPost",
  "street1": "UNDELIVERABLE ST",
  "street2": null,
  "city": "SAN FRANCISCO",
  "state": "CA",
  "zip": "94104",
  "country": "US",
  "phone": "4151234567",
  "email": null,
  "mode": "test",
  "carrier_facility": null,
  "residential": false,
  "federal_tax_id": null,
  "state_tax_id": null,
  "verifications": {
    "delivery": {
      "success": false,
      "errors": [
        {
          "suggestion": null,
          "code": "E.ADDRESS.NOT_FOUND",
          "field": "address",
          "message": "Address not found"
        },
        {
          "suggestion": null,
          "code": "E.HOUSE_NUMBER.MISSING",
          "field": "street1",
          "message": "House number is missing"
        }
      ],
      "details": {}
    }
  }
}
import com.easypost.EasyPost;
import com.easypost.exception.EasyPostException;

EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";

Map<String, Object> addressHash = new HashMap<String, Object>();

addressHash.put("street1", "UNDELIEVRABLE ST");
addressHash.put("city", "SF");
addressHash.put("state", "CA");
addressHash.put("zip", "94104");
addressHash.put("country", "US");
addressHash.put("company", "EasyPost");
addressHash.put("phone", "415-123-4567");
addressHash.put("verify_strict", true);


try {
  // This request will result in an error
  Address address = Address.create(addressHash);
}
catch (com.easypost.exception.EasyPostException e) {
  System.out.println(e.getMessage());
  // Response code: 400 Response body: {"error":{"code":"ADDRESS.VERIFY.FAILURE","message":"Address not found","errors":[]}}
}
{
  "error": {
    "code": "ADDRESS.VERIFY.FAILURE",
    "message": "Unable to verify address.",
    "errors": [
      {
        "suggestion": null,
        "code": "E.ADDRESS.NOT_FOUND",
        "field": "address",
        "message": "Address not found"
      },
      {
        "suggestion": null,
        "code": "E.HOUSE_NUMBER.MISSING",
        "field": "street1",
        "message": "House number is missing"
      }
    ]
  }
}
import com.easypost.EasyPost;
import com.easypost.exception.EasyPostException;

EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";

Map<String, Object> addressHash = new HashMap<String, Object>();

addressHash.put("street1", "417 montgomery streat");
addressHash.put("street2", "5");
addressHash.put("city", "SF");
addressHash.put("state", "CA");
addressHash.put("zip", "94104");
addressHash.put("country", "US");
addressHash.put("company", "EasyPost");
addressHash.put("phone", "415-123-4567");

Address address = Address.create(addressHash);
// Verify an already created address.
verifiedAddress = address.verify();
{
  "id": "adr_...",
  "object": "Address",
  "created_at": "2017-05-08T19:31:54Z",
  "updated_at": "2017-05-08T19:31:54Z",
  "name": null,
  "company": "EASYPOST",
  "street1": "417 MONTGOMERY ST STE 500",
  "street2": "",
  "city": "SAN FRANCISCO",
  "state": "CA",
  "zip": "94104-1100",
  "country": "US",
  "phone": "4151234567",
  "email": null,
  "mode": "test",
  "carrier_facility": null,
  "residential": false,
  "federal_tax_id": null,
  "state_tax_id": null,
  "verifications": {
    "zip4": {
      "success": true,
      "errors": [],
      "details": null
    },
    "delivery": {
      "success": true,
      "errors": [],
      "details": {
        "longitude": -122.40288,
        "latitude": 37.79298,
        "time_zone": "America/Los_Angeles"
      }
    }
  }
}
GET/addresses

Retrieve a list of Addresses

The Address List is a paginated list of all Address objects associated with the given API Key. It accepts a variety of parameters which can be used to modify the scope. The has_more attribute indicates whether or not additional pages can be requested.

Retrieve a list of Addresses Request Parameters
paramexampleinfo
page_size30The number of records to return on each page. The maximum value is 100, and default is 20.
Retrieve a list of Address Example
import com.easypost.EasyPost;
import com.easypost.exception.EasyPostException;

EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";

Map<String, Object> params = new HashMap<>();

list_params.put("page_size", 5);

AddressCollection addresses = Address.all(list_params);
{
   "addresses": [
      {
         "id": "adr_...",
         "object": "Address",
         "created_at": "2022-04-04T18:09:55+00:00",
         "updated_at": "2022-04-04T18:09:55+00:00",
         "name": "Jack Sparrow",
         "company": "EasyPost",
         "street1": "388 Townsend St",
         "street2": "Apt 20",
         "city": "San Francisco",
         "state": "CA",
         "zip": "94107",
         "country": "US",
         "phone": "5555555555",
         "email": null,
         "mode": "test",
         "carrier_facility": null,
         "residential": null,
         "federal_tax_id": null,
         "state_tax_id": null,
         "verifications": {}
      }
   ],
   "has_more": true
}
GET/addresses/:id

Retrieve an Address

An Address can be retrieved by its id.

Retrieve Address Example
import com.easypost.EasyPost;
import com.easypost.exception.EasyPostException;

EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";

Address address = Address.retrieve("adr_...");
{
  "id": "adr_...",
  "object": "Address",
  "mode": "test",
  "created_at": "2015-12-21T21:33:51Z",
  "updated_at": "2015-12-21T21:33:51Z",
  "street1": "417 MONTGOMERY ST",
  "street2": "FLOOR 5",
  "city": "SAN FRANCISCO",
  "state": "CA",
  "zip": "94104",
  "country": "US",
  "residential": null,
  "carrier_facility": null,
  "name": null,
  "company": "EasyPost",
  "phone": "4151234567",
  "email": null,
  "federal_tax_id": null,
  "state_tax_id": null,
  "verifications": {}
}

Parcels

Parcel objects represent the physical container being shipped. Dimensions can be supplied either as length, width, and height dimensions, or a predefined_package string. Only weight is required, but since many carriers charge different rates for packages with large dimensions, we strongly recommend including all dimensions if available.

Weights are in OUNCES (OZ) and go to one decimal point.

Dimensions are in INCHES (IN) and go to one decimal point.

Parcel Object

attributetypespecification
idstringUnique, begins with "prcl_"
objectstring"Parcel"
modestring"test" or "production"
lengthfloat (inches)Required if width and/or height are present
widthfloat (inches)Required if length and/or height are present
heightfloat (inches)Required if length and/or width are present
predefined_packagestringOptional, one of our predefined_packages
weightfloat (oz)Always required
created_atdatetime
updated_atdatetime

Predefined Packages

If you provide a predefined_package the associated Shipment will fetch rates from carriers for which that is a valid predefined_package. Some carriers share predefined_package names. If you wish to restrict your rating to a specific carrier, we recommend passing the carrier_accounts field when creating a Shipment.

For most predefined_packages it is not necessary to specify parcel dimensions, only weight.

AmazonMws

No predefined packages for AmazonMws.

    APC

    No predefined packages for APC.

      Asendia

      No predefined packages for Asendia.

        Asendia USA

        No predefined packages for Asendia USA.

          Australia Post

          No predefined packages for Australia Post.

            AxlehireV3

            No predefined packages for AxlehireV3.

              Better Trucks

              No predefined packages for Better Trucks.

                Bond

                No predefined packages for Bond.

                  Canada Post

                  No predefined packages for Canada Post.

                    Canpar

                    No predefined packages for Canpar.

                      CDL Last Mile Solutions

                      No predefined packages for CDL Last Mile Solutions.

                        Chronopost

                        No predefined packages for Chronopost.

                          CloudSort

                          No predefined packages for CloudSort.

                            Courier Express

                            No predefined packages for Courier Express.

                              CouriersPlease

                              No predefined packages for CouriersPlease.

                                Dai Post

                                No predefined packages for Dai Post.

                                  Deutsche Post

                                  No predefined packages for Deutsche Post.

                                    Deutsche Post UK

                                    No predefined packages for Deutsche Post UK.

                                      DHL eCommerce Asia

                                      No predefined packages for DHL eCommerce Asia.

                                        DHL eCommerce Solutions

                                        No predefined packages for DHL eCommerce Solutions.

                                          DHL Express
                                          • JumboDocument
                                          • JumboParcel
                                          • Document
                                          • DHLFlyer
                                          • Domestic
                                          • ExpressDocument
                                          • DHLExpressEnvelope
                                          • JumboBox
                                          • JumboJuniorDocument
                                          • JuniorJumboBox
                                          • JumboJuniorParcel
                                          • OtherDHLPackaging
                                          • Parcel
                                          • YourPackaging
                                          DPD

                                          No predefined packages for DPD.

                                            DPD UK
                                            • Parcel
                                            • Pallet
                                            • ExpressPak
                                            • FreightParcel
                                            • Freight
                                            ePost Global

                                            No predefined packages for ePost Global.

                                              Estafeta
                                              • ENVELOPE
                                              • PARCEL
                                              Evri

                                              No predefined packages for Evri.

                                                Fastway
                                                • Parcel
                                                • A2 (Satchel)
                                                • A3 (Satchel)
                                                • A4 (Satchel, not available in Australia)
                                                • A5 (Satchel, not available in South Africa)
                                                • BOXSML
                                                • BOXMED
                                                • BOXLRG
                                                FedEx
                                                • FedExEnvelope
                                                • FedExBox
                                                • FedExPak
                                                • FedExTube
                                                • FedEx10kgBox
                                                • FedEx25kgBox
                                                • FedExSmallBox
                                                • FedExMediumBox
                                                • FedExLargeBox
                                                • FedExExtraLargeBox
                                                FedEx Cross Border

                                                No predefined packages for FedEx Cross Border.

                                                  FedEx Mailview

                                                  No predefined packages for FedEx Mailview.

                                                    FedEx SameDay City

                                                    No predefined packages for FedEx SameDay City.

                                                      FedEx SmartPost

                                                      No predefined packages for FedEx SmartPost.

                                                        FirstMile

                                                        No predefined packages for FirstMile.

                                                          Globegistics

                                                          No predefined packages for Globegistics.

                                                            GSO

                                                            No predefined packages for GSO.

                                                              Interlink Express
                                                              • Parcel
                                                              • Pallet
                                                              • ExpressPak
                                                              • FreightParcel
                                                              • Freight
                                                              JP Post

                                                              No predefined packages for JP Post.

                                                                Kuroneko Yamato

                                                                No predefined packages for Kuroneko Yamato.

                                                                  La Poste

                                                                  No predefined packages for La Poste.

                                                                    LaserShip
                                                                    • Envelope
                                                                    • Custom
                                                                    Loomis Express

                                                                    No predefined packages for Loomis Express.

                                                                      LSO

                                                                      No predefined packages for LSO.

                                                                        Newgistics

                                                                        No predefined packages for Newgistics.

                                                                          OnTrac
                                                                          • Letter
                                                                          Osm Worldwide

                                                                          No predefined packages for Osm Worldwide.

                                                                            Parcelforce

                                                                            No predefined packages for Parcelforce.

                                                                              PARCLL

                                                                              No predefined packages for PARCLL.

                                                                                Passport

                                                                                No predefined packages for Passport.

                                                                                  PostNL

                                                                                  No predefined packages for PostNL.

                                                                                    Purolator
                                                                                    • CustomerPackaging
                                                                                    • ExpressPack
                                                                                    • ExpressBox
                                                                                    • ExpressEnvelope
                                                                                    Royal Mail
                                                                                    • Letter
                                                                                    • LargeLetter
                                                                                    • SmallParcel
                                                                                    • MediumParcel
                                                                                    • Parcel (for use with RoyalMail24 or RoyalMail48)
                                                                                    SEKO OmniParcel
                                                                                    • Bag
                                                                                    • Box
                                                                                    • Carton
                                                                                    • Container
                                                                                    • Crate
                                                                                    • Envelope
                                                                                    • Pail
                                                                                    • Pallet
                                                                                    • Satchel
                                                                                    • Tub
                                                                                    Sendle

                                                                                    No predefined packages for Sendle.

                                                                                      SF Express

                                                                                      No predefined packages for SF Express.

                                                                                        Spee-Dee

                                                                                        No predefined packages for Spee-Dee.

                                                                                          StarTrack
                                                                                          • Carton
                                                                                          • Pallet
                                                                                          • Satchel
                                                                                          • Bag
                                                                                          • Envelope
                                                                                          • Item
                                                                                          • Jiffybag
                                                                                          • Skid
                                                                                          Swyft

                                                                                          No predefined packages for Swyft.

                                                                                            TForce Logistics

                                                                                            No predefined packages for TForce Logistics.

                                                                                              UDS

                                                                                              No predefined packages for UDS.

                                                                                                UPS
                                                                                                • UPSLetter
                                                                                                • UPSExpressBox
                                                                                                • UPS25kgBox
                                                                                                • UPS10kgBox
                                                                                                • Tube
                                                                                                • Pak
                                                                                                • SmallExpressBox
                                                                                                • MediumExpressBox
                                                                                                • LargeExpressBox
                                                                                                UPS i-parcel

                                                                                                No predefined packages for UPS i-parcel.

                                                                                                  UPS Mail Innovations

                                                                                                  No predefined packages for UPS Mail Innovations.

                                                                                                    USPS

                                                                                                    USPS Flat Rate MappingUSPS Package Restrictions

                                                                                                    • Card
                                                                                                    • Letter
                                                                                                    • Flat
                                                                                                    • FlatRateEnvelope
                                                                                                    • FlatRateLegalEnvelope
                                                                                                    • FlatRatePaddedEnvelope
                                                                                                    • FlatRateGiftCardEnvelope
                                                                                                    • FlatRateWindowEnvelope
                                                                                                    • FlatRateCardboardEnvelope
                                                                                                    • SmallFlatRateEnvelope
                                                                                                    • Parcel
                                                                                                    • LargeParcel
                                                                                                    • SoftPack
                                                                                                    • SmallFlatRateBox
                                                                                                    • MediumFlatRateBox
                                                                                                    • LargeFlatRateBox
                                                                                                    • LargeFlatRateBoxAPOFPO
                                                                                                    • LargeFlatRateBoardGameBox
                                                                                                    • RegionalRateBoxA
                                                                                                    • RegionalRateBoxB
                                                                                                    • FlatTubTrayBox
                                                                                                    • EMMTrayBox
                                                                                                    • FullTrayBox
                                                                                                    • HalfTrayBox
                                                                                                    • PMODSack
                                                                                                    Veho

                                                                                                    No predefined packages for Veho.

                                                                                                      XDelivery

                                                                                                      No predefined packages for XDelivery.

                                                                                                        Yanwen

                                                                                                        No predefined packages for Yanwen.

                                                                                                          POST/parcels

                                                                                                          Create a Parcel

                                                                                                          Include the weight, and either a predefined_package or length, width and height if applicable.

                                                                                                          Create Parcel Request Parameters
                                                                                                          paramexample
                                                                                                          length20.2
                                                                                                          width10.9
                                                                                                          height5
                                                                                                          weight65.9
                                                                                                          Create Parcel Example
                                                                                                          import com.easypost.EasyPost;
                                                                                                          import com.easypost.exception.EasyPostException;
                                                                                                          
                                                                                                          EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                          
                                                                                                          Map<String, Object> parcelMap = new HashMap<String, Object>();
                                                                                                          parcelMap.put("height", 5);
                                                                                                          parcelMap.put("width", 10.9);
                                                                                                          parcelMap.put("length", 20.2);
                                                                                                          parcelMap.put("weight", 65.9);
                                                                                                          
                                                                                                          Parcel parcel = Parcel.create(parcelMap);
                                                                                                          {
                                                                                                            "id": "prcl_...",
                                                                                                            "object": "Parcel",
                                                                                                            "length": 20.2,
                                                                                                            "width": 10.9,
                                                                                                            "height": 5.0,
                                                                                                            "predefined_package": null,
                                                                                                            "weight": 65.9,
                                                                                                            "created_at": "2013-04-22T05:40:57Z",
                                                                                                            "updated_at": "2013-04-22T05:40:57Z"
                                                                                                          }
                                                                                                          GET/parcels/:id

                                                                                                          Retrieve a Parcel

                                                                                                          Get a Parcel by its id. In general you should not need to use this in your automated solution. A Parcel's id can be inlined into the creation call to other objects. This allows you to only create one Parcel for each package you will be using.

                                                                                                          Retrieve Parcel Example
                                                                                                          import com.easypost.EasyPost;
                                                                                                          import com.easypost.exception.EasyPostException;
                                                                                                          
                                                                                                          EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                          
                                                                                                          Parcel parcel = Parcel.retrieve("prcl_...");
                                                                                                          {
                                                                                                            "id": "prcl_...",
                                                                                                            "object": "Parcel",
                                                                                                            "length": 20.2,
                                                                                                            "width": 10.9,
                                                                                                            "height": 5.0,
                                                                                                            "predefined_package": null,
                                                                                                            "weight": 65.9,
                                                                                                            "created_at": "2013-04-22T05:40:57Z",
                                                                                                            "updated_at": "2013-04-22T05:40:57Z"
                                                                                                          }

                                                                                                          Insurances

                                                                                                          An Insurance object represents insurance for packages purchased both via the EasyPost API as well as shipments purchased through third parties and later registered with EasyPost. An Insurance is created automatically whenever you buy a Shipment through EasyPost and pass insurance options during the Buy call or in a later call to Insure a Shipment.

                                                                                                          Insurance purchased through the Shipment Buy or Insure endpoints is immediately insured - there is no possibility of rejection based on tracking information, as the package was just created. On the other hand, Insurance purchased on shipments purchased outside of EasyPost requires creation with a tracking code so that EasyPost may confirm the package existence and current shipping status at the time of purchase.

                                                                                                          Standalone insurance is created in a pending state to help distinguish it from insurance purchased for an EasyPost Shipment. Both kinds of Insurance use the Tracking system to receive periodic updates, and will report those updates to any appropriate Webhooks on file. Standalone insurance will cancel itself if the tracking information for the given tracking code shows evidence of having been shipped anytime before the insurance was purchased.

                                                                                                          Unlike Shipments within EasyPost, Insurance objects register To and From Address objects according to the destination and ship-from locations of the package. This means that a Shipment with "is_return: true" actually ships to the listed From Address. Insurance does not have a concept of "is_return", so all insurance records refer to their true package destination as "to_address", regardless of whether or not the shipment is a return.

                                                                                                          Insurance Object

                                                                                                          attributetypespecification
                                                                                                          idstringUnique identifier, begins with "ins_"
                                                                                                          objectstring"Insurance"
                                                                                                          modestring"test" or "production"
                                                                                                          referencestringThe unique reference for this Insurance, if any
                                                                                                          amountstringUSD value of insured goods with sub-cent precision
                                                                                                          providerstringThe insurance provider used by EasyPost
                                                                                                          provider_idstringAn identifying number for some insurance providers used by EasyPost
                                                                                                          shipment_idstringThe ID of the Shipment in EasyPost, if postage was purchased via EasyPost
                                                                                                          tracking_codestringThe tracking code of either the shipment within EasyPost, or provided by you during creation
                                                                                                          statusstringThe current status of the insurance, possible values are "new", "pending", "purchased", "failed", or "cancelled"
                                                                                                          trackerTrackerThe associated Tracker object
                                                                                                          to_addressAddressThe associated Address object for destination
                                                                                                          from_addressAddressThe associated Address object for origin
                                                                                                          feeFeeThe associated InsuranceFee object if any
                                                                                                          messagesArray of stringsThe list of errors encountered during attempted purchase of the insurance
                                                                                                          created_atdatetime
                                                                                                          updated_atdatetime
                                                                                                          POST/insurances

                                                                                                          Create an Insurance

                                                                                                          An Insurance created via this endpoint must belong to a shipment purchased outside of EasyPost. Insurance for Shipments created within EasyPost must be created via the Shipment Buy or Insure endpoints. When creating Insurance for a non-EasyPost shipment, you must provide to_address, from_address, tracking_code, and amount information. Optionally, you can provide the carrier parameter, which will help EasyPost identify the carrier the package was shipped with. If no carrier is provided, EasyPost will attempt to determine the carrier based on the tracking_code provided. Providing a carrier parameter is recommended, since some tracking_codes are ambiguous and may match with more than one carrier. In addition, not having to auto-match the carrier will significantly speed up the response time.

                                                                                                          Create Insurance Request Parameters
                                                                                                          paramexampleinfo
                                                                                                          to_addressAddressThe actual destination of the package to be insured
                                                                                                          from_addressAddressThe actual origin of the package to be insured
                                                                                                          tracking_code9400110898825022579493The tracking code associated with the non-EasyPost-purchased package you'd like to insure
                                                                                                          referenceexternal-order-493Optional. A unique value that may be used in place of ID when doing Retrieve calls for this insurance
                                                                                                          amount"$100.00"The USD value of contents you would like to insure. Currently the maximum is $5000
                                                                                                          carrierUSPSThe carrier associated with the tracking_code you provided. The carrier will get auto-detected if none is provided
                                                                                                          Create Insurance Example
                                                                                                          import com.easypost.EasyPost;
                                                                                                          import com.easypost.exception.EasyPostException;
                                                                                                          
                                                                                                          EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                          
                                                                                                          Map<String, Object> toAddressMap = new HashMap<String, Object>();
                                                                                                          toAddressMap.put("name", "Maggie Simpson");
                                                                                                          toAddressMap.put("street1", "742 Evergreen Terrace");
                                                                                                          toAddressMap.put("street2", "");
                                                                                                          toAddressMap.put("city", "Springfield");
                                                                                                          toAddressMap.put("state", "KY");
                                                                                                          toAddressMap.put("country", "US");
                                                                                                          toAddressMap.put("zip", "40069");
                                                                                                          
                                                                                                          Map<String, Object> fromAddressMap = new HashMap<String, Object>();
                                                                                                          ...
                                                                                                          
                                                                                                          Map<String, Object> insuranceMap = new HashMap<String, Object>();
                                                                                                          insuranceMap.put("to_address", toAddressMap);
                                                                                                          insuranceMap.put("from_address", fromAddressMap);
                                                                                                          insuranceMap.put("tracking_code","9400110898825022579493");
                                                                                                          insuranceMap.put("carrier", "USPS");
                                                                                                          insuranceMap.put("amount", "100.00");
                                                                                                          insuranceMap.put("reference", "insuranceRef1");
                                                                                                          
                                                                                                          Insurance insurance = Insurance.create(insuranceMap);
                                                                                                          
                                                                                                          // Or create by using IDs
                                                                                                          
                                                                                                          HashMap<String, Object> toAddress = new HashMap<String, Object>();
                                                                                                          toAddress.put("id", "adr_...");
                                                                                                          
                                                                                                          HashMap<String, Object> fromAddress = new HashMap<String, Object>();
                                                                                                          fromAddress.put("id", "adr_...");
                                                                                                          
                                                                                                          Map<String, Object> insuranceMap = new HashMap<String, Object>();
                                                                                                          insuranceMap.put("to_address", toAddress);
                                                                                                          insuranceMap.put("from_address", fromAddress);
                                                                                                          insuranceMap.put("tracking_code","9400110898825022579493");
                                                                                                          insuranceMap.put("carrier", "USPS");
                                                                                                          insuranceMap.put("amount", "100.00");
                                                                                                          insuranceMap.put("reference", "insuranceRef1");
                                                                                                          
                                                                                                          Insurance insurance = Insurance.create(insuranceMap);
                                                                                                          {
                                                                                                            "id": "ins_...",
                                                                                                            "object": "Insurance",
                                                                                                            "mode": "test",
                                                                                                            "reference": null,
                                                                                                            "status": "pending",
                                                                                                            "amount": "101.00000",
                                                                                                            "provider": "pip",
                                                                                                            "provider_id": 1,
                                                                                                            "to_address": {
                                                                                                              "id": "adr_...",
                                                                                                              "object": "Address",
                                                                                                              "created_at": "2016-07-22T00:09:34Z",
                                                                                                              "updated_at": "2016-07-22T00:09:34Z",
                                                                                                              "name": "DR. STEVE BRULE",
                                                                                                              "company": null,
                                                                                                              "street1": "179 N HARBOR DR",
                                                                                                              "street2": "",
                                                                                                              "city": "REDONDO BEACH",
                                                                                                              "state": "CA",
                                                                                                              "zip": "90277-2506",
                                                                                                              "country": "US",
                                                                                                              "phone": "3108085555",
                                                                                                              "email": null,
                                                                                                              "mode": "test",
                                                                                                              "carrier_facility": null,
                                                                                                              "residential": false,
                                                                                                              "federal_tax_id": null,
                                                                                                              "state_tax_id": null,
                                                                                                              "verifications": {
                                                                                                                "delivery": {
                                                                                                                  "success": true,
                                                                                                                  "errors": [],
                                                                                                                  "details": { "latitude": 33.84446, "longitude": -118.39275 }
                                                                                                                }
                                                                                                              }
                                                                                                            },
                                                                                                            "from_address": {
                                                                                                              "id": "adr_...",
                                                                                                              "object": "Address",
                                                                                                              "created_at": "2016-07-22T00:09:34Z",
                                                                                                              "updated_at": "2016-07-22T00:09:34Z",
                                                                                                              "name": null,
                                                                                                              "company": "EASYPOST",
                                                                                                              "street1": "417 MONTGOMERY ST FL 5",
                                                                                                              "street2": "",
                                                                                                              "city": "SAN FRANCISCO",
                                                                                                              "state": "CA",
                                                                                                              "zip": "94104",
                                                                                                              "country": "US",
                                                                                                              "phone": "4155555555",
                                                                                                              "email": null,
                                                                                                              "mode": "test",
                                                                                                              "carrier_facility": null,
                                                                                                              "residential": false,
                                                                                                              "federal_tax_id": null,
                                                                                                              "state_tax_id": null,
                                                                                                              "verifications": {
                                                                                                                "delivery": {
                                                                                                                  "success": true,
                                                                                                                  "errors": [],
                                                                                                                  "details": { "longitude": -122.0, "latitude": 37.0 }
                                                                                                                }
                                                                                                              }
                                                                                                            },
                                                                                                            "shipment_id": null,
                                                                                                            "tracker": {
                                                                                                              "id": "trk_...",
                                                                                                              "object": "Tracker",
                                                                                                              "mode": "test",
                                                                                                              "tracking_code": "EZ2000000002",
                                                                                                              "status": "in_transit",
                                                                                                              "created_at": "2016-07-22T00:09:34Z",
                                                                                                              "updated_at": "2016-07-22T03:09:34Z",
                                                                                                              "signed_by": null,
                                                                                                              "weight": null,
                                                                                                              "est_delivery_date": "2014-08-27T00:00:00Z",
                                                                                                              "shipment_id": "",
                                                                                                              "carrier": "USPS",
                                                                                                              "tracking_details": [],
                                                                                                              "carrier_detail": {
                                                                                                                "object": "CarrierDetail",
                                                                                                                "service": "First-Class Package Service",
                                                                                                                "container_type": null,
                                                                                                                "est_delivery_date_local": null,
                                                                                                                "est_delivery_time_local": null,
                                                                                                                "origin_location": "HOUSTON TX, 77001",
                                                                                                                "destination_location": "CHARLESTON SC, 29401"
                                                                                                              },
                                                                                                              "public_url": "https://track.easypost.com/djE...",
                                                                                                              "fees": []
                                                                                                            },
                                                                                                            "tracking_code": "EZ2000000002",
                                                                                                            "fee": {
                                                                                                              "object": "Fee",
                                                                                                              "type": "InsuranceFee",
                                                                                                              "amount": "1.01000",
                                                                                                              "charged": true,
                                                                                                              "refunded": false
                                                                                                            },
                                                                                                            "messages": [],
                                                                                                            "created_at": "2016-07-22T00:09:34Z",
                                                                                                            "updated_at": "2016-07-22T00:10:35Z"
                                                                                                          }
                                                                                                          GET/insurances

                                                                                                          Retrieve a list of Insurances

                                                                                                          The Insurance List is a paginated list of all Insurance objects associated with the given API Key. It accepts a variety of parameters which can be used to modify the scope. The has_more attribute indicates whether or not additional pages can be requested. The recommended way of paginating is to use either the before_id or after_id parameter to specify where the next page begins.

                                                                                                          Retrieve a list of Insurances Request Parameters
                                                                                                          paramexampleinfo
                                                                                                          before_idins_...Optional pagination parameter. Only records created before the given ID will be included. May not be used with after_id
                                                                                                          after_idins_...Optional pagination parameter. Only records created after the given ID will be included. May not be used with before_id
                                                                                                          start_datetime2016-01-02T00:00:00ZOnly return records created after this timestamp. Defaults to 1 month ago, or 1 month before a passed end_datetime
                                                                                                          end_datetime2016-01-02T00:00:00ZOnly return records created before this timestamp. Defaults to end of the current day, or 1 month after a passed start_datetime
                                                                                                          page_size30The number of records to return on each page. The maximum value is 100, and default is 20.
                                                                                                          Retrieve a list of Insurance Example
                                                                                                          import com.easypost.EasyPost;
                                                                                                          import com.easypost.exception.EasyPostException;
                                                                                                          
                                                                                                          EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                          
                                                                                                          Map<String, Object> list_params = new HashMap<>();
                                                                                                          list_params.put("page_size", 2);
                                                                                                          list_params.put("start_datetime", "2016-01-02T08:50:00Z");
                                                                                                          
                                                                                                          InsuranceCollection insurances = Insurance.all(list_params);
                                                                                                          {
                                                                                                            "insurances": [
                                                                                                              {
                                                                                                                "id": "ins_...",
                                                                                                                "object": "Insurance",
                                                                                                                "mode": "test",
                                                                                                                "reference": null,
                                                                                                                "status": "pending",
                                                                                                                "amount": "101.00000",
                                                                                                                "provider": "pip",
                                                                                                                "provider_id": 1,
                                                                                                                "to_address": {
                                                                                                                  "id": "adr_...",
                                                                                                                  "object": "Address",
                                                                                                                  "created_at": "2016-07-22T00:09:34Z",
                                                                                                                  "updated_at": "2016-07-22T00:09:34Z",
                                                                                                                  "name": "DR. STEVE BRULE",
                                                                                                                  "company": null,
                                                                                                                  "street1": "179 N HARBOR DR",
                                                                                                                  "street2": "",
                                                                                                                  "city": "REDONDO BEACH",
                                                                                                                  "state": "CA",
                                                                                                                  "zip": "90277-2506",
                                                                                                                  "country": "US",
                                                                                                                  "phone": "3108085555",
                                                                                                                  "email": null,
                                                                                                                  "mode": "test",
                                                                                                                  "carrier_facility": null,
                                                                                                                  "residential": false,
                                                                                                                  "federal_tax_id": null,
                                                                                                                  "state_tax_id": null,
                                                                                                                  "verifications": {
                                                                                                                    "delivery": {
                                                                                                                      "success": true,
                                                                                                                      "errors": [],
                                                                                                                      "details": { "latitude": 33.84446, "longitude": -118.39275 }
                                                                                                                    }
                                                                                                                  }
                                                                                                                },
                                                                                                                "from_address": {
                                                                                                                  "id": "adr_...",
                                                                                                                  "object": "Address",
                                                                                                                  "created_at": "2016-07-22T00:09:34Z",
                                                                                                                  "updated_at": "2016-07-22T00:09:34Z",
                                                                                                                  "name": null,
                                                                                                                  "company": "EASYPOST",
                                                                                                                  "street1": "417 MONTGOMERY ST FL 5",
                                                                                                                  "street2": "",
                                                                                                                  "city": "SAN FRANCISCO",
                                                                                                                  "state": "CA",
                                                                                                                  "zip": "94104",
                                                                                                                  "country": "US",
                                                                                                                  "phone": "4155555555",
                                                                                                                  "email": null,
                                                                                                                  "mode": "test",
                                                                                                                  "carrier_facility": null,
                                                                                                                  "residential": false,
                                                                                                                  "federal_tax_id": null,
                                                                                                                  "state_tax_id": null,
                                                                                                                  "verifications": {
                                                                                                                    "delivery": {
                                                                                                                      "success": true,
                                                                                                                      "errors": [],
                                                                                                                      "details": { "longitude": -122.0, "latitude": 37.0 }
                                                                                                                    }
                                                                                                                  }
                                                                                                                },
                                                                                                                "shipment_id": null,
                                                                                                                "tracker": {
                                                                                                                  "id": "trk_...",
                                                                                                                  "object": "Tracker",
                                                                                                                  "mode": "test",
                                                                                                                  "tracking_code": "EZ2000000002",
                                                                                                                  "status": "in_transit",
                                                                                                                  "created_at": "2016-07-22T00:09:34Z",
                                                                                                                  "updated_at": "2016-07-22T03:09:34Z",
                                                                                                                  "signed_by": null,
                                                                                                                  "weight": null,
                                                                                                                  "est_delivery_date": "2014-08-27T00:00:00Z",
                                                                                                                  "shipment_id": "",
                                                                                                                  "carrier": "USPS",
                                                                                                                  "tracking_details": [],
                                                                                                                  "carrier_detail": {
                                                                                                                    "object": "CarrierDetail",
                                                                                                                    "service": "First-Class Package Service",
                                                                                                                    "container_type": null,
                                                                                                                    "est_delivery_date_local": null,
                                                                                                                    "est_delivery_time_local": null,
                                                                                                                    "origin_location": "HOUSTON TX, 77001",
                                                                                                                    "destination_location": "CHARLESTON SC, 29401"
                                                                                                                  },
                                                                                                                  "public_url": "https://track.easypost.com/djE...",
                                                                                                                  "fees": []
                                                                                                                },
                                                                                                                "tracking_code": "EZ2000000002",
                                                                                                                "fee": {
                                                                                                                  "object": "Fee",
                                                                                                                  "type": "InsuranceFee",
                                                                                                                  "amount": "1.01000",
                                                                                                                  "charged": true,
                                                                                                                  "refunded": true
                                                                                                                },
                                                                                                                "messages": [
                                                                                                                  "The tracker entered the mailstream before insurance was purchased."
                                                                                                                ],
                                                                                                                "created_at": "2016-07-22T00:09:34Z",
                                                                                                                "updated_at": "2016-07-22T00:10:35Z"
                                                                                                              }
                                                                                                            ],
                                                                                                            "has_more": true
                                                                                                          }
                                                                                                          GET/insurances/:id

                                                                                                          Retrieve an Insurance

                                                                                                          Retrieve an Insurance by id.

                                                                                                          Retrieve Insurance Request Parameters
                                                                                                          paramexampleinfo
                                                                                                          idins_...Unique, starts with "ins_"
                                                                                                          Retrieve Insurance Example
                                                                                                          import com.easypost.EasyPost;
                                                                                                          import com.easypost.exception.EasyPostException;
                                                                                                          
                                                                                                          EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                          
                                                                                                          Insurance insurance = Insurance.retrieve("ins_...");
                                                                                                          {
                                                                                                            "id": "ins_...",
                                                                                                            "object": "Insurance",
                                                                                                            "mode": "test",
                                                                                                            "reference": null,
                                                                                                            "status": "pending",
                                                                                                            "amount": "101.00000",
                                                                                                            "provider": "pip",
                                                                                                            "provider_id": 1,
                                                                                                            "to_address": {
                                                                                                              "id": "adr_...",
                                                                                                              "object": "Address",
                                                                                                              "created_at": "2016-07-22T00:09:34Z",
                                                                                                              "updated_at": "2016-07-22T00:09:34Z",
                                                                                                              "name": "DR. STEVE BRULE",
                                                                                                              "company": null,
                                                                                                              "street1": "179 N HARBOR DR",
                                                                                                              "street2": "",
                                                                                                              "city": "REDONDO BEACH",
                                                                                                              "state": "CA",
                                                                                                              "zip": "90277-2506",
                                                                                                              "country": "US",
                                                                                                              "phone": "3108085555",
                                                                                                              "email": null,
                                                                                                              "mode": "test",
                                                                                                              "carrier_facility": null,
                                                                                                              "residential": false,
                                                                                                              "federal_tax_id": null,
                                                                                                              "state_tax_id": null,
                                                                                                              "verifications": {
                                                                                                                "delivery": {
                                                                                                                  "success": true,
                                                                                                                  "errors": [],
                                                                                                                  "details": { "latitude": 33.84446, "longitude": -118.39275 }
                                                                                                                }
                                                                                                              }
                                                                                                            },
                                                                                                            "from_address": {
                                                                                                              "id": "adr_...",
                                                                                                              "object": "Address",
                                                                                                              "created_at": "2016-07-22T00:09:34Z",
                                                                                                              "updated_at": "2016-07-22T00:09:34Z",
                                                                                                              "name": null,
                                                                                                              "company": "EASYPOST",
                                                                                                              "street1": "417 MONTGOMERY ST FL 5",
                                                                                                              "street2": "",
                                                                                                              "city": "SAN FRANCISCO",
                                                                                                              "state": "CA",
                                                                                                              "zip": "94104",
                                                                                                              "country": "US",
                                                                                                              "phone": "4155555555",
                                                                                                              "email": null,
                                                                                                              "mode": "test",
                                                                                                              "carrier_facility": null,
                                                                                                              "residential": false,
                                                                                                              "federal_tax_id": null,
                                                                                                              "state_tax_id": null,
                                                                                                              "verifications": {
                                                                                                                "delivery": {
                                                                                                                  "success": true,
                                                                                                                  "errors": [],
                                                                                                                  "details": { "longitude": -122.0, "latitude": 37.0 }
                                                                                                                }
                                                                                                              }
                                                                                                            },
                                                                                                            "shipment_id": null,
                                                                                                            "tracker": {
                                                                                                              "id": "trk_...",
                                                                                                              "object": "Tracker",
                                                                                                              "mode": "test",
                                                                                                              "tracking_code": "EZ2000000002",
                                                                                                              "status": "in_transit",
                                                                                                              "created_at": "2016-07-22T00:09:34Z",
                                                                                                              "updated_at": "2016-07-22T03:09:34Z",
                                                                                                              "signed_by": null,
                                                                                                              "weight": null,
                                                                                                              "est_delivery_date": "2014-08-27T00:00:00Z",
                                                                                                              "shipment_id": "",
                                                                                                              "carrier": "USPS",
                                                                                                              "tracking_details": [],
                                                                                                              "carrier_detail": {
                                                                                                                "object": "CarrierDetail",
                                                                                                                "service": "First-Class Package Service",
                                                                                                                "container_type": null,
                                                                                                                "est_delivery_date_local": null,
                                                                                                                "est_delivery_time_local": null,
                                                                                                                "origin_location": "HOUSTON TX, 77001",
                                                                                                                "destination_location": "CHARLESTON SC, 29401"
                                                                                                              },
                                                                                                              "public_url": "https://track.easypost.com/djE...",
                                                                                                              "fees": []
                                                                                                            },
                                                                                                            "tracking_code": "EZ2000000002",
                                                                                                            "fee": {
                                                                                                              "object": "Fee",
                                                                                                              "type": "InsuranceFee",
                                                                                                              "amount": "1.01000",
                                                                                                              "charged": true,
                                                                                                              "refunded": true
                                                                                                            },
                                                                                                            "messages": [],
                                                                                                            "created_at": "2016-07-22T00:09:34Z",
                                                                                                            "updated_at": "2016-07-22T00:10:35Z"
                                                                                                          }

                                                                                                          Shipments

                                                                                                          The workhorse of the EasyPost API, a Shipment is made up of a "to" and "from" Address, the Parcel being shipped, and any customs forms required for international deliveries. Once created a Shipment object is used to retrieve shipping Rates and purchase a label.

                                                                                                          A Shipment created with a valid to_address, from_address, and parcel will automatically populate its rates attribute.

                                                                                                          Shipment Object

                                                                                                          attributetypespecification
                                                                                                          idstringUnique, begins with "shp_"
                                                                                                          objectstring"Shipment"
                                                                                                          referencestringAn optional field that may be used in place of id in other API endpoints
                                                                                                          modestring"test" or "production"
                                                                                                          to_addressAddressThe destination address
                                                                                                          from_addressAddressThe origin address
                                                                                                          return_addressAddressThe shipper's address, defaults to from_address
                                                                                                          buyer_addressAddressThe buyer's address, defaults to to_address
                                                                                                          parcelParcelThe dimensions and weight of the package
                                                                                                          customs_infoCustomsInfoInformation for the processing of customs
                                                                                                          scan_formScanFormDocument created to manifest and scan multiple shipments
                                                                                                          formsForm arrayAll associated Form objects
                                                                                                          insurancestringThe associated Insurance amount
                                                                                                          ratesRate arrayAll associated Rate objects
                                                                                                          selected_rateRateThe specific rate purchased for the shipment, or null if unpurchased or purchased through another mechanism
                                                                                                          postage_labelPostageLabelThe associated PostageLabel object
                                                                                                          messagesMessage arrayAny carrier errors encountered during rating, discussed in more depth below
                                                                                                          optionsOptionsAll of the options passed to the shipment, discussed in more depth below
                                                                                                          is_returnbooleanSet true to create as a return, discussed in more depth below
                                                                                                          tracking_codestringIf purchased, the tracking code will appear here as well as within the Tracker object
                                                                                                          usps_zoneintegerThe USPS zone of the shipment, if purchased with USPS
                                                                                                          statusstringThe current tracking status of the shipment
                                                                                                          trackerTrackerThe associated Tracker object
                                                                                                          feesFee arrayThe associated Fee objects charged to the billing user account
                                                                                                          refund_statusstringThe current status of the shipment refund process. Possible values are "submitted", "refunded", "rejected".
                                                                                                          batch_idstringThe ID of the batch that contains this shipment, if any
                                                                                                          batch_statusstringThe current status of the associated BatchShipment
                                                                                                          batch_messagestringThe current message of the associated BatchShipment
                                                                                                          created_atdatetime
                                                                                                          updated_atdatetime

                                                                                                          Form Object

                                                                                                          attributetypespecification
                                                                                                          idstringUnique, begins with "form_"
                                                                                                          objectstring"Form"
                                                                                                          modestring"test" or "production"
                                                                                                          form_typestringThe type of form that we returned, can be one of "high_value_report", "commercial_invoice", "cod_return_label", "order_summary", "cn22"
                                                                                                          form_urlstringThe address we return the form back at
                                                                                                          submitted_electronicallybooleanIf we have submitted the form to the carrier on behalf of the customer
                                                                                                          created_atdatetime
                                                                                                          updated_atdatetime

                                                                                                          PostageLabel Object

                                                                                                          attributetypespecification
                                                                                                          idstringUnique, begins with "pl_"
                                                                                                          objectstring"PostageLabel"
                                                                                                          label_datedatetimeThe date that appears on the postage label
                                                                                                          label_epl2_urlstringThe URL of the EPL2 label file
                                                                                                          label_file_typestringFile type of the label
                                                                                                          label_pdf_urlstringThe URL of the PDF label file
                                                                                                          label_resolutionintegerThe resolution of the label
                                                                                                          label_sizestringThe size of the label
                                                                                                          label_typestringThe type of the label
                                                                                                          label_urlstringThe URL of the label file
                                                                                                          label_zpl_urlstringThe URL of the ZPL label file
                                                                                                          created_atdatetime
                                                                                                          updated_atdatetime
                                                                                                          POST/shipments

                                                                                                          Create a Shipment

                                                                                                          A Shipment is almost exclusively a container for other objects, and thus a Shipment may reuse many of these objects. Additionally, all the objects contained within a Shipment may be created at the same time.

                                                                                                          The origin/destination Address and Parcel are required for rating. CustomsInfo is required to rate an international Shipment, this includes when the destination is a US Territory. The associated Tracker, Fees, and Rates are generated by EasyPost and cannot be modified by the user.

                                                                                                          You can limit the CarrierAccounts to use for rating by passing the carrier_accounts parameter.

                                                                                                          Create Shipment Request Parameters
                                                                                                          paramexampleinfo
                                                                                                          reference"my-reference"
                                                                                                          to_address<Address>Can be specified by ID or attributes to create a new one, and be verified inline. See Create and Verify Address
                                                                                                          from_address<Address>Can be specified by ID or attributes to create a new one, and be verified inline. See Create and Verify Address
                                                                                                          parcel<Parcel>
                                                                                                          carrier_accounts["ca_...", ...]
                                                                                                          Create Shipment Example
                                                                                                          import com.easypost.EasyPost;
                                                                                                          import com.easypost.exception.EasyPostException;
                                                                                                          
                                                                                                          EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                          
                                                                                                          Map<String, Object> toAddressMap = new HashMap<String, Object>();
                                                                                                          toAddressMap.put("name", "Maggie Simpson");
                                                                                                          toAddressMap.put("street1", "742 Evergreen Terrace");
                                                                                                          toAddressMap.put("street2", "");
                                                                                                          toAddressMap.put("city", "Springfield");
                                                                                                          toAddressMap.put("state", "KY");
                                                                                                          toAddressMap.put("country", "US");
                                                                                                          toAddressMap.put("zip", "40069");
                                                                                                          
                                                                                                          Map<String, Object> fromAddressMap = new HashMap<String, Object>();
                                                                                                          ...
                                                                                                          
                                                                                                          Map<String, Object> parcelMap = new HashMap<String, Object>();
                                                                                                          ...
                                                                                                          
                                                                                                          Map<String, Object> customsInfoMap = new HashMap<String, Object>();
                                                                                                          ...
                                                                                                          
                                                                                                          Map<String, Object> shipmentMap = new HashMap<String, Object>();
                                                                                                          shipmentMap.put("to_address", toAddressMap);
                                                                                                          shipmentMap.put("from_address", fromAddressMap);
                                                                                                          shipmentMap.put("parcel", parcelMap);
                                                                                                          shipmentMap.put("customs_info", customsInfoMap);
                                                                                                          
                                                                                                          Shipment shipment = Shipment.create(shipmentMap);
                                                                                                          
                                                                                                          // Or create by using IDs
                                                                                                          
                                                                                                          HashMap<String, Object> toAddress = new HashMap<String, Object>();
                                                                                                          toAddress.put("id", "adr_...");
                                                                                                          
                                                                                                          HashMap<String, Object> fromAddress = new HashMap<String, Object>();
                                                                                                          fromAddress.put("id", "adr_...");
                                                                                                          
                                                                                                          HashMap<String, Object> parcel = new HashMap<String, Object>();
                                                                                                          parcel.put("id", "prcl_...");
                                                                                                          
                                                                                                          HashMap<String, Object> customsInfo = new HashMap<String, Object>();
                                                                                                          customsInfo.put("id", "cstinfo_...");
                                                                                                          
                                                                                                          HashMap<String, Object> shipmentMap = new HashMap<String, Object>();
                                                                                                          shipmentMap.put("to_address", toAddress);
                                                                                                          shipmentMap.put("from_address", fromAddress);
                                                                                                          shipmentMap.put("parcel", parcel);
                                                                                                          shipmentMap.put("customs_info", customsInfo);
                                                                                                          
                                                                                                          Shipment shipment = Shipment.create(shipmentMap);
                                                                                                          {
                                                                                                            "id": "shp_...",
                                                                                                            "object": "Shipment",
                                                                                                            "mode": "test",
                                                                                                            "to_address": {
                                                                                                              "id": "adr_...",
                                                                                                              "object": "Address",
                                                                                                              "name": "Dr. Steve Brule",
                                                                                                              "company": null,
                                                                                                              "street1": "179 N Harbor Dr",
                                                                                                              "street2": null,
                                                                                                              "city": "Redondo Beach",
                                                                                                              "state": "CA",
                                                                                                              "zip": "90277",
                                                                                                              "country": "US",
                                                                                                              "phone": "4153334444",
                                                                                                              "mode": "test",
                                                                                                              "carrier_facility": null,
                                                                                                              "residential": null,
                                                                                                              "email": "dr_steve_brule@gmail.com",
                                                                                                              "created_at": "2013-04-22T05:39:56Z",
                                                                                                              "updated_at": "2013-04-22T05:39:56Z"
                                                                                                            },
                                                                                                            "from_address": {
                                                                                                              "id": "adr_...",
                                                                                                              "object": "Address",
                                                                                                              "name": "EasyPost",
                                                                                                              "company": null,
                                                                                                              "street1": "417 Montgomery Street",
                                                                                                              "street2": "5th Floor",
                                                                                                              "city": "San Francisco",
                                                                                                              "state": "CA",
                                                                                                              "zip": "94104",
                                                                                                              "country": "US",
                                                                                                              "phone": "4153334444",
                                                                                                              "email": "support@easypost.com",
                                                                                                              "mode": "test",
                                                                                                              "carrier_facility": null,
                                                                                                              "residential": null,
                                                                                                              "created_at": "2013-04-22T05:39:57Z",
                                                                                                              "updated_at": "2013-04-22T05:39:57Z"
                                                                                                            },
                                                                                                            "parcel": {
                                                                                                              "id": "prcl_...",
                                                                                                              "object": "Parcel",
                                                                                                              "length": 20.2,
                                                                                                              "width": 10.9,
                                                                                                              "height": 5.0,
                                                                                                              "predefined_package": null,
                                                                                                              "weight": 140.8,
                                                                                                              "created_at": "2013-04-22T05:39:57Z",
                                                                                                              "updated_at": "2013-04-22T05:39:57Z"
                                                                                                            },
                                                                                                            "customs_info": {
                                                                                                              "id": "cstinfo_...",
                                                                                                              "object": "CustomsInfo",
                                                                                                              "created_at": "2013-04-22T05:39:57Z",
                                                                                                              "updated_at": "2013-04-22T05:39:57Z",
                                                                                                              "contents_explanation": null,
                                                                                                              "contents_type": "merchandise",
                                                                                                              "customs_certify": false,
                                                                                                              "customs_signer": null,
                                                                                                              "eel_pfc": null,
                                                                                                              "non_delivery_option": "return",
                                                                                                              "restriction_comments": null,
                                                                                                              "restriction_type": "none",
                                                                                                              "customs_items": [
                                                                                                                {
                                                                                                                  "id": "cstitem_...",
                                                                                                                  "object": "CustomsItem",
                                                                                                                  "description": "Many, many EasyPost stickers.",
                                                                                                                  "hs_tariff_number": "123456",
                                                                                                                  "origin_country": "US",
                                                                                                                  "quantity": 1,
                                                                                                                  "value": 879,
                                                                                                                  "weight": 140,
                                                                                                                  "created_at": "2013-04-22T05:39:57Z",
                                                                                                                  "updated_at": "2013-04-22T05:39:57Z"
                                                                                                                }
                                                                                                              ]
                                                                                                            },
                                                                                                            "rates": [
                                                                                                              {
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "billing_type": "easypost",
                                                                                                                "carrier_account_id": "ca_...",
                                                                                                                "service": "FirstClassPackageInternationalService",
                                                                                                                "rate": "9.50",
                                                                                                                "carrier": "USPS",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "delivery_days": 4,
                                                                                                                "delivery_date": "2013-04-26T05:40:57Z",
                                                                                                                "delivery_date_guaranteed": false,
                                                                                                                "created_at": "2013-04-22T05:40:57Z",
                                                                                                                "updated_at": "2013-04-22T05:40:57Z"
                                                                                                              },
                                                                                                              {
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "billing_type": "easypost",
                                                                                                                "carrier_account_id": "ca_...",
                                                                                                                "service": "PriorityMailInternational",
                                                                                                                "rate": "27.40",
                                                                                                                "carrier": "USPS",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "delivery_days": 2,
                                                                                                                "delivery_date": "2013-04-24T05:40:57Z",
                                                                                                                "delivery_date_guaranteed": false,
                                                                                                                "created_at": "2013-04-22T05:40:57Z",
                                                                                                                "updated_at": "2013-04-22T05:40:57Z"
                                                                                                              },
                                                                                                              {
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "billing_type": "easypost",
                                                                                                                "carrier_account_id": "ca_...",
                                                                                                                "service": "ExpressMailInternational",
                                                                                                                "rate": "35.48",
                                                                                                                "carrier": "USPS",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "delivery_days": 1,
                                                                                                                "delivery_date": "2013-04-23T05:40:57Z",
                                                                                                                "delivery_date_guaranteed": true,
                                                                                                                "created_at": "2013-04-22T05:40:57Z",
                                                                                                                "updated_at": "2013-04-22T05:40:57Z"
                                                                                                              }
                                                                                                            ],
                                                                                                            "scan_form": null,
                                                                                                            "selected_rate": null,
                                                                                                            "postage_label": null,
                                                                                                            "tracking_code": null,
                                                                                                            "refund_status": null,
                                                                                                            "insurance": null,
                                                                                                            "created_at": "2013-04-22T05:40:57Z",
                                                                                                            "updated_at": "2013-04-22T05:40:57Z"
                                                                                                          }
                                                                                                          GET/shipments

                                                                                                          Retrieve a list of Shipments

                                                                                                          The Shipment List is a paginated list of all Shipment objects associated with the given API Key. It accepts a variety of parameters which can be used to modify the scope. The has_more attribute indicates whether or not additional pages can be requested. The recommended way of paginating is to use either the before_id or after_id parameter to specify where the next page begins.

                                                                                                          Retrieve a list of Shipment Request Parameters
                                                                                                          paramexampleinfo
                                                                                                          before_idshp_...Optional pagination parameter. Only shipments created before the given ID will be included. May not be used with after_id
                                                                                                          after_idshp_...Optional pagination parameter. Only shipments created after the given ID will be included. May not be used with before_id
                                                                                                          start_datetime2016-01-02T00:00:00ZOnly return Shipments created after this timestamp. Defaults to 1 month ago, or 1 month before a passed end_datetime
                                                                                                          end_datetime2016-01-02T00:00:00ZOnly return Shipments created before this timestamp. Defaults to end of the current day, or 1 month after a passed start_datetime
                                                                                                          page_size20The number of Shipments to return on each page. The maximum value is 100
                                                                                                          purchasedtrueOnly include Shipments that have been purchased. Default is true
                                                                                                          include_childrenfalseAlso include Shipments created by Child Users. Defaults to false
                                                                                                          Retrieve a list of Shipment Example
                                                                                                          import com.easypost.EasyPost;
                                                                                                          import com.easypost.exception.EasyPostException;
                                                                                                          
                                                                                                          EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                          
                                                                                                          Map<String, Object> list_params = new HashMap<>();
                                                                                                          list_params.put("page_size", 2);
                                                                                                          list_params.put("start_datetime", "2016-01-02T08:50:00Z");
                                                                                                          
                                                                                                          ShipmentCollection shipments = Shipment.all(list_params);
                                                                                                          {
                                                                                                            "has_more": true,
                                                                                                            "shipments": [
                                                                                                              {
                                                                                                                "batch_id": null,
                                                                                                                "batch_message": null,
                                                                                                                "batch_status": null,
                                                                                                                "buyer_address": {
                                                                                                                  ...
                                                                                                                },
                                                                                                                "created_at": "2016-11-28T20:03:25Z",
                                                                                                                "customs_info": null,
                                                                                                                "fees": [
                                                                                                                  {
                                                                                                                    "amount": "0.00000",
                                                                                                                    "charged": true,
                                                                                                                    "object": "Fee",
                                                                                                                    "refunded": false,
                                                                                                                    "type": "LabelFee"
                                                                                                                  },
                                                                                                                  {
                                                                                                                    "amount": "2.60000",
                                                                                                                    "charged": true,
                                                                                                                    "object": "Fee",
                                                                                                                    "refunded": false,
                                                                                                                    "type": "PostageFee"
                                                                                                                  }
                                                                                                                ],
                                                                                                                "forms": [],
                                                                                                                "from_address": {
                                                                                                                  ...
                                                                                                                },
                                                                                                                "id": "shp_...",
                                                                                                                "insurance": null,
                                                                                                                "is_return": false,
                                                                                                                "messages": [],
                                                                                                                "mode": "production",
                                                                                                                "object": "Shipment",
                                                                                                                "options": {
                                                                                                                  "currency": "USD",
                                                                                                                  "date_advance": 0,
                                                                                                                  "label_date": null,
                                                                                                                  "label_format": "ZPL",
                                                                                                                  "special_rates_eligibility": "USPS.MEDIAMAIL"
                                                                                                                },
                                                                                                                "parcel": {
                                                                                                                  ...
                                                                                                                },
                                                                                                                "postage_label": {
                                                                                                                  "created_at": "2016-11-28T20:04:42Z",
                                                                                                                  "date_advance": 0,
                                                                                                                  "id": "pl_...",
                                                                                                                  "integrated_form": "none",
                                                                                                                  "label_date": "2016-11-28T20:04:42Z",
                                                                                                                  "label_epl2_url": null,
                                                                                                                  "label_file": null,
                                                                                                                  "label_file_type": "application/zpl",
                                                                                                                  "label_pdf_url": null,
                                                                                                                  "label_resolution": 203,
                                                                                                                  "label_size": "4x6",
                                                                                                                  "label_type": "default",
                                                                                                                  "label_url": "https://easypost-files.s3-us-west-2.amazonaws.com/files/postage_label/20161128/9zdb0ccd6009418fa12f93794f8177df.zpl",
                                                                                                                  "label_zpl_url": "https://easypost-files.s3-us-west-2.amazonaws.com/files/postage_label/20161128/9bdb0ccd6909418fa12f93794f8177df.zpl",
                                                                                                                  "object": "PostageLabel",
                                                                                                                  "updated_at": "2016-11-28T20:04:42Z"
                                                                                                                },
                                                                                                                "rates": [
                                                                                                                  { ... },
                                                                                                                  { ... }
                                                                                                                ],
                                                                                                                "reference": null,
                                                                                                                "refund_status": null,
                                                                                                                "return_address": {
                                                                                                                  ...
                                                                                                                },
                                                                                                                "scan_form": null,
                                                                                                                "selected_rate": {
                                                                                                                  ...
                                                                                                                },
                                                                                                                "status": "pre_transit",
                                                                                                                "to_address": {
                                                                                                                  ...
                                                                                                                },
                                                                                                                "tracker": {
                                                                                                                  ...
                                                                                                                },
                                                                                                                "tracking_code": "9400110896700986051652",
                                                                                                                "updated_at": "2016-11-29T03:25:18Z",
                                                                                                                "usps_zone": 8
                                                                                                              },
                                                                                                              {
                                                                                                                "id": "shp_..."
                                                                                                              }
                                                                                                            ]
                                                                                                          }
                                                                                                          GET/shipments/:id

                                                                                                          Retrieve a Shipment

                                                                                                          A Shipment can be retrieved by either its id or reference. However it is recommended to use EasyPost's provided identifiers because uniqueness on reference is not enforced.

                                                                                                          Retrieve Shipment Example
                                                                                                          import com.easypost.EasyPost;
                                                                                                          import com.easypost.exception.EasyPostException;
                                                                                                          
                                                                                                          EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                          
                                                                                                          Shipment shipment = Shipment.retrieve("shp_...");
                                                                                                          {
                                                                                                            "id": "shp_...",
                                                                                                            "object": "Shipment",
                                                                                                            "mode": "test",
                                                                                                            "to_address": {
                                                                                                              "id": "adr_...",
                                                                                                              "object": "Address",
                                                                                                              "name": "Dr. Steve Brule",
                                                                                                              "company": null,
                                                                                                              "street1": "179 N Harbor Dr",
                                                                                                              "street2": null,
                                                                                                              "city": "Redondo Beach",
                                                                                                              "state": "CA",
                                                                                                              "zip": "90277",
                                                                                                              "country": "US",
                                                                                                              "phone": "4153334444",
                                                                                                              "mode": "test",
                                                                                                              "carrier_facility": null,
                                                                                                              "residential": null,
                                                                                                              "email": "dr_steve_brule@gmail.com",
                                                                                                              "created_at": "2013-04-22T05:39:56Z",
                                                                                                              "updated_at": "2013-04-22T05:39:56Z"
                                                                                                            },
                                                                                                            "from_address": {
                                                                                                              "id": "adr_...",
                                                                                                              "object": "Address",
                                                                                                              "name": "EasyPost",
                                                                                                              "company": null,
                                                                                                              "street1": "417 Montgomery Street",
                                                                                                              "street2": "5th Floor",
                                                                                                              "city": "San Francisco",
                                                                                                              "state": "CA",
                                                                                                              "zip": "94104",
                                                                                                              "country": "US",
                                                                                                              "phone": "4153334444",
                                                                                                              "email": "support@easypost.com",
                                                                                                              "mode": "test",
                                                                                                              "carrier_facility": null,
                                                                                                              "residential": null,
                                                                                                              "created_at": "2013-04-22T05:39:57Z",
                                                                                                              "updated_at": "2013-04-22T05:39:57Z"
                                                                                                            },
                                                                                                            "parcel": {
                                                                                                              "id": "prcl_...",
                                                                                                              "object": "Parcel",
                                                                                                              "length": 20.2,
                                                                                                              "width": 10.9,
                                                                                                              "height": 5.0,
                                                                                                              "predefined_package": null,
                                                                                                              "weight": 140.8,
                                                                                                              "created_at": "2013-04-22T05:39:57Z",
                                                                                                              "updated_at": "2013-04-22T05:39:57Z"
                                                                                                            },
                                                                                                            "customs_info": {
                                                                                                              "id": "cstinfo_...",
                                                                                                              "object": "CustomsInfo",
                                                                                                              "created_at": "2013-04-22T05:39:57Z",
                                                                                                              "updated_at": "2013-04-22T05:39:57Z",
                                                                                                              "contents_explanation": null,
                                                                                                              "contents_type": "merchandise",
                                                                                                              "customs_certify": false,
                                                                                                              "customs_signer": null,
                                                                                                              "eel_pfc": null,
                                                                                                              "non_delivery_option": "return",
                                                                                                              "restriction_comments": null,
                                                                                                              "restriction_type": "none",
                                                                                                              "customs_items": [
                                                                                                                {
                                                                                                                  "id": "cstitem_...",
                                                                                                                  "object": "CustomsItem",
                                                                                                                  "description": "Many, many EasyPost stickers.",
                                                                                                                  "hs_tariff_number": "123456",
                                                                                                                  "origin_country": "US",
                                                                                                                  "quantity": 1,
                                                                                                                  "value": 879,
                                                                                                                  "weight": 140,
                                                                                                                  "created_at": "2013-04-22T05:39:57Z",
                                                                                                                  "updated_at": "2013-04-22T05:39:57Z"
                                                                                                                }
                                                                                                              ]
                                                                                                            },
                                                                                                            "rates": [
                                                                                                              {
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "billing_type": "easypost",
                                                                                                                "carrier_account_id": "ca_...",
                                                                                                                "service": "FirstClassPackageInternationalService",
                                                                                                                "rate": "9.50",
                                                                                                                "carrier": "USPS",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "delivery_days": 4,
                                                                                                                "delivery_date": "2013-04-26T05:40:57Z",
                                                                                                                "delivery_date_guaranteed": false,
                                                                                                                "created_at": "2013-04-22T05:40:57Z",
                                                                                                                "updated_at": "2013-04-22T05:40:57Z"
                                                                                                              }, {
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "billing_type": "easypost",
                                                                                                                "carrier_account_id": "ca_...",
                                                                                                                "service": "PriorityMailInternational",
                                                                                                                "rate": "27.40",
                                                                                                                "carrier": "USPS",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "delivery_days": 2,
                                                                                                                "delivery_date": "2013-04-24T05:40:57Z",
                                                                                                                "delivery_date_guaranteed": false,
                                                                                                                "created_at": "2013-04-22T05:40:57Z",
                                                                                                                "updated_at": "2013-04-22T05:40:57Z"
                                                                                                              }, {
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "billing_type": "easypost",
                                                                                                                "carrier_account_id": "ca_...",
                                                                                                                "service": "ExpressMailInternational",
                                                                                                                "rate": "35.48",
                                                                                                                "carrier": "USPS",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "delivery_days": 1,
                                                                                                                "delivery_date": "2013-04-23T05:40:57Z",
                                                                                                                "delivery_date_guaranteed": true,
                                                                                                                "created_at": "2013-04-22T05:40:57Z",
                                                                                                                "updated_at": "2013-04-22T05:40:57Z"
                                                                                                              }
                                                                                                            ],
                                                                                                            "scan_form": null,
                                                                                                            "selected_rate": null,
                                                                                                            "postage_label": null,
                                                                                                            "tracking_code": null,
                                                                                                            "refund_status": null,
                                                                                                            "insurance": null,
                                                                                                            "created_at": "2013-04-22T05:40:57Z",
                                                                                                            "updated_at": "2013-04-22T05:40:57Z"
                                                                                                          }
                                                                                                          POST/shipments/:id/buy

                                                                                                          Buy a Shipment

                                                                                                          To purchase a Shipment you only need to specify the Rate to purchase. This operation populates the tracking_code and postage_label attributes. The default image format of the associated PostageLabel is PNG. To change this default see the label_format option.

                                                                                                          Additionally, insurance may be added during the purchase. To specify an amount to insure, pass the insurance attribute as a string. The currency of all insurance is USD.

                                                                                                          Buy Shipment Request Parameters
                                                                                                          paramexample
                                                                                                          rate<Rate>
                                                                                                          insurance"100.00"
                                                                                                          Buy Shipment Example
                                                                                                          import com.easypost.EasyPost;
                                                                                                          import com.easypost.exception.EasyPostException;
                                                                                                          
                                                                                                          EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                          
                                                                                                          Shipment shipment = Shipment.retrieve("shp_...");
                                                                                                          Map<String, Object> buyMap = new HashMap<String, Object>();
                                                                                                          buyMap.put("rate", shipment.lowestRate());
                                                                                                          buyMap.put("insurance", 249.99);
                                                                                                          
                                                                                                          shipment.buy(buyMap);
                                                                                                          {
                                                                                                            "batch_message": null,
                                                                                                            "batch_status": null,
                                                                                                            "created_at": "2013-11-08T15:50:00Z",
                                                                                                            "customs_info": null,
                                                                                                            "from_address": {
                                                                                                              "city": "San Francisco",
                                                                                                              "company": null,
                                                                                                              "country": "US",
                                                                                                              "created_at": "2013-11-08T15:49:59Z",
                                                                                                              "email": null,
                                                                                                              "id": "adr_...",
                                                                                                              "mode": "test",
                                                                                                              "name": "EasyPost",
                                                                                                              "object": "Address",
                                                                                                              "phone": "415-379-7678",
                                                                                                              "state": "CA",
                                                                                                              "street1": "417 Montgomery Street",
                                                                                                              "street2": "5th Floor",
                                                                                                              "updated_at": "2013-11-08T15:49:59Z",
                                                                                                              "zip": "94104"
                                                                                                            },
                                                                                                            "id": "shp_...",
                                                                                                            "insurance": 249.99,
                                                                                                            "is_return": false,
                                                                                                            "mode": "test",
                                                                                                            "object": "Shipment",
                                                                                                            "parcel": {
                                                                                                              "created_at": "2013-11-08T15:49:59Z",
                                                                                                              "height": null,
                                                                                                              "id": "prcl_...",
                                                                                                              "length": null,
                                                                                                              "mode": "test",
                                                                                                              "object": "Parcel",
                                                                                                              "predefined_package": "UPSLetter",
                                                                                                              "updated_at": "2013-11-08T15:49:59Z",
                                                                                                              "weight": 3.0,
                                                                                                              "width": null
                                                                                                            },
                                                                                                            "postage_label": {
                                                                                                              "created_at": "2013-11-08T20:57:32Z",
                                                                                                              "id": "pl_...",
                                                                                                              "integrated_form": "none",
                                                                                                              "label_date": "2013-11-08T20:57:32Z",
                                                                                                              "label_epl2_url": null,
                                                                                                              "label_file_type": "image/png",
                                                                                                              "label_pdf_url": "https://amazonaws.com/.../a1b2c3.pdf",
                                                                                                              "label_resolution": 200,
                                                                                                              "label_size": "4x7",
                                                                                                              "label_type": "default",
                                                                                                              "label_url": "https://amazonaws.com/.../a1b2c3.png",
                                                                                                              "label_zpl_url": null,
                                                                                                              "object": "PostageLabel",
                                                                                                              "updated_at": "2013-11-08T21:11:14Z"
                                                                                                            },
                                                                                                            "rates": [
                                                                                                              {
                                                                                                                "carrier": "UPS",
                                                                                                                "billing_type": "carrier",
                                                                                                                "created_at": "2013-11-08T15:50:02Z",
                                                                                                                "currency": "USD",
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "rate": "30.44",
                                                                                                                "service": "NextDayAir",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "updated_at": "2013-11-08T15:50:02Z"
                                                                                                              }, {
                                                                                                                "carrier": "UPS",
                                                                                                                "billing_type": "carrier",
                                                                                                                "created_at": "2013-11-08T15:50:02Z",
                                                                                                                "currency": "USD",
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "rate": "60.28",
                                                                                                                "service": "NextDayAirEarlyAM",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "updated_at": "2013-11-08T15:50:02Z"
                                                                                                              }
                                                                                                            ],
                                                                                                            "reference": null,
                                                                                                            "refund_status": null,
                                                                                                            "scan_form": null,
                                                                                                            "selected_rate": {
                                                                                                              "carrier": "UPS",
                                                                                                              "created_at": "2013-11-08T15:50:02Z",
                                                                                                              "currency": "USD",
                                                                                                              "id": "rate_...",
                                                                                                              "object": "Rate",
                                                                                                              "rate": "30.44",
                                                                                                              "service": "NextDayAir",
                                                                                                              "shipment_id": "shp_...",
                                                                                                              "updated_at": "2013-11-08T15:50:02Z"
                                                                                                            },
                                                                                                            "status": "unknown",
                                                                                                            "to_address": {
                                                                                                              "city": "Redondo Beach",
                                                                                                              "company": null,
                                                                                                              "country": "US",
                                                                                                              "created_at": "2013-11-08T15:49:58Z",
                                                                                                              "email": "dr_steve_brule@gmail.com",
                                                                                                              "id": "adr_...",
                                                                                                              "mode": "test",
                                                                                                              "name": "Dr. Steve Brule",
                                                                                                              "object": "Address",
                                                                                                              "phone": null,
                                                                                                              "state": "CA",
                                                                                                              "street1": "179 N Harbor Dr",
                                                                                                              "street2": null,
                                                                                                              "updated_at": "2013-11-08T15:49:58Z",
                                                                                                              "zip": "90277"
                                                                                                            },
                                                                                                            "tracker": {
                                                                                                              "created_at": "2013-11-08T20:57:32Z",
                                                                                                              "id": "trk_...",
                                                                                                              "mode": "test",
                                                                                                              "object": "Tracker",
                                                                                                              "shipment_id": "shp_...",
                                                                                                              "status": "unknown",
                                                                                                              "tracking_code": "1ZE6A4850190733810",
                                                                                                              "tracking_details": [ ],
                                                                                                              "updated_at": "2013-11-08T20:58:26Z",
                                                                                                              "public_url": "https://track.easypost.com/djE7..."
                                                                                                            },
                                                                                                            "tracking_code": "1ZE6A4850190733810",
                                                                                                            "updated_at": "2013-11-08T20:58:26Z"
                                                                                                          }
                                                                                                          POST/shipments

                                                                                                          Buy a Shipment without rating (One-Call Buy)

                                                                                                          There is an alternative way to purchase shipments that is known as the "one-call buy" method. This method is often used if you have a flat-rate set with a mail carrier for a given service level OR if you know your desired service level without needing to see the rate first.

                                                                                                          Utilizing the "one-call buy" method can improve the performance of your integration, because it cuts out an API call from our standard "create shipment" then "buy shipment" workflow. In order to achieve this behavior all you have to do is add a single carrier account and service level name to your "Create Shipment" call.

                                                                                                          One-Call Buy Shipment Request Parameters
                                                                                                          paramexampleinfo
                                                                                                          reference"my-reference"
                                                                                                          to_address<Address>Can be specified by ID or attributes to create a new one, and be verified inline. See Create and Verify Address
                                                                                                          from_address<Address>Can be specified by ID or attributes to create a new one, and be verified inline. See Create and Verify Address
                                                                                                          parcel<Parcel>
                                                                                                          carrier_accounts["ca_..."]
                                                                                                          service"Priority"
                                                                                                          One-Call Buy Shipment Example
                                                                                                          import com.easypost.EasyPost;
                                                                                                          import com.easypost.exception.EasyPostException;
                                                                                                          
                                                                                                          EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                          
                                                                                                          Map<String, Object> toAddressMap = new HashMap<String, Object>();
                                                                                                          toAddressMap.put("name", "Maggie Simpson");
                                                                                                          toAddressMap.put("street1", "742 Evergreen Terrace");
                                                                                                          toAddressMap.put("street2", "");
                                                                                                          toAddressMap.put("city", "Springfield");
                                                                                                          toAddressMap.put("state", "KY");
                                                                                                          toAddressMap.put("country", "US");
                                                                                                          toAddressMap.put("zip", "40069");
                                                                                                          
                                                                                                          Map<String, Object> fromAddressMap = new HashMap<String, Object>();
                                                                                                          ...
                                                                                                          
                                                                                                          Map<String, Object> parcelMap = new HashMap<String, Object>();
                                                                                                          ...
                                                                                                          
                                                                                                          Map<String, Object> shipmentMap = new HashMap<String, Object>();
                                                                                                          shipmentMap.put("carrier_accounts", "ca_...");
                                                                                                          shipmentMap.put("service", "NextDayAir");
                                                                                                          shipmentMap.put("to_address", toAddressMap);
                                                                                                          shipmentMap.put("from_address", fromAddressMap);
                                                                                                          shipmentMap.put("parcel", parcelMap);
                                                                                                          
                                                                                                          Shipment shipment = Shipment.create(shipmentMap);
                                                                                                          {
                                                                                                            "batch_message": null,
                                                                                                            "batch_status": null,
                                                                                                            "created_at": "2013-11-08T15:50:00Z",
                                                                                                            "customs_info": null,
                                                                                                            "from_address": {
                                                                                                              "city": "San Francisco",
                                                                                                              "company": null,
                                                                                                              "country": "US",
                                                                                                              "created_at": "2013-11-08T15:49:59Z",
                                                                                                              "email": null,
                                                                                                              "id": "adr_...",
                                                                                                              "mode": "test",
                                                                                                              "name": "EasyPost",
                                                                                                              "object": "Address",
                                                                                                              "phone": "415-379-7678",
                                                                                                              "state": "CA",
                                                                                                              "street1": "417 Montgomery Street",
                                                                                                              "street2": "5th Floor",
                                                                                                              "updated_at": "2013-11-08T15:49:59Z",
                                                                                                              "zip": "94104"
                                                                                                            },
                                                                                                            "id": "shp_...",
                                                                                                            "insurance": 249.99,
                                                                                                            "is_return": false,
                                                                                                            "mode": "test",
                                                                                                            "object": "Shipment",
                                                                                                            "parcel": {
                                                                                                              "created_at": "2013-11-08T15:49:59Z",
                                                                                                              "height": 5,
                                                                                                              "id": "prcl_...",
                                                                                                              "length": 20.2,
                                                                                                              "mode": "test",
                                                                                                              "object": "Parcel",
                                                                                                              "predefined_package": "UPSLetter",
                                                                                                              "updated_at": "2013-11-08T15:49:59Z",
                                                                                                              "weight": 3.0,
                                                                                                              "width": 10.9
                                                                                                            },
                                                                                                            "postage_label": {
                                                                                                              "created_at": "2013-11-08T20:57:32Z",
                                                                                                              "id": "pl_...",
                                                                                                              "integrated_form": "none",
                                                                                                              "label_date": "2013-11-08T20:57:32Z",
                                                                                                              "label_epl2_url": null,
                                                                                                              "label_file_type": "image/png",
                                                                                                              "label_pdf_url": "https://amazonaws.com/.../a1b2c3.pdf",
                                                                                                              "label_resolution": 200,
                                                                                                              "label_size": "4x7",
                                                                                                              "label_type": "default",
                                                                                                              "label_url": "https://amazonaws.com/.../a1b2c3.png",
                                                                                                              "label_zpl_url": null,
                                                                                                              "object": "PostageLabel",
                                                                                                              "updated_at": "2013-11-08T21:11:14Z"
                                                                                                            },
                                                                                                            "rates": [
                                                                                                              {
                                                                                                                "carrier": "UPS",
                                                                                                                "billing_type": "carrier",
                                                                                                                "created_at": "2013-11-08T15:50:02Z",
                                                                                                                "currency": "USD",
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "rate": "30.44",
                                                                                                                "service": "NextDayAir",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "updated_at": "2013-11-08T15:50:02Z"
                                                                                                              }, {
                                                                                                                "carrier": "UPS",
                                                                                                                "billing_type": "carrier",
                                                                                                                "created_at": "2013-11-08T15:50:02Z",
                                                                                                                "currency": "USD",
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "rate": "60.28",
                                                                                                                "service": "NextDayAirEarlyAM",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "updated_at": "2013-11-08T15:50:02Z"
                                                                                                              }
                                                                                                            ],
                                                                                                            "reference": null,
                                                                                                            "refund_status": null,
                                                                                                            "scan_form": null,
                                                                                                            "selected_rate": {
                                                                                                              "carrier": "UPS",
                                                                                                              "created_at": "2013-11-08T15:50:02Z",
                                                                                                              "currency": "USD",
                                                                                                              "id": "rate_...",
                                                                                                              "object": "Rate",
                                                                                                              "rate": "30.44",
                                                                                                              "service": "NextDayAir",
                                                                                                              "shipment_id": "shp_...",
                                                                                                              "updated_at": "2013-11-08T15:50:02Z"
                                                                                                            },
                                                                                                            "status": "unknown",
                                                                                                            "to_address": {
                                                                                                              "city": "Redondo Beach",
                                                                                                              "company": null,
                                                                                                              "country": "US",
                                                                                                              "created_at": "2013-11-08T15:49:58Z",
                                                                                                              "email": "dr_steve_brule@gmail.com",
                                                                                                              "id": "adr_...",
                                                                                                              "mode": "test",
                                                                                                              "name": "Dr. Steve Brule",
                                                                                                              "object": "Address",
                                                                                                              "phone": null,
                                                                                                              "state": "CA",
                                                                                                              "street1": "179 N Harbor Dr",
                                                                                                              "street2": null,
                                                                                                              "updated_at": "2013-11-08T15:49:58Z",
                                                                                                              "zip": "90277"
                                                                                                            },
                                                                                                            "tracker": {
                                                                                                              "created_at": "2013-11-08T20:57:32Z",
                                                                                                              "id": "trk_...",
                                                                                                              "mode": "test",
                                                                                                              "object": "Tracker",
                                                                                                              "shipment_id": "shp_...",
                                                                                                              "status": "unknown",
                                                                                                              "tracking_code": "1ZE6A4850190733810",
                                                                                                              "tracking_details": [ ],
                                                                                                              "updated_at": "2013-11-08T20:58:26Z",
                                                                                                              "public_url": "https://track.easypost.com/djE7..."
                                                                                                            },
                                                                                                            "tracking_code": "1ZE6A4850190733810",
                                                                                                            "updated_at": "2013-11-08T20:58:26Z"
                                                                                                          }
                                                                                                          GET/shipments/:id/label

                                                                                                          Convert the Label format of a Shipment

                                                                                                          A Shipment's PostageLabel can be converted from PNG to other formats. If the PostageLabel was originally generated in a format other than PNG it cannot be converted.

                                                                                                          Label Shipment Example
                                                                                                          import com.easypost.EasyPost;
                                                                                                          import com.easypost.exception.EasyPostException;
                                                                                                          
                                                                                                          EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                          
                                                                                                          Shipment shipment = Shipment.retrieve("shp_...");
                                                                                                          
                                                                                                          Map<String, Object> params = new HashMap<String, Object>();
                                                                                                          params.put("file_format", "ZPL");
                                                                                                          
                                                                                                          shipment.label(params);
                                                                                                          {
                                                                                                            "batch_message": null,
                                                                                                            "batch_status": null,
                                                                                                            "created_at": "2013-11-08T15:50:00Z",
                                                                                                            "customs_info": null,
                                                                                                            "from_address": {
                                                                                                              "city": "San Francisco",
                                                                                                              "company": null,
                                                                                                              "country": "US",
                                                                                                              "created_at": "2013-11-08T15:49:59Z",
                                                                                                              "email": null,
                                                                                                              "id": "adr_...",
                                                                                                              "mode": "test",
                                                                                                              "name": "EasyPost",
                                                                                                              "object": "Address",
                                                                                                              "phone": "415-379-7678",
                                                                                                              "state": "CA",
                                                                                                              "street1": "417 Montgomery Street",
                                                                                                              "street2": "5th Floor",
                                                                                                              "updated_at": "2013-11-08T15:49:59Z",
                                                                                                              "zip": "94104"
                                                                                                            },
                                                                                                            "id": "shp_...",
                                                                                                            "insurance": null,
                                                                                                            "is_return": false,
                                                                                                            "mode": "test",
                                                                                                            "object": "Shipment",
                                                                                                            "parcel": {
                                                                                                              "created_at": "2013-11-08T15:49:59Z",
                                                                                                              "height": null,
                                                                                                              "id": "prcl_...",
                                                                                                              "length": null,
                                                                                                              "mode": "test",
                                                                                                              "object": "Parcel",
                                                                                                              "predefined_package": "UPSLetter",
                                                                                                              "updated_at": "2013-11-08T15:49:59Z",
                                                                                                              "weight": 3.0,
                                                                                                              "width": null
                                                                                                            },
                                                                                                            "postage_label": {
                                                                                                              "created_at": "2013-11-08T20:57:32Z",
                                                                                                              "id": "pl_...",
                                                                                                              "integrated_form": "none",
                                                                                                              "label_date": "2013-11-08T20:57:32Z",
                                                                                                              "label_epl2_url": null,
                                                                                                              "label_file_type": "image/png",
                                                                                                              "label_pdf_url": "https://amazonaws.com/.../a1b2c3.pdf",
                                                                                                              "label_resolution": 200,
                                                                                                              "label_size": "4x7",
                                                                                                              "label_type": "default",
                                                                                                              "label_url": "https://amazonaws.com/.../a1b2c3.png",
                                                                                                              "label_zpl_url": "https://amazonaws.com/.../a1b2c3.zpl",
                                                                                                              "object": "PostageLabel",
                                                                                                              "updated_at": "2013-11-08T21:11:14Z"
                                                                                                            },
                                                                                                            "rates": [
                                                                                                              {
                                                                                                                "carrier": "UPS",
                                                                                                                "billing_type": "carrier",
                                                                                                                "created_at": "2013-11-08T15:50:02Z",
                                                                                                                "currency": "USD",
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "rate": "30.44",
                                                                                                                "service": "NextDayAir",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "updated_at": "2013-11-08T15:50:02Z"
                                                                                                              }, {
                                                                                                                "carrier": "UPS",
                                                                                                                "billing_type": "carrier",
                                                                                                                "created_at": "2013-11-08T15:50:02Z",
                                                                                                                "currency": "USD",
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "rate": "60.28",
                                                                                                                "service": "NextDayAirEarlyAM",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "updated_at": "2013-11-08T15:50:02Z"
                                                                                                              }
                                                                                                            ],
                                                                                                            "reference": null,
                                                                                                            "refund_status": null,
                                                                                                            "scan_form": null,
                                                                                                            "selected_rate": {
                                                                                                              "carrier": "UPS",
                                                                                                              "created_at": "2013-11-08T15:50:02Z",
                                                                                                              "currency": "USD",
                                                                                                              "id": "rate_...",
                                                                                                              "object": "Rate",
                                                                                                              "rate": "30.44",
                                                                                                              "service": "NextDayAir",
                                                                                                              "shipment_id": "shp_...",
                                                                                                              "updated_at": "2013-11-08T15:50:02Z"
                                                                                                            },
                                                                                                            "status": "unknown",
                                                                                                            "to_address": {
                                                                                                              "city": "Redondo Beach",
                                                                                                              "company": null,
                                                                                                              "country": "US",
                                                                                                              "created_at": "2013-11-08T15:49:58Z",
                                                                                                              "email": "dr_steve_brule@gmail.com",
                                                                                                              "id": "adr_...",
                                                                                                              "mode": "test",
                                                                                                              "name": "Dr. Steve Brule",
                                                                                                              "object": "Address",
                                                                                                              "phone": null,
                                                                                                              "state": "CA",
                                                                                                              "street1": "179 N Harbor Dr",
                                                                                                              "street2": null,
                                                                                                              "updated_at": "2013-11-08T15:49:58Z",
                                                                                                              "zip": "90277"
                                                                                                            },
                                                                                                            "tracker": {
                                                                                                              "created_at": "2013-11-08T20:57:32Z",
                                                                                                              "id": "trk_...",
                                                                                                              "mode": "test",
                                                                                                              "object": "Tracker",
                                                                                                              "shipment_id": "shp_...",
                                                                                                              "status": "unknown",
                                                                                                              "tracking_code": "1ZE6A4850190733810",
                                                                                                              "tracking_details": [ ],
                                                                                                              "updated_at": "2013-11-08T20:58:26Z",
                                                                                                              "public_url": "https://track.easypost.com/djE7..."
                                                                                                            },
                                                                                                            "tracking_code": "1ZE6A4850190733810",
                                                                                                            "updated_at": "2013-11-08T20:58:26Z"
                                                                                                          }

                                                                                                          Carbon Offset

                                                                                                          The Carbon Offset API estimates the carbon emissions on parcel delivery for a given shipment, and allows purchasing offsets to neutralize carbon emissions from parcel delivery. Currently, only U.S. domestic shipments are supported.

                                                                                                          To use the Carbon Offset API, set carbon_offset to "true" when creating a Shipment. Each Rate will return a CarbonOffset object with the estimated grams of carbon emitted and price to offset the carbon emissions. To purchase the carbon offset, set carbon_offset to "true" when you purchase the Shipment.

                                                                                                          If no offset is available for a shipment when requested, a message "No carbon offset available for this shipment" is shown in the messages array.

                                                                                                          Carbon Offset Object

                                                                                                          attributetypespecification
                                                                                                          gramsintegerthe estimated amount of carbon grams emitted by the shipment
                                                                                                          pricestringprice to offset the amount of carbon grams
                                                                                                          currencystringcurrency of the price (currently always USD)
                                                                                                          objectstring"CarbonOffset"
                                                                                                          POST/shipments

                                                                                                          Create Shipment with Carbon Offset

                                                                                                          Create Shipment with Carbon Offset Request Parameters
                                                                                                          paramexampleinfo
                                                                                                          carbon_offsettrueWhether you want to buy a shipment with carbon offset.
                                                                                                          Create Shipment with Carbon Offset Example
                                                                                                          import com.easypost.EasyPost;
                                                                                                          import com.easypost.exception.EasyPostException;
                                                                                                          
                                                                                                          EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                          
                                                                                                          Map<String, Object> toAddressMap = new HashMap<String, Object>();
                                                                                                          ...
                                                                                                          
                                                                                                          Map<String, Object> fromAddressMap = new HashMap<String, Object>();
                                                                                                          ...
                                                                                                          
                                                                                                          Map<String, Object> parcelMap = new HashMap<String, Object>();
                                                                                                          ...
                                                                                                          
                                                                                                          Map<String, Object> customsInfoMap = new HashMap<String, Object>();
                                                                                                          ...
                                                                                                          
                                                                                                          Map<String, Object> shipmentMap = new HashMap<String, Object>();
                                                                                                          shipmentMap.put("to_address", toAddressMap);
                                                                                                          shipmentMap.put("from_address", fromAddressMap);
                                                                                                          shipmentMap.put("parcel", parcelMap);
                                                                                                          shipmentMap.put("customs_info", customsInfoMap);
                                                                                                          
                                                                                                          Shipment shipment = Shipment.create(shipmentMap, true);
                                                                                                          {
                                                                                                              "id": "shp_...",
                                                                                                              "object": "Shipment",
                                                                                                              "mode": "test",
                                                                                                              "to_address": {
                                                                                                                "id": "adr_...",
                                                                                                                "object": "Address",
                                                                                                                "name": "Dr. Steve Brule",
                                                                                                                "company": null,
                                                                                                                "street1": "179 N Harbor Dr",
                                                                                                                "street2": null,
                                                                                                                "city": "Redondo Beach",
                                                                                                                "state": "CA",
                                                                                                                "zip": "90277",
                                                                                                                "country": "US",
                                                                                                                "phone": "4153334444",
                                                                                                                "mode": "test",
                                                                                                                "carrier_facility": null,
                                                                                                                "residential": null,
                                                                                                                "email": "dr_steve_brule@gmail.com",
                                                                                                                "created_at": "2013-04-22T05:39:56Z",
                                                                                                                "updated_at": "2013-04-22T05:39:56Z"
                                                                                                              },
                                                                                                              "from_address": {
                                                                                                                "id": "adr_...",
                                                                                                                "object": "Address",
                                                                                                                "name": "EasyPost",
                                                                                                                "company": null,
                                                                                                                "street1": "417 Montgomery Street",
                                                                                                                "street2": "5th Floor",
                                                                                                                "city": "San Francisco",
                                                                                                                "state": "CA",
                                                                                                                "zip": "94104",
                                                                                                                "country": "US",
                                                                                                                "phone": "4153334444",
                                                                                                                "email": "support@easypost.com",
                                                                                                                "mode": "test",
                                                                                                                "carrier_facility": null,
                                                                                                                "residential": null,
                                                                                                                "created_at": "2013-04-22T05:39:57Z",
                                                                                                                "updated_at": "2013-04-22T05:39:57Z"
                                                                                                              },
                                                                                                              "parcel": {
                                                                                                                "id": "prcl_...",
                                                                                                                "object": "Parcel",
                                                                                                                "length": 20.2,
                                                                                                                "width": 10.9,
                                                                                                                "height": 5.0,
                                                                                                                "predefined_package": null,
                                                                                                                "weight": 140.8,
                                                                                                                "created_at": "2013-04-22T05:39:57Z",
                                                                                                                "updated_at": "2013-04-22T05:39:57Z"
                                                                                                              },
                                                                                                              "customs_info": {  
                                                                                                              },
                                                                                                              "rates": [
                                                                                                                {
                                                                                                                  "id": "rate_...",
                                                                                                                  "object": "Rate",
                                                                                                                  "billing_type": "easypost",
                                                                                                                  "carrier_account_id": "ca_...",
                                                                                                                  "service": "FirstClass",
                                                                                                                  "rate": "9.50",
                                                                                                                  "carrier": "USPS",
                                                                                                                  "carbon_offset": {
                                                                                                                    "object": "CarbonOffset",
                                                                                                                    "grams": 152,
                                                                                                                    "price": "0.11",
                                                                                                                    "currency": "USD"
                                                                                                                  },
                                                                                                                  "shipment_id": "shp_...",
                                                                                                                  "delivery_days": 4,
                                                                                                                  "delivery_date": "2013-04-26T05:40:57Z",
                                                                                                                  "delivery_date_guaranteed": false,
                                                                                                                  "created_at": "2013-04-22T05:40:57Z",
                                                                                                                  "updated_at": "2013-04-22T05:40:57Z"
                                                                                                                },
                                                                                                                {
                                                                                                                  "id": "rate_...",
                                                                                                                  "object": "Rate",
                                                                                                                  "billing_type": "easypost",
                                                                                                                  "carrier_account_id": "ca_...",
                                                                                                                  "service": "Priority",
                                                                                                                  "rate": "27.40",
                                                                                                                  "carrier": "USPS",
                                                                                                                  "carbon_offset": {
                                                                                                                    "object": "CarbonOffset",
                                                                                                                    "grams": 152,
                                                                                                                    "price": "0.11",
                                                                                                                    "currency": "USD"
                                                                                                                  },
                                                                                                                  "shipment_id": "shp_...",
                                                                                                                  "delivery_days": 2,
                                                                                                                  "delivery_date": "2013-04-24T05:40:57Z",
                                                                                                                  "delivery_date_guaranteed": false,
                                                                                                                  "created_at": "2013-04-22T05:40:57Z",
                                                                                                                  "updated_at": "2013-04-22T05:40:57Z"
                                                                                                                },
                                                                                                                {
                                                                                                                  "id": "rate_...",
                                                                                                                  "object": "Rate",
                                                                                                                  "billing_type": "easypost",
                                                                                                                  "carrier_account_id": "ca_...",
                                                                                                                  "service": "Express",
                                                                                                                  "rate": "35.48",
                                                                                                                  "carrier": "USPS",
                                                                                                                  "carbon_offset": {
                                                                                                                    "object": "CarbonOffset",
                                                                                                                    "grams": 152,
                                                                                                                    "price": "0.11",
                                                                                                                    "currency": "USD"
                                                                                                                  },
                                                                                                                  "shipment_id": "shp_...",
                                                                                                                  "delivery_days": 1,
                                                                                                                  "delivery_date": "2013-04-23T05:40:57Z",
                                                                                                                  "delivery_date_guaranteed": true,
                                                                                                                  "created_at": "2013-04-22T05:40:57Z",
                                                                                                                  "updated_at": "2013-04-22T05:40:57Z"
                                                                                                                }
                                                                                                              ],
                                                                                                              "scan_form": null,
                                                                                                              "selected_rate": null,
                                                                                                              "postage_label": null,
                                                                                                              "tracking_code": null,
                                                                                                              "refund_status": null,
                                                                                                              "insurance": null,
                                                                                                              "created_at": "2013-04-22T05:40:57Z",
                                                                                                              "updated_at": "2013-04-22T05:40:57Z"
                                                                                                            }
                                                                                                          POST/shipments/:id/buy

                                                                                                          Buy Shipment with Carbon Offset

                                                                                                          Buy Shipment with Carbon Offset Request Parameters
                                                                                                          paramexampleinfo
                                                                                                          carbon_offsettrueWhether you want to buy a shipment with carbon offset.
                                                                                                          Buy Shipment with Carbon Offset Example
                                                                                                          import com.easypost.EasyPost;
                                                                                                          import com.easypost.exception.EasyPostException;
                                                                                                          
                                                                                                          EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                          
                                                                                                          Shipment shipment = Shipment.retrieve("shp_...");
                                                                                                          Map<String, Object> buyMap = new HashMap<String, Object>();
                                                                                                          buyMap.put("rate", shipment.lowestRate());
                                                                                                          buyMap.put("insurance", 249.99);
                                                                                                          
                                                                                                          shipment.buy(buyMap, true);
                                                                                                          {
                                                                                                              "batch_message": null,
                                                                                                              "batch_status": null,
                                                                                                              "created_at": "2013-11-08T15:50:00Z",
                                                                                                              "customs_info": null,
                                                                                                              "fees": [
                                                                                                                {
                                                                                                                  "object": "Fee",
                                                                                                                  "type": "LabelFee",
                                                                                                                  "amount": "0.00000",
                                                                                                                  "charged": true,
                                                                                                                  "refunded": false
                                                                                                                },
                                                                                                                {
                                                                                                                  "object": "Fee",
                                                                                                                  "type": "PostageFee",
                                                                                                                  "amount": "4.34000",
                                                                                                                  "charged": true,
                                                                                                                  "refunded": false
                                                                                                                },
                                                                                                                {
                                                                                                                  "object": "Fee",
                                                                                                                  "type": "InsuranceFee",
                                                                                                                  "amount": "0.25000",
                                                                                                                  "charged": true,
                                                                                                                  "refunded": false
                                                                                                                },
                                                                                                                {
                                                                                                                  "object": "Fee",
                                                                                                                  "type": "CarbonOffsetFee",
                                                                                                                  "amount": "0.11000",
                                                                                                                  "charged": true,
                                                                                                                  "refunded": false
                                                                                                                }
                                                                                                              ],
                                                                                                              "from_address": {
                                                                                                                "city": "San Francisco",
                                                                                                                "company": null,
                                                                                                                "country": "US",
                                                                                                                "created_at": "2013-11-08T15:49:59Z",
                                                                                                                "email": null,
                                                                                                                "id": "adr_...",
                                                                                                                "mode": "test",
                                                                                                                "name": "EasyPost",
                                                                                                                "object": "Address",
                                                                                                                "phone": "415-379-7678",
                                                                                                                "state": "CA",
                                                                                                                "street1": "417 Montgomery Street",
                                                                                                                "street2": "5th Floor",
                                                                                                                "updated_at": "2013-11-08T15:49:59Z",
                                                                                                                "zip": "94104"
                                                                                                              },
                                                                                                              "id": "shp_...",
                                                                                                              "insurance": 249.99,
                                                                                                              "is_return": false,
                                                                                                              "mode": "test",
                                                                                                              "object": "Shipment",
                                                                                                              "parcel": {
                                                                                                                "created_at": "2013-11-08T15:49:59Z",
                                                                                                                "height": null,
                                                                                                                "id": "prcl_...",
                                                                                                                "length": null,
                                                                                                                "mode": "test",
                                                                                                                "object": "Parcel",
                                                                                                                "predefined_package": "UPSLetter",
                                                                                                                "updated_at": "2013-11-08T15:49:59Z",
                                                                                                                "weight": 3.0,
                                                                                                                "width": null
                                                                                                              },
                                                                                                              "postage_label": {
                                                                                                                "created_at": "2013-11-08T20:57:32Z",
                                                                                                                "id": "pl_...",
                                                                                                                "integrated_form": "none",
                                                                                                                "label_date": "2013-11-08T20:57:32Z",
                                                                                                                "label_epl2_url": null,
                                                                                                                "label_file_type": "image/png",
                                                                                                                "label_pdf_url": "https://amazonaws.com/.../a1b2c3.pdf",
                                                                                                                "label_resolution": 200,
                                                                                                                "label_size": "4x7",
                                                                                                                "label_type": "default",
                                                                                                                "label_url": "https://amazonaws.com/.../a1b2c3.png",
                                                                                                                "label_zpl_url": null,
                                                                                                                "object": "PostageLabel",
                                                                                                                "updated_at": "2013-11-08T21:11:14Z"
                                                                                                              },
                                                                                                              "rates": [
                                                                                                                {
                                                                                                                  "carrier": "UPS",
                                                                                                                  "billing_type": "carrier",
                                                                                                                  "created_at": "2013-11-08T15:50:02Z",
                                                                                                                  "currency": "USD",
                                                                                                                  "id": "rate_...",
                                                                                                                  "object": "Rate",
                                                                                                                  "rate": "30.44",
                                                                                                                  "service": "NextDayAir",
                                                                                                                  "shipment_id": "shp_...",
                                                                                                                  "updated_at": "2013-11-08T15:50:02Z"
                                                                                                                }, {
                                                                                                                  "carrier": "UPS",
                                                                                                                  "billing_type": "carrier",
                                                                                                                  "created_at": "2013-11-08T15:50:02Z",
                                                                                                                  "currency": "USD",
                                                                                                                  "id": "rate_...",
                                                                                                                  "object": "Rate",
                                                                                                                  "rate": "60.28",
                                                                                                                  "service": "NextDayAirEarlyAM",
                                                                                                                   "shipment_id": "shp_...",
                                                                                                                  "updated_at": "2013-11-08T15:50:02Z"
                                                                                                                }
                                                                                                              ],
                                                                                                              "reference": null,
                                                                                                              "refund_status": null,
                                                                                                              "scan_form": null,
                                                                                                              "selected_rate": {
                                                                                                                "carrier": "UPS",
                                                                                                                "created_at": "2013-11-08T15:50:02Z",
                                                                                                                "currency": "USD",
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "rate": "30.44",
                                                                                                                "service": "NextDayAir",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "updated_at": "2013-11-08T15:50:02Z"
                                                                                                              },
                                                                                                              "status": "unknown",
                                                                                                              "to_address": {
                                                                                                                "city": "Redondo Beach",
                                                                                                                "company": null,
                                                                                                                "country": "US",
                                                                                                                "created_at": "2013-11-08T15:49:58Z",
                                                                                                                "email": "dr_steve_brule@gmail.com",
                                                                                                                "id": "adr_...",
                                                                                                                "mode": "test",
                                                                                                                "name": "Dr. Steve Brule",
                                                                                                                "object": "Address",
                                                                                                                "phone": null,
                                                                                                                "state": "CA",
                                                                                                                "street1": "179 N Harbor Dr",
                                                                                                                "street2": null,
                                                                                                                "updated_at": "2013-11-08T15:49:58Z",
                                                                                                                "zip": "90277"
                                                                                                              },
                                                                                                              "tracker": {
                                                                                                                "created_at": "2013-11-08T20:57:32Z",
                                                                                                                "id": "trk_...",
                                                                                                                "mode": "test",
                                                                                                                "object": "Tracker",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "status": "unknown",
                                                                                                                "tracking_code": "1ZE6A4850190733810",
                                                                                                                "tracking_details": [ ],
                                                                                                                "updated_at": "2013-11-08T20:58:26Z",
                                                                                                                "public_url": "https://track.easypost.com/djE7..."
                                                                                                              },
                                                                                                              "tracking_code": "1ZE6A4850190733810",
                                                                                                              "updated_at": "2013-11-08T20:58:26Z"
                                                                                                            }
                                                                                                          POST/shipments

                                                                                                          One-Call Buy Shipment with Carbon Offset

                                                                                                          One-Call Buy Shipment with Carbon Offset Request Parameters
                                                                                                          paramexampleinfo
                                                                                                          carbon_offsettrueWhether you want to buy a shipment with carbon offset.
                                                                                                          One-Call Buy Shipment with Carbon Offset Example
                                                                                                          import com.easypost.EasyPost;
                                                                                                          import com.easypost.exception.EasyPostException;
                                                                                                          
                                                                                                          EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                          
                                                                                                          Map<String, Object> toAddressMap = new HashMap<String, Object>();
                                                                                                          ...
                                                                                                          
                                                                                                          Map<String, Object> fromAddressMap = new HashMap<String, Object>();
                                                                                                          ...
                                                                                                          
                                                                                                          Map<String, Object> parcelMap = new HashMap<String, Object>();
                                                                                                          ...
                                                                                                          
                                                                                                          Map<String, Object> shipmentMap = new HashMap<String, Object>();
                                                                                                          shipmentMap.put("carrier_accounts", "ca_...");
                                                                                                          shipmentMap.put("service", "NextDayAir");
                                                                                                          shipmentMap.put("to_address", toAddressMap);
                                                                                                          shipmentMap.put("from_address", fromAddressMap);
                                                                                                          shipmentMap.put("parcel", parcelMap);
                                                                                                          
                                                                                                          Shipment shipment = Shipment.create(shipmentMap, true);
                                                                                                          {
                                                                                                              "batch_message": null,
                                                                                                              "batch_status": null,
                                                                                                              "created_at": "2013-11-08T15:50:00Z",
                                                                                                              "customs_info": null,
                                                                                                              "fees": [
                                                                                                                {
                                                                                                                  "object": "Fee",
                                                                                                                  "type": "LabelFee",
                                                                                                                  "amount": "0.00000",
                                                                                                                  "charged": true,
                                                                                                                  "refunded": false
                                                                                                                },
                                                                                                                {
                                                                                                                  "object": "Fee",
                                                                                                                  "type": "PostageFee",
                                                                                                                  "amount": "4.34000",
                                                                                                                  "charged": true,
                                                                                                                  "refunded": false
                                                                                                                },
                                                                                                                {
                                                                                                                  "object": "Fee",
                                                                                                                  "type": "InsuranceFee",
                                                                                                                  "amount": "0.25000",
                                                                                                                  "charged": true,
                                                                                                                  "refunded": false
                                                                                                                },
                                                                                                                {
                                                                                                                  "object": "Fee",
                                                                                                                  "type": "CarbonOffsetFee",
                                                                                                                  "amount": "0.25000",
                                                                                                                  "charged": true,
                                                                                                                  "refunded": false
                                                                                                                }
                                                                                                              ],
                                                                                                              "from_address": {
                                                                                                                "city": "San Francisco",
                                                                                                                "company": null,
                                                                                                                "country": "US",
                                                                                                                "created_at": "2013-11-08T15:49:59Z",
                                                                                                                "email": null,
                                                                                                                "id": "adr_...",
                                                                                                                "mode": "test",
                                                                                                                "name": "EasyPost",
                                                                                                                "object": "Address",
                                                                                                                "phone": "415-379-7678",
                                                                                                                "state": "CA",
                                                                                                                "street1": "417 Montgomery Street",
                                                                                                                "street2": "5th Floor",
                                                                                                                "updated_at": "2013-11-08T15:49:59Z",
                                                                                                                "zip": "94104"
                                                                                                              },
                                                                                                              "id": "shp_...",
                                                                                                              "insurance": 249.99,
                                                                                                              "is_return": false,
                                                                                                              "mode": "test",
                                                                                                              "object": "Shipment",
                                                                                                              "parcel": {
                                                                                                                "created_at": "2013-11-08T15:49:59Z",
                                                                                                                "height": null,
                                                                                                                "id": "prcl_...",
                                                                                                                "length": null,
                                                                                                                "mode": "test",
                                                                                                                "object": "Parcel",
                                                                                                                "predefined_package": "UPSLetter",
                                                                                                                "updated_at": "2013-11-08T15:49:59Z",
                                                                                                                "weight": 3.0,
                                                                                                                "width": null
                                                                                                              },
                                                                                                              "postage_label": {
                                                                                                                "created_at": "2013-11-08T20:57:32Z",
                                                                                                                "id": "pl_...",
                                                                                                                "integrated_form": "none",
                                                                                                                "label_date": "2013-11-08T20:57:32Z",
                                                                                                                "label_epl2_url": null,
                                                                                                                "label_file_type": "image/png",
                                                                                                                "label_pdf_url": "https://amazonaws.com/.../a1b2c3.pdf",
                                                                                                                "label_resolution": 200,
                                                                                                                "label_size": "4x7",
                                                                                                                "label_type": "default",
                                                                                                                "label_url": "https://amazonaws.com/.../a1b2c3.png",
                                                                                                                "label_zpl_url": null,
                                                                                                                "object": "PostageLabel",
                                                                                                                "updated_at": "2013-11-08T21:11:14Z"
                                                                                                              },
                                                                                                              "rates": [
                                                                                                                {
                                                                                                                  "carrier": "UPS",
                                                                                                                  "billing_type": "carrier",
                                                                                                                  "created_at": "2013-11-08T15:50:02Z",
                                                                                                                  "currency": "USD",
                                                                                                                  "id": "rate_...",
                                                                                                                  "object": "Rate",
                                                                                                                  "rate": "30.44",
                                                                                                                  "service": "NextDayAir",
                                                                                                                  "shipment_id": "shp_...",
                                                                                                                  "updated_at": "2013-11-08T15:50:02Z"
                                                                                                                }, {
                                                                                                                  "carrier": "UPS",
                                                                                                                  "billing_type": "carrier",
                                                                                                                  "created_at": "2013-11-08T15:50:02Z",
                                                                                                                  "currency": "USD",
                                                                                                                  "id": "rate_...",
                                                                                                                  "object": "Rate",
                                                                                                                  "rate": "60.28",
                                                                                                                  "service": "NextDayAirEarlyAM",
                                                                                                                  "shipment_id": "shp_...",
                                                                                                                  "updated_at": "2013-11-08T15:50:02Z"
                                                                                                                }
                                                                                                              ],
                                                                                                              "reference": null,
                                                                                                              "refund_status": null,
                                                                                                              "scan_form": null,
                                                                                                              "selected_rate": {
                                                                                                                "carrier": "UPS",
                                                                                                                "created_at": "2013-11-08T15:50:02Z",
                                                                                                                "currency": "USD",
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "rate": "30.44",
                                                                                                                "service": "NextDayAir",
                                                                                                                "carbon_offset_currency": "USD",
                                                                                                                "carbon_offset_fee": "00.02",
                                                                                                                "carbon_offset_grams": 470,
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "updated_at": "2013-11-08T15:50:02Z"
                                                                                                              },
                                                                                                              "status": "unknown",
                                                                                                              "to_address": {
                                                                                                                "city": "Redondo Beach",
                                                                                                                "company": null,
                                                                                                                "country": "US",
                                                                                                                "created_at": "2013-11-08T15:49:58Z",
                                                                                                                "email": "dr_steve_brule@gmail.com",
                                                                                                                "id": "adr_...",
                                                                                                                "mode": "test",
                                                                                                                "name": "Dr. Steve Brule",
                                                                                                                "object": "Address",
                                                                                                                "phone": null,
                                                                                                                "state": "CA",
                                                                                                                "street1": "179 N Harbor Dr",
                                                                                                                "street2": null,
                                                                                                                "updated_at": "2013-11-08T15:49:58Z",
                                                                                                                "zip": "90277"
                                                                                                              },
                                                                                                              "tracker": {
                                                                                                                "created_at": "2013-11-08T20:57:32Z",
                                                                                                                "id": "trk_...",
                                                                                                                "mode": "test",
                                                                                                                "object": "Tracker",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "status": "unknown",
                                                                                                                "tracking_code": "1ZE6A4850190733810",
                                                                                                                "tracking_details": [ ],
                                                                                                                "updated_at": "2013-11-08T20:58:26Z",
                                                                                                                "public_url": "https://track.easypost.com/djE7..."
                                                                                                              },
                                                                                                              "tracking_code": "1ZE6A4850190733810",
                                                                                                              "updated_at": "2013-11-08T20:58:26Z"
                                                                                                            }

                                                                                                          Forms

                                                                                                          After a Shipment is created, you can create various associated Form objects for that Shipment such as a return packing slip, QR codes, and other international shipping forms. For more information about how to use Forms with your Shipments, please check our Forms guide.

                                                                                                          Forms that may be returned with Shipment objects depending on the carrier and data passed:

                                                                                                          • cn22
                                                                                                          • cod_return_label
                                                                                                          • commercial_invoice
                                                                                                          • high_value_report
                                                                                                          • nafta_certificate_of_origin
                                                                                                          • order_summary

                                                                                                          Forms that can be created after a Shipment has been bought:

                                                                                                          • commercial_invoice
                                                                                                          • label_qr_code
                                                                                                          • return_packing_slip
                                                                                                          • rma_qr_code

                                                                                                          Form Object

                                                                                                          attributetypespecification
                                                                                                          idstringUnique, begins with "form_"
                                                                                                          objectstring"Form"
                                                                                                          modestring"test" or "production"
                                                                                                          form_typestringThe type of form, can be one of "cn22", "cod_return_label", "commercial_invoice", "high_value_report", "label_qr_code", "nafta_certificate_of_origin", "order_summary", "return_packing_slip", "rma_qr_code"
                                                                                                          form_urlstringThe URL that a form can be downloaded from
                                                                                                          submitted_electronicallybooleanIf we have submitted the form to the carrier on behalf of the user
                                                                                                          created_atdatetimeWhen the form was created
                                                                                                          updated_atdatetimeWhen the form was updated
                                                                                                          POST/shipments/:id/forms

                                                                                                          Create Form

                                                                                                          Please see Form guide for request parameter.
                                                                                                          Create Form Example
                                                                                                          import com.easypost.EasyPost;
                                                                                                          import com.easypost.exception.EasyPostException;
                                                                                                          
                                                                                                          EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                          
                                                                                                          Shipment shipment = Shipment.retrieve("shp_...");
                                                                                                          shipment.buy();
                                                                                                          
                                                                                                          String formType = "return_packing_slip";
                                                                                                          Map<String, Object> formOptions = new HashMap<String, Object>() {{
                                                                                                              put("barcode", "RMA12345678900");
                                                                                                              put("line_items", new HashMap<String, Object>() {{
                                                                                                                  put("units", units);
                                                                                                                  put("product", new HashMap<String, Object>() {{
                                                                                                                      put("title", "Square Reader");
                                                                                                                      put("barcode", "855658003251");
                                                                                                                  }});
                                                                                                              }});
                                                                                                          }};
                                                                                                          
                                                                                                          shipment.generateForm(formType, formOptions);
                                                                                                          {
                                                                                                            "batch_id": null,
                                                                                                            "batch_message": null,
                                                                                                            "batch_status": null,
                                                                                                            "created_at": "2022-07-18T22:41:08Z",
                                                                                                            "customs_info": null,
                                                                                                            "forms": [
                                                                                                              {
                                                                                                                "created_at": "2022-07-18T22:53:42Z",
                                                                                                                "form_type": "return_packing_slip",
                                                                                                                "form_url": "https://easypost-files.s3-us-west-2.amazonaws.com/files/form/20220718/xxx.pdf",
                                                                                                                "id": "form_...",
                                                                                                                "mode": "test",
                                                                                                                "object": "Form",
                                                                                                                "submitted_electronically": null,
                                                                                                                "updated_at": "2022-07-18T22:53:42Z"
                                                                                                              }
                                                                                                            ],
                                                                                                            "from_address": {
                                                                                                              "carrier_facility": null,
                                                                                                              "city": "San Francisco",
                                                                                                              "company": null,
                                                                                                              "country": "US",
                                                                                                              "created_at": "2022-07-18T22:41:08+00:00",
                                                                                                              "email": "support@easypost.com",
                                                                                                              "federal_tax_id": null,
                                                                                                              "id": "adr_...",
                                                                                                              "mode": "test",
                                                                                                              "name": "EasyPost",
                                                                                                              "object": "Address",
                                                                                                              "phone": "4153334445",
                                                                                                              "residential": null,
                                                                                                              "state": "CA",
                                                                                                              "state_tax_id": null,
                                                                                                              "street1": "417 Montgomery Street",
                                                                                                              "street2": "5th Floor",
                                                                                                              "updated_at": "2022-07-18T22:41:08+00:00",
                                                                                                              "verifications": {},
                                                                                                              "zip": "94104"
                                                                                                            },
                                                                                                            "id": "shp_...",
                                                                                                            "insurance": "249.99",
                                                                                                            "is_return": false,
                                                                                                            "messages": [],
                                                                                                            "mode": "test",
                                                                                                            "object": "Shipment",
                                                                                                            "options": {
                                                                                                              "currency": "USD",
                                                                                                              "date_advance": 0,
                                                                                                              "payment": {
                                                                                                                "type": "SENDER"
                                                                                                              }
                                                                                                            },
                                                                                                            "order_id": null,
                                                                                                            "parcel": {
                                                                                                              "created_at": "2022-07-18T22:41:08Z",
                                                                                                              "height": 5,
                                                                                                              "id": "prcl_...",
                                                                                                              "length": 20.2,
                                                                                                              "mode": "test",
                                                                                                              "object": "Parcel",
                                                                                                              "predefined_package": null,
                                                                                                              "updated_at": "2022-07-18T22:41:08Z",
                                                                                                              "weight": 65.9,
                                                                                                              "width": 10.9
                                                                                                            },
                                                                                                            "rates": [
                                                                                                              {
                                                                                                                "billing_type": "easypost",
                                                                                                                "carrier": "USPS",
                                                                                                                "carrier_account_id": "ca_...",
                                                                                                                "created_at": "2022-07-18T22:41:08Z",
                                                                                                                "currency": "USD",
                                                                                                                "delivery_date": null,
                                                                                                                "delivery_date_guaranteed": false,
                                                                                                                "delivery_days": 2,
                                                                                                                "est_delivery_days": 2,
                                                                                                                "id": "rate_...",
                                                                                                                "list_currency": "USD",
                                                                                                                "list_rate": "9.82",
                                                                                                                "mode": "test",
                                                                                                                "object": "Rate",
                                                                                                                "rate": "9.82",
                                                                                                                "retail_currency": "USD",
                                                                                                                "retail_rate": "13.15",
                                                                                                                "service": "Priority",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "updated_at": "2022-07-18T22:41:08Z"
                                                                                                              },
                                                                                                              {
                                                                                                                "billing_type": "easypost",
                                                                                                                "carrier": "USPS",
                                                                                                                "carrier_account_id": "ca_...",
                                                                                                                "created_at": "2022-07-18T22:41:08Z",
                                                                                                                "currency": "USD",
                                                                                                                "delivery_date": null,
                                                                                                                "delivery_date_guaranteed": false,
                                                                                                                "delivery_days": null,
                                                                                                                "est_delivery_days": null,
                                                                                                                "id": "rate_...",
                                                                                                                "list_currency": "USD",
                                                                                                                "list_rate": "44.30",
                                                                                                                "mode": "test",
                                                                                                                "object": "Rate",
                                                                                                                "rate": "44.30",
                                                                                                                "retail_currency": "USD",
                                                                                                                "retail_rate": "51.00",
                                                                                                                "service": "Express",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "updated_at": "2022-07-18T22:41:08Z"
                                                                                                              },
                                                                                                              {
                                                                                                                "billing_type": "easypost",
                                                                                                                "carrier": "USPS",
                                                                                                                "carrier_account_id": "ca_...",
                                                                                                                "created_at": "2022-07-18T22:41:08Z",
                                                                                                                "currency": "USD",
                                                                                                                "delivery_date": null,
                                                                                                                "delivery_date_guaranteed": false,
                                                                                                                "delivery_days": 5,
                                                                                                                "est_delivery_days": 5,
                                                                                                                "id": "rate_...",
                                                                                                                "list_currency": "USD",
                                                                                                                "list_rate": "8.91",
                                                                                                                "mode": "test",
                                                                                                                "object": "Rate",
                                                                                                                "rate": "8.91",
                                                                                                                "retail_currency": "USD",
                                                                                                                "retail_rate": "8.91",
                                                                                                                "service": "ParcelSelect",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "updated_at": "2022-07-18T22:41:08Z"
                                                                                                              }
                                                                                                            ],
                                                                                                            "reference": null,
                                                                                                            "refund_status": null,
                                                                                                            "return_address": {
                                                                                                              "carrier_facility": null,
                                                                                                              "city": "San Francisco",
                                                                                                              "company": null,
                                                                                                              "country": "US",
                                                                                                              "created_at": "2022-07-18T22:41:08+00:00",
                                                                                                              "email": "support@easypost.com",
                                                                                                              "federal_tax_id": null,
                                                                                                              "id": "adr_...",
                                                                                                              "mode": "test",
                                                                                                              "name": "EasyPost",
                                                                                                              "object": "Address",
                                                                                                              "phone": "4153334445",
                                                                                                              "residential": null,
                                                                                                              "state": "CA",
                                                                                                              "state_tax_id": null,
                                                                                                              "street1": "417 Montgomery Street",
                                                                                                              "street2": "5th Floor",
                                                                                                              "updated_at": "2022-07-18T22:41:08+00:00",
                                                                                                              "verifications": {},
                                                                                                              "zip": "94104"
                                                                                                            },
                                                                                                            "scan_form": null,
                                                                                                            "status": "unknown",
                                                                                                            "to_address": {
                                                                                                              "carrier_facility": null,
                                                                                                              "city": "REDONDO BEACH",
                                                                                                              "company": null,
                                                                                                              "country": "US",
                                                                                                              "created_at": "2022-07-18T22:41:08+00:00",
                                                                                                              "email": "DR_STEVE_BRULE@GMAIL.COM",
                                                                                                              "federal_tax_id": null,
                                                                                                              "id": "adr_...",
                                                                                                              "mode": "test",
                                                                                                              "name": "DR. STEVE BRULE",
                                                                                                              "object": "Address",
                                                                                                              "phone": "8573875756",
                                                                                                              "residential": false,
                                                                                                              "state": "CA",
                                                                                                              "state_tax_id": null,
                                                                                                              "street1": "179 N HARBOR DR",
                                                                                                              "street2": null,
                                                                                                              "updated_at": "2022-07-18T22:53:22+00:00",
                                                                                                              "verifications": {
                                                                                                                "delivery": {
                                                                                                                  "details": {
                                                                                                                    "latitude": 33.8436,
                                                                                                                    "longitude": -118.39177,
                                                                                                                    "time_zone": "America/Los_Angeles"
                                                                                                                  },
                                                                                                                  "errors": [],
                                                                                                                  "success": true
                                                                                                                },
                                                                                                                "zip4": {
                                                                                                                  "details": null,
                                                                                                                  "errors": [],
                                                                                                                  "success": true
                                                                                                                }
                                                                                                              },
                                                                                                              "zip": "90277-2506"
                                                                                                            },
                                                                                                            "updated_at": "2022-07-18T22:53:23Z",
                                                                                                            "usps_zone": 4
                                                                                                          }

                                                                                                          Options

                                                                                                          Shipments can have a variety of additional options which you can specify when creating a shipment. The Options object can be populated with the keys below.

                                                                                                          Carrier specific support for each option is added as needed. To request support for a specific carrier option please email us at support@easypost.com.

                                                                                                          Options Object

                                                                                                          attributetypespecification
                                                                                                          additional_handlingbooleanSetting this option to true, will add an additional handling charge. An Additional Handling charge may be applied to the following:
                                                                                                          • Any article that is encased in an outside shipping container made of metal or wood.
                                                                                                          • Any item, such as a barrel, drum, pail or tire, that is not fully encased in a corrugated cardboard shipping container.
                                                                                                          • Any package with the longest side exceeding 60 inches or its second longest side exceeding 30 inches.
                                                                                                          • Any package with an actual weight greater than 70 pounds.
                                                                                                          address_validation_levelstringSetting this option to "0", will allow the minimum amount of address information to pass the validation check. Only for USPS postage.
                                                                                                          alcoholbooleanSet this option to true if your shipment contains alcohol.
                                                                                                          • UPS - only supported for US Domestic shipments
                                                                                                          • FedEx - only supported for US Domestic shipments
                                                                                                          • Canada Post - Requires adult signature 19 years or older. If you want adult signature 18 years or older, instead use delivery_confirmation: ADULT_SIGNATURE
                                                                                                          bill_receiver_accountstring*This field is deprecated. Use the 'payment' option object instead.
                                                                                                          bill_receiver_postal_codestring*This field is deprecated. Use the 'payment' option object instead.
                                                                                                          bill_third_party_accountstring*This field is deprecated. Use the 'payment' option object instead.
                                                                                                          bill_third_party_countrystring*This field is deprecated. Use the 'payment' option object instead.
                                                                                                          bill_third_party_postal_codestring*This field is deprecated. Use the 'payment' option object instead.
                                                                                                          by_dronebooleanSetting this option to true will indicate to the carrier to prefer delivery by drone, if the carrier supports drone delivery.
                                                                                                          carbon_neutralbooleanSetting this to true will add a charge to reduce carbon emissions by Carriers who support this option. Alternatively, see Carbon Offset which is provided by EasyPost and works with all Carriers.
                                                                                                          cod_amountstringAdding an amount will have the carrier collect the specified amount from the recipient.
                                                                                                          cod_methodstringMethod for payment. "CASH", "CHECK", "MONEY_ORDER"
                                                                                                          cod_address_idstringThe ID of the Address to which the COD payment should be returned. Defaults to the origin address. Only available on FedEx shipments.
                                                                                                          currencystringWhich currency this shipment will show for rates if carrier allows.
                                                                                                          delivery_confirmationstringIf you want to request a signature, you can pass "ADULT_SIGNATURE" or "SIGNATURE". You may also request "NO_SIGNATURE" to leave the package at the door. "NO_SIGNATURE" is equivalent to releasing liability. Some options may be limited for international shipments. Carrier specific delivery confirmation options are listed below:
                                                                                                          • FedEx - "INDIRECT_SIGNATURE" - Requires the signature of someone at the delivery address or from somebody nearby, such as a neighbor.
                                                                                                          • USPS - additional options
                                                                                                            • "ADULT_SIGNATURE_RESTRICTED" - Requires the signature of the addressee only, who must be 21 years of age or older.
                                                                                                            • "SIGNATURE_RESTRICTED" - Requires the signature of the recipient or a responsible party.
                                                                                                          • Canada Post - "DO_NOT_SAFE_DROP" - Tells the carrier to not hide the package ("safe drop").
                                                                                                          dropoff_typestringMethod the customer will use to transfer the package to the carrier. Supported dropoff types and their corresponding carrier dropoff codes are below:
                                                                                                          FedEx
                                                                                                          • "REGULAR_PICKUP" - Customer to transfer package during regular pickup (default)
                                                                                                          • "SCHEDULED_PICKUP" - Customer to transfer package during scheduled pickup
                                                                                                          • "RETAIL_LOCATION" - Customer to transfer package at FedEx retail location
                                                                                                          • "STATION" - "STATION"
                                                                                                          • "DROP_BOX" - Customer to use carrier drop box for package transfer
                                                                                                          dry_icebooleanPackage contents contain dry ice.
                                                                                                          • UPS - Need dry_ice_weight to be set
                                                                                                          • UPS MailInnovations - Need dry_ice_weight to be set
                                                                                                          • FedEx - Need dry_ice_weight to be set
                                                                                                          dry_ice_medicalbooleanIf the dry ice is for medical use, set this option to true.
                                                                                                          • UPS - Need dry_ice_weight to be set
                                                                                                          • UPS MailInnovations - Need dry_ice_weight to be set
                                                                                                          dry_ice_weightstringWeight of the dry ice in ounces.
                                                                                                          • UPS - Need dry_ice to be set
                                                                                                          • UPS MailInnovations - Need dry_ice to be set
                                                                                                          • FedEx - Need dry_ice to be set
                                                                                                          endorsementstringPossible values "ADDRESS_SERVICE_REQUESTED", "FORWARDING_SERVICE_REQUESTED", "CHANGE_SERVICE_REQUESTED", "RETURN_SERVICE_REQUESTED", "LEAVE_IF_NO_RESPONSE"
                                                                                                          end_shipper_idstringSpecify the responsible EndShipper for the shipment by passing in an EndShipper ID.
                                                                                                          freight_chargedoubleAdditional cost to be added to the invoice of this shipment. Only applies to UPS currently.
                                                                                                          handling_instructionsstringThis is to designate special instructions for the carrier like "Do not drop!".
                                                                                                          hazmatstringDangerous goods indicator. Possible values are "PRIMARY_CONTAINED", "PRIMARY_PACKED", "PRIMARY", "SECONDARY_CONTAINED", "SECONDARY_PACKED", "SECONDARY", "ORMD", "LIMITED_QUANTITY", "LITHIUM". Applies to USPS, FedEx and DHL eCommerce.
                                                                                                          hold_for_pickupbooleanPackage will wait at carrier facility for pickup.
                                                                                                          incotermstringIncoterm negotiated for shipment. Supported values are "EXW", "FCA", "CPT", "CIP", "DAT", "DAP", "DDP", "FAS", "FOB", "CFR", and "CIF". Setting this value to anything other than "DDP" will pass the cost and responsibility of duties on to the recipient of the package(s), as specified by Incoterms rules
                                                                                                          invoice_numberstringThis will print an invoice number on the postage label.
                                                                                                          label_datestringSet the date that will appear on the postage label. Accepts ISO 8601 formatted string including time zone offset. EasyPost stores all dates as UTC time.
                                                                                                          label_formatstringSupported label formats include "PNG", "PDF", "ZPL", and "EPL2". "PNG" is the only format that allows for conversion.
                                                                                                          machinablebooleanWhether or not the parcel can be processed by the carriers equipment.
                                                                                                          paymentobjectSetting payment type to bill the correct account for purchasing postage.
                                                                                                          • type - (string) Supported values are "SENDER", "THIRD_PARTY", "RECEIVER", "COLLECT". Defaults to SENDER.
                                                                                                          • account - (string) Setting account number. Required for RECEIVER and THIRD_PARTY.
                                                                                                          • country - (string) Setting country code that the account is based in. Required for THIRD_PARTY.
                                                                                                          • postal_code - (string) Setting postal code that the account is based in. Required for RECEIVER and THIRD_PARTY.
                                                                                                          print_custom_1stringYou can optionally print custom messages on labels. The locations of these fields show up on different spots on the carrier's labels.
                                                                                                          print_custom_2stringAn additional message on the label. Same restrictions as print_custom_1
                                                                                                          print_custom_3stringAn additional message on the label. Same restrictions as print_custom_1
                                                                                                          print_custom_1_barcodebooleanCreate a barcode for this custom reference if supported by carrier.
                                                                                                          print_custom_2_barcodebooleanCreate a barcode for this custom reference if supported by carrier.
                                                                                                          print_custom_3_barcodebooleanCreate a barcode for this custom reference if supported by carrier.
                                                                                                          print_custom_1_codestringSpecify the type of print_custom_1.
                                                                                                          FedEx
                                                                                                          • (null) - If print_custom_1_code is not provided it defaults to Customer Reference
                                                                                                          • PO - Purchase Order Number
                                                                                                          • DP - Department Number
                                                                                                          • RMA - Return Merchandise Authorization
                                                                                                          UPS
                                                                                                          • AJ - Accounts Receivable Customer Account
                                                                                                          • AT - Appropriation Number
                                                                                                          • BM - Bill of Lading Number
                                                                                                          • 9V - Collect on Delivery (COD) Number
                                                                                                          • ON - Dealer Order Number
                                                                                                          • DP - Department Number
                                                                                                          • 3Q - Food and Drug Administration (FDA) Product Code
                                                                                                          • IK - Invoice Number
                                                                                                          • MK - Manifest Key Number
                                                                                                          • MJ - Model Number
                                                                                                          • PM - Part Number
                                                                                                          • PC - Production Code
                                                                                                          • PO - Purchase Order Number
                                                                                                          • RQ - Purchase Request Number
                                                                                                          • RZ - Return Authorization Number
                                                                                                          • SA - Salesperson Number
                                                                                                          • SE - Serial Number
                                                                                                          • ST - Store Number
                                                                                                          • TN - Transaction Reference Number
                                                                                                          • EI - Employer's ID Number
                                                                                                          • TJ - Federal Taxpayer ID No.
                                                                                                          print_custom_2_codestringSee print_custom_1_code.
                                                                                                          print_custom_3_codestringSee print_custom_1_code.
                                                                                                          saturday_deliverybooleanSet this value to true for delivery on Saturday. When setting the saturday_delivery option, you will only get rates for services that are eligible for saturday delivery. If no services are available for saturday delivery, then you will not be returned any rates. You may need to create 2 shipments, one with the saturday_delivery option set on one without to get all your eligible rates.
                                                                                                          special_rates_eligibilitystringThis option allows you to request restrictive rates from USPS. Can set to 'USPS.MEDIAMAIL' or 'USPS.LIBRARYMAIL'.
                                                                                                          smartpost_hubstringYou can use this to override the hub ID you have on your account.
                                                                                                          smartpost_manifeststringThe manifest ID is used to group SmartPost packages onto a manifest for each trailer.
                                                                                                          billing_refstringA reference ID for aggregating DHL eCommerce billing data.
                                                                                                          certified_mailbooleanCertified Mail provides the sender with a mailing receipt and, upon request, electronic verification that an article was delivered or that a delivery attempt was made.
                                                                                                          registered_mailbooleanRegistered Mail is the most secure service that the USPS offers. It incorporates a system of receipts to monitor the movement of the mail from the point of acceptance to delivery
                                                                                                          registered_mail_amountdoubleThe value of the package contents
                                                                                                          return_receiptbooleanAn electronic return receipt may be purchased at the time of mailing and provides a shipper with evidence of delivery (to whom the mail was delivered and date of delivery), and information about the recipient's actual delivery address. Only applies to the USPS.
                                                                                                          POST/shipments

                                                                                                          Create a Shipment with Options

                                                                                                          Any number of options can be specified during Shipment creation.

                                                                                                          Create Shipment Example
                                                                                                          import com.easypost.EasyPost;
                                                                                                          import com.easypost.exception.EasyPostException;
                                                                                                          
                                                                                                          EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                          
                                                                                                          Map<String, Object> toAddressMap = new HashMap<String, Object>();
                                                                                                          ...
                                                                                                          Map<String, Object> fromAddressMap = new HashMap<String, Object>();
                                                                                                          ...
                                                                                                          Map<String, Object> parcelMap = new HashMap<String, Object>();
                                                                                                          ...
                                                                                                          
                                                                                                          Map<String, Object> optionsMap = new HashMap<String, Object>();
                                                                                                          optionsMap.put("address_validation_level", "0");
                                                                                                          
                                                                                                          Map<String, Object> shipmentMap = new HashMap<String, Object>();
                                                                                                          shipmentMap.put("to_address", toAddressMap);
                                                                                                          shipmentMap.put("from_address", fromAddressMap);
                                                                                                          shipmentMap.put("parcel", parcelMap);
                                                                                                          shipmentMap.put("options", optionsMap);
                                                                                                          
                                                                                                          Shipment shipment = Shipment.create(shipmentMap);
                                                                                                          {
                                                                                                            "id": "shp_...",
                                                                                                            "object": "Shipment",
                                                                                                            "mode": "test",
                                                                                                            "options": {"address_validation_level": "0"},
                                                                                                            "to_address": {
                                                                                                              "city": "Redondo Beach",
                                                                                                              "company": null,
                                                                                                              "country": "US",
                                                                                                              "created_at": "2013-11-08T15:49:58Z",
                                                                                                              "email": "dr_steve_brule@gmail.com",
                                                                                                              "id": "adr_...",
                                                                                                              "mode": "test",
                                                                                                              "name": "Dr. Steve Brule",
                                                                                                              "object": "Address",
                                                                                                              "phone": null,
                                                                                                              "state": "CA",
                                                                                                              "street1": "179 N Harbor Dr",
                                                                                                              "street2": null,
                                                                                                              "updated_at": "2013-11-08T15:49:58Z",
                                                                                                              "zip": "90277"
                                                                                                            },
                                                                                                            "from_address": {
                                                                                                              "city": "San Francisco",
                                                                                                              "company": null,
                                                                                                              "country": "US",
                                                                                                              "created_at": "2013-11-08T15:49:59Z",
                                                                                                              "email": null,
                                                                                                              "id": "adr_...",
                                                                                                              "mode": "test",
                                                                                                              "name": "EasyPost",
                                                                                                              "object": "Address",
                                                                                                              "phone": "415-379-7678",
                                                                                                              "state": "CA",
                                                                                                              "street1": "417 Montgomery Street",
                                                                                                              "street2": "5th Floor",
                                                                                                              "updated_at": "2013-11-08T15:49:59Z",
                                                                                                              "zip": "94104"
                                                                                                            },
                                                                                                            "parcel": {
                                                                                                              "id": "prcl_...",
                                                                                                              "object": "Parcel",
                                                                                                              "length": 20.2,
                                                                                                              "width": 10.9,
                                                                                                              "height": 5.0,
                                                                                                              "predefined_package": null,
                                                                                                              "weight": 140.8,
                                                                                                              "created_at": "2013-04-22T05:39:57Z",
                                                                                                              "updated_at": "2013-04-22T05:39:57Z"
                                                                                                            },
                                                                                                            "customs_info": {
                                                                                                              "id": "cstinfo_...",
                                                                                                              "object": "CustomsInfo",
                                                                                                              "created_at": "2013-04-22T05:39:57Z",
                                                                                                              "updated_at": "2013-04-22T05:39:57Z",
                                                                                                              "contents_explanation": null,
                                                                                                              "contents_type": "merchandise",
                                                                                                              "customs_certify": false,
                                                                                                              "customs_signer": null,
                                                                                                              "eel_pfc": null,
                                                                                                              "non_delivery_option": "return",
                                                                                                              "restriction_comments": null,
                                                                                                              "restriction_type": "none",
                                                                                                              "customs_items": [
                                                                                                                {
                                                                                                                  "id": "cstitem_...",
                                                                                                                  "object": "CustomsItem",
                                                                                                                  "description": "Many, many EasyPost stickers.",
                                                                                                                  "hs_tariff_number": "123456",
                                                                                                                  "origin_country": "US",
                                                                                                                  "quantity": 1,
                                                                                                                  "value": 879,
                                                                                                                  "weight": 140,
                                                                                                                  "created_at": "2013-04-22T05:39:57Z",
                                                                                                                  "updated_at": "2013-04-22T05:39:57Z"
                                                                                                                }
                                                                                                              ]
                                                                                                            },
                                                                                                            "rates": [
                                                                                                              {
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "billing_type": "easypost",
                                                                                                                "service": "FirstClassPackageInternationalService",
                                                                                                                "rate": "9.50",
                                                                                                                "carrier": "USPS",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "delivery_days": 4,
                                                                                                                "delivery_date": "2013-04-26T05:40:57Z",
                                                                                                                "delivery_date_guaranteed": false,
                                                                                                                "created_at": "2013-04-22T05:40:57Z",
                                                                                                                "updated_at": "2013-04-22T05:40:57Z"
                                                                                                              }, {
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "billing_type": "easypost",
                                                                                                                "service": "PriorityMailInternational",
                                                                                                                "rate": "27.40",
                                                                                                                "carrier": "USPS",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "delivery_days": 2,
                                                                                                                "delivery_date": "2013-04-24T05:40:57Z",
                                                                                                                "delivery_date_guaranteed": false,
                                                                                                                "created_at": "2013-04-22T05:40:57Z",
                                                                                                                "updated_at": "2013-04-22T05:40:57Z"
                                                                                                              }, {
                                                                                                                "id": "rate_...",
                                                                                                                "object": "Rate",
                                                                                                                "billing_type": "easypost",
                                                                                                                "service": "ExpressMailInternational",
                                                                                                                "rate": "35.48",
                                                                                                                "carrier": "USPS",
                                                                                                                "shipment_id": "shp_...",
                                                                                                                "delivery_days": 1,
                                                                                                                "delivery_date": "2013-04-23T05:40:57Z",
                                                                                                                "delivery_date_guaranteed": true,
                                                                                                                "created_at": "2013-04-22T05:40:57Z",
                                                                                                                "updated_at": "2013-04-22T05:40:57Z"
                                                                                                              }
                                                                                                            ],
                                                                                                            "scan_form": null,
                                                                                                            "selected_rate": null,
                                                                                                            "postage_label": null,
                                                                                                            "tracking_code": null,
                                                                                                            "refund_status": null,
                                                                                                            "insurance": null,
                                                                                                            "created_at": "2013-04-22T05:40:57Z",
                                                                                                            "updated_at": "2013-04-22T05:40:57Z"
                                                                                                          }

                                                                                                          Rates

                                                                                                          After a Shipment is successfully created, it will automatically fetch Rates. You can limit the CarrierAccounts to use for rating by passing the carrier_accounts parameter upon Shipment creation.

                                                                                                          There are three rate types: the actual rate that will be purchased, rate and currency, the published non-discounted rate, list_rate and list_currency, and the rate if purchased from the post office, retail_rate and retail_currency.

                                                                                                          Rate Object

                                                                                                          attributetypespecification
                                                                                                          idstringunique, begins with 'rate_'
                                                                                                          objectstring"Rate"
                                                                                                          modestring"test" or "production"
                                                                                                          servicestringservice level/name
                                                                                                          carrierstringname of carrier
                                                                                                          carrier_account_idstringID of the CarrierAccount record used to generate this rate
                                                                                                          shipment_idstringID of the Shipment this rate belongs to
                                                                                                          ratestringthe actual rate quote for this service
                                                                                                          currencystringcurrency for the rate
                                                                                                          retail_ratestringthe retail rate is the in-store rate given with no account
                                                                                                          retail_currencystringcurrency for the retail rate
                                                                                                          list_ratestringthe list rate is the non-negotiated rate given for having an account with the carrier
                                                                                                          list_currencystringcurrency for the list rate
                                                                                                          delivery_daysintegerdelivery days for this service
                                                                                                          delivery_datestringdate for delivery
                                                                                                          delivery_date_guaranteedbooleanindicates if delivery window is guaranteed (true) or not (false)
                                                                                                          est_delivery_days*integer*This field is deprecated and should be ignored.
                                                                                                          billing_typestringBilling type of the rate
                                                                                                          carbon_offsetCarbonOffsetthe associated CarbonOffset object, if requested
                                                                                                          created_atdatetime
                                                                                                          updated_atdatetime

                                                                                                          Service Levels

                                                                                                          AmazonMws
                                                                                                          • UPS Rates
                                                                                                          • USPS Rates
                                                                                                          • FedEx Rates
                                                                                                          • UPS Labels
                                                                                                          • USPS Labels
                                                                                                          • FedEx Labels
                                                                                                          • UPS Tracking
                                                                                                          • USPS Tracking
                                                                                                          • FedEx Tracking
                                                                                                          APC
                                                                                                          • parcelConnectBookService
                                                                                                          • parcelConnectExpeditedDDP
                                                                                                          • parcelConnectExpeditedDDU
                                                                                                          • parcelConnectPriorityDDP
                                                                                                          • parcelConnectPriorityDDPDelcon
                                                                                                          • parcelConnectPriorityDDU
                                                                                                          • parcelConnectPriorityDDUDelcon
                                                                                                          • parcelConnectPriorityDDUPQW
                                                                                                          • parcelConnectStandardDDU
                                                                                                          • parcelConnectStandardDDUPQW
                                                                                                          • parcelConnectPacketDDU
                                                                                                          Asendia
                                                                                                          • PMI
                                                                                                          • ePacket
                                                                                                          • IPA
                                                                                                          • ISAL
                                                                                                          Asendia USA
                                                                                                          • ADS
                                                                                                          • AirFreightInbound
                                                                                                          • AirFreightOutbound
                                                                                                          • AsendiaDomesticBoundPrinterMatterExpedited
                                                                                                          • AsendiaDomesticBoundPrinterMatterGround
                                                                                                          • AsendiaDomesticFlatsExpedited
                                                                                                          • AsendiaDomesticFlatsGround
                                                                                                          • AsendiaDomesticParcelGroundOver1lb
                                                                                                          • AsendiaDomesticParcelGroundUnder1lb
                                                                                                          • AsendiaDomesticParcelMAXOver1lb
                                                                                                          • AsendiaDomesticParcelMAXUnder1lb
                                                                                                          • AsendiaDomesticParcelOver1lbExpedited
                                                                                                          • AsendiaDomesticParcelUnder1lbExpedited
                                                                                                          • AsendiaDomesticPromoParcelExpedited
                                                                                                          • AsendiaDomesticPromoParcelGround
                                                                                                          • BulkFreight
                                                                                                          • BusinessMailCanadaLettermail
                                                                                                          • BusinessMailCanadaLettermailMachineable
                                                                                                          • BusinessMailEconomy
                                                                                                          • BusinessMailEconomyLPWholesale
                                                                                                          • BusinessMailEconomySPWholesale
                                                                                                          • BusinessMailIPA
                                                                                                          • BusinessMailISAL
                                                                                                          • BusinessMailPriority
                                                                                                          • BusinessMailPriorityLPWholesale
                                                                                                          • BusinessMailPrioritySPWholesale
                                                                                                          • MarketingMailCanadaPersonalizedLCP
                                                                                                          • MarketingMailCanadaPersonalizedMachineable
                                                                                                          • MarketingMailCanadaPersonalizedNDG
                                                                                                          • MarketingMailEconomy
                                                                                                          • MarketingMailIPA
                                                                                                          • MarketingMailISAL
                                                                                                          • MarketingMailPriority
                                                                                                          • PublicationsCanadaLCP
                                                                                                          • PublicationsCanadaNDG
                                                                                                          • PublicationsEconomy
                                                                                                          • PublicationsIPA
                                                                                                          • PublicationsISAL
                                                                                                          • PublicationsPriority
                                                                                                          • ePAQElite
                                                                                                          • ePAQEliteCustom
                                                                                                          • ePAQEliteDAP
                                                                                                          • ePAQEliteDDP
                                                                                                          • ePAQEliteDDPOversized
                                                                                                          • ePAQEliteDPD
                                                                                                          • ePAQEliteDirectAccessCanadaDDP
                                                                                                          • ePAQEliteOversized
                                                                                                          • ePAQPlus
                                                                                                          • ePAQPlusCustom
                                                                                                          • ePAQPlusCustomsPrepaid
                                                                                                          • ePAQPlusDAP
                                                                                                          • ePAQPlusDDP
                                                                                                          • ePAQPlusEconomy
                                                                                                          • ePAQPlusWholesale
                                                                                                          • ePAQPlusePacket
                                                                                                          • ePAQPlusePacketCanadaCustomsPrePaid
                                                                                                          • ePAQPlusePacketCanadaDDP
                                                                                                          • ePAQReturnsDomestic
                                                                                                          • ePAQReturnsInternational
                                                                                                          • ePAQSelect
                                                                                                          • ePAQSelectCustom
                                                                                                          • ePAQSelectCustomsPrepaidByShopper
                                                                                                          • ePAQSelectDAP
                                                                                                          • ePAQSelectDDP
                                                                                                          • ePAQSelectDDPDirectAccess
                                                                                                          • ePAQSelectDirectAccess
                                                                                                          • ePAQSelectDirectAccessCanadaDDP
                                                                                                          • ePAQSelectEconomy
                                                                                                          • ePAQSelectOversized
                                                                                                          • ePAQSelectOversizedDDP
                                                                                                          • ePAQSelectPMEI
                                                                                                          • ePAQSelectPMEICanadaCustomsPrePaid
                                                                                                          • ePAQSelectPMEIPCPostage
                                                                                                          • ePAQSelectPMI
                                                                                                          • ePAQSelectPMICanadaCustomsPrepaid
                                                                                                          • ePAQSelectPMICanadaDDP
                                                                                                          • ePAQSelectPMINonPresort
                                                                                                          • ePAQSelectPMIPCPostage
                                                                                                          • ePAQStandard
                                                                                                          • ePAQStandardCustom
                                                                                                          • ePAQStandardEconomy
                                                                                                          • ePAQStandardIPA
                                                                                                          • ePAQStandardISAL
                                                                                                          • ePaqSelectPMEINonPresort
                                                                                                          Australia Post
                                                                                                          • ExpressPost
                                                                                                          • ExpressPostSignature
                                                                                                          • ParcelPost
                                                                                                          • ParcelPostSignature
                                                                                                          • ParcelPostExtra
                                                                                                          • ParcelPostWinePlusSignature
                                                                                                          AxlehireV3
                                                                                                          • AxleHireDelivery
                                                                                                          Better Trucks
                                                                                                          • NEXT_DAY
                                                                                                          Bond
                                                                                                          • Standard
                                                                                                          Canada Post
                                                                                                          • RegularParcel
                                                                                                          • ExpeditedParcel
                                                                                                          • Xpresspost
                                                                                                          • XpresspostCertified
                                                                                                          • Priority
                                                                                                          • LibraryBooks
                                                                                                          • ExpeditedParcelUSA
                                                                                                          • PriorityWorldwideEnvelopeUSA
                                                                                                          • PriorityWorldwidePakUSA
                                                                                                          • PriorityWorldwideParcelUSA
                                                                                                          • SmallPacketUSAAir
                                                                                                          • TrackedPacketUSA
                                                                                                          • TrackedPacketUSALVM
                                                                                                          • XpresspostUSA
                                                                                                          • XpresspostInternational
                                                                                                          • InternationalParcelAir
                                                                                                          • InternationalParcelSurface
                                                                                                          • PriorityWorldwideEnvelopeIntl
                                                                                                          • PriorityWorldwidePakIntl
                                                                                                          • PriorityWorldwideParcelIntl
                                                                                                          • SmallPacketInternationalAir
                                                                                                          • SmallPacketInternationalSurface
                                                                                                          • TrackedPacketInternational
                                                                                                          Canpar
                                                                                                          • Ground
                                                                                                          • SelectLetter
                                                                                                          • SelectPak
                                                                                                          • Select
                                                                                                          • OvernightLetter
                                                                                                          • OvernightPak
                                                                                                          • Overnight
                                                                                                          • SelectUSA
                                                                                                          • USAPak
                                                                                                          • USALetter
                                                                                                          • USA
                                                                                                          • International
                                                                                                          CDL Last Mile Solutions
                                                                                                          • DISTRIBUTION
                                                                                                          • Same Day
                                                                                                          Chronopost

                                                                                                          No service levels for Chronopost.

                                                                                                            CloudSort

                                                                                                            No service levels for CloudSort.

                                                                                                              Courier Express
                                                                                                              • BASIC_PARCEL
                                                                                                              CouriersPlease
                                                                                                              • DomesticPrioritySignature
                                                                                                              • DomesticPriority
                                                                                                              • DomesticOffPeakSignature
                                                                                                              • DomesticOffPeak
                                                                                                              • GoldDomesticSignature
                                                                                                              • GoldDomestic
                                                                                                              • AustralianCityExpressSignature
                                                                                                              • AustralianCityExpress
                                                                                                              • DomesticSaverSignature
                                                                                                              • DomesticSaver
                                                                                                              • RoadExpress
                                                                                                              • 5KgSatchel
                                                                                                              • 3KgSatchel
                                                                                                              • 1KgSatchel
                                                                                                              • 5KgSatchelATL
                                                                                                              • 3KgSatchelATL
                                                                                                              • 1KgSatchelATL
                                                                                                              • 500GramSatchel
                                                                                                              • 500GramSatchelATL
                                                                                                              • 25KgParcel
                                                                                                              • 10KgParcel
                                                                                                              • 5KgParcel
                                                                                                              • 3KgParcel
                                                                                                              • 1KgParcel
                                                                                                              • 500GramParcel
                                                                                                              • 500GramParcelATL
                                                                                                              • ExpressInternationalPriority
                                                                                                              • InternationalSaver
                                                                                                              • InternationalExpressImport
                                                                                                              • InternationalExpress
                                                                                                              Dai Post
                                                                                                              • DomesticTracked
                                                                                                              • InternationalEconomy
                                                                                                              • InternationalStandard
                                                                                                              • InternationalExpress
                                                                                                              Deutsche Post
                                                                                                              • PacketPlus
                                                                                                              Deutsche Post UK
                                                                                                              • PriorityPacketPlus
                                                                                                              • PriorityPacket
                                                                                                              • PriorityPacketTracked
                                                                                                              • BusinessMailRegistered
                                                                                                              • StandardPacket
                                                                                                              • BusinessMailStandard
                                                                                                              DHL eCommerce Asia
                                                                                                              • Packet
                                                                                                              • PacketPlus
                                                                                                              • ParcelDirect
                                                                                                              • ParcelDirectExpedited
                                                                                                              DHL eCommerce Solutions
                                                                                                              • DHLParcelExpedited
                                                                                                              • DHLParcelExpeditedMax
                                                                                                              • DHLParcelGround
                                                                                                              • DHLBPMExpedited
                                                                                                              • DHLBPMGround
                                                                                                              • DHLParcelInternationalDirect
                                                                                                              • DHLParcelInternationalStandard
                                                                                                              • DHLPacketInternational
                                                                                                              • DHLParcelInternationalDirectPriority
                                                                                                              • DHLParcelInternationalDirectStandard
                                                                                                              DHL Express
                                                                                                              • BreakBulkEconomy
                                                                                                              • BreakBulkExpress
                                                                                                              • DomesticEconomySelect
                                                                                                              • DomesticExpress
                                                                                                              • DomesticExpress1030
                                                                                                              • DomesticExpress1200
                                                                                                              • EconomySelect
                                                                                                              • EconomySelectNonDoc
                                                                                                              • EuroPack
                                                                                                              • EuropackNonDoc
                                                                                                              • Express1030
                                                                                                              • Express1030NonDoc
                                                                                                              • Express1200NonDoc
                                                                                                              • Express1200
                                                                                                              • Express900
                                                                                                              • Express900NonDoc
                                                                                                              • ExpressEasy
                                                                                                              • ExpressEasyNonDoc
                                                                                                              • ExpressEnvelope
                                                                                                              • ExpressWorldwide
                                                                                                              • ExpressWorldwideB2C
                                                                                                              • ExpressWorldwideB2CNonDoc
                                                                                                              • ExpressWorldwideECX
                                                                                                              • ExpressWorldwideNonDoc
                                                                                                              • FreightWorldwide
                                                                                                              • GlobalmailBusiness
                                                                                                              • JetLine
                                                                                                              • JumboBox
                                                                                                              • LogisticsServices
                                                                                                              • SameDay
                                                                                                              • SecureLine
                                                                                                              • SprintLine
                                                                                                              DPD
                                                                                                              • DPDCLASSIC
                                                                                                              • DPD8:30
                                                                                                              • DPD10:00
                                                                                                              • DPD12:00
                                                                                                              • DPD18:00
                                                                                                              • DPDEXPRESS
                                                                                                              • DPDPARCELLETTER
                                                                                                              • DPDPARCELLETTERPLUS
                                                                                                              • DPDINTERNATIONALMAIL
                                                                                                              DPD UK
                                                                                                              • AirExpressInternationalAir
                                                                                                              • AirClassicInternationalAir
                                                                                                              • ParcelSunday
                                                                                                              • FreightParcelSunday
                                                                                                              • PalletSunday
                                                                                                              • PalletDpdClassic
                                                                                                              • ExpresspakDpdClassic
                                                                                                              • ExpresspakSunday
                                                                                                              • ParcelDpdClassic
                                                                                                              • ParcelDpdTwoDay
                                                                                                              • ParcelDpdNextDay
                                                                                                              • ParcelDpd12
                                                                                                              • ParcelDpd10
                                                                                                              • ParcelReturnToShop
                                                                                                              • ParcelSaturday
                                                                                                              • ParcelSaturday12
                                                                                                              • ParcelSaturday10
                                                                                                              • ParcelSunday12
                                                                                                              • FreightParcelDpdClassic
                                                                                                              • FreightParcelSunday12
                                                                                                              • ExpresspakDpdNextDay
                                                                                                              • ExpresspakDpd12
                                                                                                              • ExpresspakDpd10
                                                                                                              • ExpresspakSaturday
                                                                                                              • ExpresspakSaturday12
                                                                                                              • ExpresspakSaturday10
                                                                                                              • ExpresspakSunday12
                                                                                                              • PalletSunday12
                                                                                                              • PalletDpdTwoDay
                                                                                                              • PalletDpdNextDay
                                                                                                              • PalletDpd12
                                                                                                              • PalletDpd10
                                                                                                              • PalletSaturday
                                                                                                              • PalletSaturday12
                                                                                                              • PalletSaturday10
                                                                                                              • FreightParcelDpdTwoDay
                                                                                                              • FreightParcelDpdNextDay
                                                                                                              • FreightParcelDpd12
                                                                                                              • FreightParcelDpd10
                                                                                                              • FreightParcelSaturday
                                                                                                              • FreightParcelSaturday12
                                                                                                              • FreightParcelSaturday10
                                                                                                              ePost Global
                                                                                                              • CourierServiceDDP
                                                                                                              • CourierServiceDDU
                                                                                                              • DomesticEconomyParcel
                                                                                                              • DomesticParcelBPM
                                                                                                              • DomesticPriorityParcel
                                                                                                              • DomesticPriorityParcelBPM
                                                                                                              • EMIService
                                                                                                              • EconomyParcelService
                                                                                                              • IPAService
                                                                                                              • ISALService
                                                                                                              • PMIService
                                                                                                              • PriorityParcelDDP
                                                                                                              • PriorityParcelDDU
                                                                                                              • PriorityParcelDeliveryConfirmationDDP
                                                                                                              • PriorityParcelDeliveryConfirmationDDU
                                                                                                              • ePacketService
                                                                                                              Estafeta
                                                                                                              • NextDayBy930
                                                                                                              • NextDayBy1130
                                                                                                              • NextDay
                                                                                                              • Ground
                                                                                                              • TwoDay
                                                                                                              • LTL
                                                                                                              Evri
                                                                                                              • DomesticDelivery
                                                                                                              • DomesticDeliverySigned
                                                                                                              • InternationalDelivery
                                                                                                              • InternationalDeliverySigned
                                                                                                              Fastway
                                                                                                              • Parcel
                                                                                                              • Satchel
                                                                                                              FedEx
                                                                                                              • FEDEX_GROUND
                                                                                                              • FEDEX_2_DAY
                                                                                                              • FEDEX_2_DAY_AM
                                                                                                              • FEDEX_EXPRESS_SAVER
                                                                                                              • STANDARD_OVERNIGHT
                                                                                                              • FIRST_OVERNIGHT
                                                                                                              • PRIORITY_OVERNIGHT
                                                                                                              • INTERNATIONAL_ECONOMY
                                                                                                              • INTERNATIONAL_FIRST
                                                                                                              • INTERNATIONAL_PRIORITY
                                                                                                              • FEDEX_INTERNATIONAL_CONNECT_PLUS
                                                                                                              • GROUND_HOME_DELIVERY
                                                                                                              • SMART_POST
                                                                                                              FedEx Cross Border
                                                                                                              • CBEC
                                                                                                              • CBECL
                                                                                                              • CBECP
                                                                                                              FedEx Mailview

                                                                                                              No service levels for FedEx Mailview.

                                                                                                                FedEx SameDay City
                                                                                                                • EconomyService
                                                                                                                • StandardService
                                                                                                                • PriorityService
                                                                                                                • LastMile
                                                                                                                FedEx SmartPost
                                                                                                                • SMART_POST
                                                                                                                FirstMile

                                                                                                                No service levels for FirstMile.

                                                                                                                  Globegistics
                                                                                                                  • PMEI
                                                                                                                  • PMI
                                                                                                                  • eComDomestic
                                                                                                                  • eComEurope
                                                                                                                  • eComExpress
                                                                                                                  • eComExtra
                                                                                                                  • eComIPA
                                                                                                                  • eComISAL
                                                                                                                  • eComPMEIDutyPaid
                                                                                                                  • eComPMIDutyPaid
                                                                                                                  • eComPacket
                                                                                                                  • eComPacketDDP
                                                                                                                  • eComPriority
                                                                                                                  • eComStandard
                                                                                                                  • eComTrackedDDP
                                                                                                                  • eComTrackedDDU
                                                                                                                  GSO
                                                                                                                  • EarlyPriorityOvernight
                                                                                                                  • PriorityOvernight
                                                                                                                  • CaliforniaParcelService
                                                                                                                  • SaturdayDeliveryService
                                                                                                                  • EarlySaturdayService
                                                                                                                  • Ground
                                                                                                                  • Overnight
                                                                                                                  Interlink Express
                                                                                                                  • InterlinkAirClassicInternationalAir
                                                                                                                  • InterlinkAirExpressInternationalAir
                                                                                                                  • InterlinkExpresspak1By10:30
                                                                                                                  • InterlinkExpresspak1By12
                                                                                                                  • InterlinkExpresspak1NextDay
                                                                                                                  • InterlinkExpresspak1Saturday
                                                                                                                  • InterlinkExpresspak1SaturdayBy10:30
                                                                                                                  • InterlinkExpresspak1SaturdayBy12
                                                                                                                  • InterlinkExpresspak1Sunday
                                                                                                                  • InterlinkExpresspak1SundayBy12
                                                                                                                  • InterlinkExpresspak5By10
                                                                                                                  • InterlinkExpresspak5By10:30
                                                                                                                  • InterlinkExpresspak5By12
                                                                                                                  • InterlinkExpresspak5NextDay
                                                                                                                  • InterlinkExpresspak5Saturday
                                                                                                                  • InterlinkExpresspak5SaturdayBy10
                                                                                                                  • InterlinkExpresspak5SaturdayBy10:30
                                                                                                                  • InterlinkExpresspak5SaturdayBy12
                                                                                                                  • InterlinkExpresspak5Sunday
                                                                                                                  • InterlinkExpresspak5SundayBy12
                                                                                                                  • InterlinkFreightBy10
                                                                                                                  • InterlinkFreightBy12
                                                                                                                  • InterlinkFreightNextDay
                                                                                                                  • InterlinkFreightSaturday
                                                                                                                  • InterlinkFreightSaturdayBy10
                                                                                                                  • InterlinkFreightSaturdayBy12
                                                                                                                  • InterlinkFreightSunday
                                                                                                                  • InterlinkFreightSundayBy12
                                                                                                                  • InterlinkParcelBy10
                                                                                                                  • InterlinkParcelBy10:30
                                                                                                                  • InterlinkParcelBy12
                                                                                                                  • InterlinkParcelDpdEuropeByRoad
                                                                                                                  • InterlinkParcelNextDay
                                                                                                                  • InterlinkParcelReturn
                                                                                                                  • InterlinkParcelReturnToShop
                                                                                                                  • InterlinkParcelSaturday
                                                                                                                  • InterlinkParcelSaturdayBy10
                                                                                                                  • InterlinkParcelSaturdayBy10:30
                                                                                                                  • InterlinkParcelSaturdayBy12
                                                                                                                  • InterlinkParcelShipToShop
                                                                                                                  • InterlinkParcelSunday
                                                                                                                  • InterlinkParcelSundayBy12
                                                                                                                  • InterlinkParcelTwoDay
                                                                                                                  • InterlinkPickupParcelDpdEuropeByRoad
                                                                                                                  JP Post

                                                                                                                  No service levels for JP Post.

                                                                                                                    Kuroneko Yamato

                                                                                                                    No service levels for Kuroneko Yamato.

                                                                                                                      La Poste

                                                                                                                      No service levels for La Poste.

                                                                                                                        LaserShip
                                                                                                                        • SameDay
                                                                                                                        • NextDay
                                                                                                                        • Weekend
                                                                                                                        Loomis Express
                                                                                                                        • LoomisGround
                                                                                                                        • LoomisExpress1800
                                                                                                                        • LoomisExpress1200
                                                                                                                        • LoomisExpress900
                                                                                                                        LSO
                                                                                                                        • GroundEarly
                                                                                                                        • GroundBasic
                                                                                                                        • PriorityBasic
                                                                                                                        • PriorityEarly
                                                                                                                        • PrioritySaturday
                                                                                                                        • Priority2ndDay
                                                                                                                        • SameDay
                                                                                                                        Newgistics
                                                                                                                        • ParcelSelect
                                                                                                                        • ParcelSelectLightweight
                                                                                                                        • Ground
                                                                                                                        • Express
                                                                                                                        • FirstClassMail
                                                                                                                        • PriorityMail
                                                                                                                        • BoundPrintedMatter
                                                                                                                        OnTrac
                                                                                                                        • Sunrise
                                                                                                                        • Gold
                                                                                                                        • OnTracGround
                                                                                                                        • SameDay
                                                                                                                        • PalletizedFreight
                                                                                                                        Osm Worldwide
                                                                                                                        • First
                                                                                                                        • Expedited
                                                                                                                        • ParcelSelectLightweight
                                                                                                                        • Priority
                                                                                                                        • BPM
                                                                                                                        • ParcelSelect
                                                                                                                        • MediaMail
                                                                                                                        • MarketingParcel
                                                                                                                        • MarketingParcelTracked
                                                                                                                        Parcelforce
                                                                                                                        • Express9
                                                                                                                        • Express9Secure
                                                                                                                        • Express9CourierPack
                                                                                                                        • Express10
                                                                                                                        • Express10Secure
                                                                                                                        • Express10Exchange
                                                                                                                        • Express10SecureExchange
                                                                                                                        • Express10CourierPack
                                                                                                                        • ExpressAM
                                                                                                                        • ExpressAMSecure
                                                                                                                        • ExpressAMExchange
                                                                                                                        • ExpressAMSecureExchange
                                                                                                                        • ExpressAMCourierPack
                                                                                                                        • ExpressPM
                                                                                                                        • ExpressPMSecure
                                                                                                                        • Express24
                                                                                                                        • Express24Large
                                                                                                                        • Express24Secure
                                                                                                                        • Express24Exchange
                                                                                                                        • Express24SecureExchange
                                                                                                                        • Express24CourierPack
                                                                                                                        • Express48
                                                                                                                        • Express48Large
                                                                                                                        • ParcelRiderPlus
                                                                                                                        • GlobalBulkDirect
                                                                                                                        • GlobalExpress
                                                                                                                        • GlobalExpressEnvelopeDelivery
                                                                                                                        • GlobalExpressPackDelivery
                                                                                                                        • GlobalValue
                                                                                                                        • GlobalPriority
                                                                                                                        • GlobalPriorityReturns
                                                                                                                        • EuroPriorityHome
                                                                                                                        • EuroPriorityBusiness
                                                                                                                        • IrelandExpress
                                                                                                                        PARCLL
                                                                                                                        • Economy West
                                                                                                                        • Economy East
                                                                                                                        • Economy Central
                                                                                                                        • Economy Northeast
                                                                                                                        • Economy South
                                                                                                                        • Expedited West
                                                                                                                        • Expedited Northeast
                                                                                                                        • Regional West
                                                                                                                        • Regional East
                                                                                                                        • Regional Central
                                                                                                                        • Regional Northeast
                                                                                                                        • Regional South
                                                                                                                        • US to Canada Economy West
                                                                                                                        • US to Canada Economy Central
                                                                                                                        • US to Canada Economy Northeast
                                                                                                                        • US to Europe Economy West
                                                                                                                        • US to Europe Economy Northeast
                                                                                                                        Passport

                                                                                                                        No service levels for Passport.

                                                                                                                          PostNL

                                                                                                                          No service levels for PostNL.

                                                                                                                            Purolator
                                                                                                                            • PurolatorExpress
                                                                                                                            • PurolatorExpress12PM
                                                                                                                            • PurolatorExpressPack12PM
                                                                                                                            • PurolatorExpressBox12PM
                                                                                                                            • PurolatorExpressEnvelope12PM
                                                                                                                            • PurolatorExpress1030AM
                                                                                                                            • PurolatorExpress9AM
                                                                                                                            • PurolatorExpressBox
                                                                                                                            • PurolatorExpressBox1030AM
                                                                                                                            • PurolatorExpressBox9AM
                                                                                                                            • PurolatorExpressBoxEvening
                                                                                                                            • PurolatorExpressBoxInternational
                                                                                                                            • PurolatorExpressBoxInternational1030AM
                                                                                                                            • PurolatorExpressBoxInternational1200
                                                                                                                            • PurolatorExpressBoxInternational9AM
                                                                                                                            • PurolatorExpressBoxUS
                                                                                                                            • PurolatorExpressBoxUS1030AM
                                                                                                                            • PurolatorExpressBoxUS1200
                                                                                                                            • PurolatorExpressBoxUS9AM
                                                                                                                            • PurolatorExpressEnvelope
                                                                                                                            • PurolatorExpressEnvelope1030AM
                                                                                                                            • PurolatorExpressEnvelope9AM
                                                                                                                            • PurolatorExpressEnvelopeEvening
                                                                                                                            • PurolatorExpressEnvelopeInternational
                                                                                                                            • PurolatorExpressEnvelopeInternational1030AM
                                                                                                                            • PurolatorExpressEnvelopeInternational1200
                                                                                                                            • PurolatorExpressEnvelopeInternational9AM
                                                                                                                            • PurolatorExpressEnvelopeUS
                                                                                                                            • PurolatorExpressEnvelopeUS1030AM
                                                                                                                            • PurolatorExpressEnvelopeUS1200
                                                                                                                            • PurolatorExpressEnvelopeUS9AM
                                                                                                                            • PurolatorExpressEvening
                                                                                                                            • PurolatorExpressInternational
                                                                                                                            • PurolatorExpressInternational1030AM
                                                                                                                            • PurolatorExpressInternational1200
                                                                                                                            • PurolatorExpressInternational9AM
                                                                                                                            • PurolatorExpressPack
                                                                                                                            • PurolatorExpressPack1030AM
                                                                                                                            • PurolatorExpressPack9AM
                                                                                                                            • PurolatorExpressPackEvening
                                                                                                                            • PurolatorExpressPackInternational
                                                                                                                            • PurolatorExpressPackInternational1030AM
                                                                                                                            • PurolatorExpressPackInternational1200
                                                                                                                            • PurolatorExpressPackInternational9AM
                                                                                                                            • PurolatorExpressPackUS
                                                                                                                            • PurolatorExpressPackUS1030AM
                                                                                                                            • PurolatorExpressPackUS1200
                                                                                                                            • PurolatorExpressPackUS9AM
                                                                                                                            • PurolatorExpressUS
                                                                                                                            • PurolatorExpressUS1030AM
                                                                                                                            • PurolatorExpressUS1200
                                                                                                                            • PurolatorExpressUS9AM
                                                                                                                            • PurolatorGround
                                                                                                                            • PurolatorGround1030AM
                                                                                                                            • PurolatorGround9AM
                                                                                                                            • PurolatorGroundDistribution
                                                                                                                            • PurolatorGroundEvening
                                                                                                                            • PurolatorGroundRegional
                                                                                                                            • PurolatorGroundUS
                                                                                                                            Royal Mail
                                                                                                                            • InternationalSigned
                                                                                                                            • InternationalStandard
                                                                                                                            • InternationalTracked
                                                                                                                            • InternationalTrackedAndSigned
                                                                                                                            • 1stClass
                                                                                                                            • 1stClassSignedFor
                                                                                                                            • 2ndClass
                                                                                                                            • 2ndClassSignedFor
                                                                                                                            • RoyalMail24
                                                                                                                            • RoyalMail24SignedFor
                                                                                                                            • RoyalMail48
                                                                                                                            • RoyalMail48SignedFor
                                                                                                                            • SpecialDeliveryGuaranteed1pm
                                                                                                                            • SpecialDeliveryGuaranteed9am
                                                                                                                            • StandardLetter1stClass
                                                                                                                            • StandardLetter1stClassSignedFor
                                                                                                                            • StandardLetter2ndClass
                                                                                                                            • StandardLetter2ndClassSignedFor
                                                                                                                            • Tracked24
                                                                                                                            • Tracked24HighVolume
                                                                                                                            • Tracked24HighVolumeSignature
                                                                                                                            • Tracked24Signature
                                                                                                                            • Tracked48
                                                                                                                            • Tracked48HighVolume
                                                                                                                            • Tracked48HighVolumeSignature
                                                                                                                            • Tracked48Signature
                                                                                                                            SEKO OmniParcel
                                                                                                                            • eCommerce Standard Tracked
                                                                                                                            • eCommerce Express Tracked
                                                                                                                            • Domestic Express
                                                                                                                            • Domestic Standard
                                                                                                                            Sendle
                                                                                                                            • Standard
                                                                                                                            • Express
                                                                                                                            SF Express
                                                                                                                            • International Standard Express - Doc
                                                                                                                            • International Standard Express - Parcel
                                                                                                                            • International Economy Express - Pilot
                                                                                                                            • International Economy Express - Doc
                                                                                                                            Spee-Dee
                                                                                                                            • SpeeDeeDelivery
                                                                                                                            StarTrack
                                                                                                                            • StartrackExpress
                                                                                                                            • StartrackPremium
                                                                                                                            • StartrackFixedPricePremium
                                                                                                                            Swyft
                                                                                                                            • NEXTDAY
                                                                                                                            • SAMEDAY
                                                                                                                            TForce Logistics
                                                                                                                            • NextDay
                                                                                                                            • Return
                                                                                                                            UDS
                                                                                                                            • DeliveryService
                                                                                                                            UPS
                                                                                                                            • Ground
                                                                                                                            • UPSStandard
                                                                                                                            • UPSSaver
                                                                                                                            • Express
                                                                                                                            • ExpressPlus
                                                                                                                            • Expedited
                                                                                                                            • NextDayAir
                                                                                                                            • NextDayAirSaver
                                                                                                                            • NextDayAirEarlyAM
                                                                                                                            • 2ndDayAir
                                                                                                                            • 2ndDayAirAM
                                                                                                                            • 3DaySelect
                                                                                                                            UPS i-parcel

                                                                                                                            No service levels for UPS i-parcel.

                                                                                                                              UPS Mail Innovations
                                                                                                                              • First
                                                                                                                              • Priority
                                                                                                                              • ExpeditedMailInnovations
                                                                                                                              • PriorityMailInnovations
                                                                                                                              • EconomyMailInnovations
                                                                                                                              USPS
                                                                                                                              • First
                                                                                                                              • Priority
                                                                                                                              • Express
                                                                                                                              • ParcelSelect
                                                                                                                              • LibraryMail
                                                                                                                              • MediaMail
                                                                                                                              • FirstClassMailInternational
                                                                                                                              • FirstClassPackageInternationalService
                                                                                                                              • PriorityMailInternational
                                                                                                                              • ExpressMailInternational
                                                                                                                              Veho
                                                                                                                              • nextDay
                                                                                                                              • sameDay
                                                                                                                              XDelivery
                                                                                                                              • Standard
                                                                                                                              Yanwen

                                                                                                                              No service levels for Yanwen.

                                                                                                                                POST/shipments/:id/rerate

                                                                                                                                Regenerate Rates for a Shipment

                                                                                                                                You can regenerate the Rates of a Shipment at any time. This is ideal when shipments aren't bought the same day as they were created and you want the most up-to-date rates available. This operation respects the carrier_accounts attribute.

                                                                                                                                Regenerate Rates for Shipment Example
                                                                                                                                import com.easypost.EasyPost;
                                                                                                                                import com.easypost.exception.EasyPostException;
                                                                                                                                
                                                                                                                                EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                                                
                                                                                                                                Shipment shipment = Shipment.retrieve("shp_...");
                                                                                                                                shipment = shipment.newRates();
                                                                                                                                
                                                                                                                                // Regenerate rates with Carbon Offset
                                                                                                                                Shipment shipmentWithNewRatesWithCarbon = shipment.newRates(true);
                                                                                                                                {
                                                                                                                                  "id": "shp_...",
                                                                                                                                  "object": "Shipment",
                                                                                                                                  "mode": "test",
                                                                                                                                  "to_address": {
                                                                                                                                    "id": "adr_...",
                                                                                                                                    "object": "Address",
                                                                                                                                    "name": "Dr. Steve Brule",
                                                                                                                                    "company": null,
                                                                                                                                    "street1": "179 N Harbor Dr",
                                                                                                                                    "street2": null,
                                                                                                                                    "city": "Redondo Beach",
                                                                                                                                    "state": "CA",
                                                                                                                                    "zip": "90277",
                                                                                                                                    "country": "US",
                                                                                                                                    "phone": "4153334444",
                                                                                                                                    "mode": "test",
                                                                                                                                    "carrier_facility": null,
                                                                                                                                    "residential": null,
                                                                                                                                    "email": "dr_steve_brule@gmail.com",
                                                                                                                                    "created_at": "2013-04-22T05:39:56Z",
                                                                                                                                    "updated_at": "2013-04-22T05:39:56Z"
                                                                                                                                  },
                                                                                                                                  "from_address": {
                                                                                                                                    "id": "adr_...",
                                                                                                                                    "object": "Address",
                                                                                                                                    "name": "EasyPost",
                                                                                                                                    "company": null,
                                                                                                                                    "street1": "417 Montgomery Street",
                                                                                                                                    "street2": "5th Floor",
                                                                                                                                    "city": "San Francisco",
                                                                                                                                    "state": "CA",
                                                                                                                                    "zip": "94104",
                                                                                                                                    "country": "US",
                                                                                                                                    "phone": "4153334444",
                                                                                                                                    "email": "support@easypost.com",
                                                                                                                                    "mode": "test",
                                                                                                                                    "carrier_facility": null,
                                                                                                                                    "residential": null,
                                                                                                                                    "created_at": "2013-04-22T05:39:57Z",
                                                                                                                                    "updated_at": "2013-04-22T05:39:57Z"
                                                                                                                                  },
                                                                                                                                  "parcel": {
                                                                                                                                    "id": "prcl_...",
                                                                                                                                    "object": "Parcel",
                                                                                                                                    "length": 20.2,
                                                                                                                                    "width": 10.9,
                                                                                                                                    "height": 5.0,
                                                                                                                                    "predefined_package": null,
                                                                                                                                    "weight": 140.8,
                                                                                                                                    "created_at": "2013-04-22T05:39:57Z",
                                                                                                                                    "updated_at": "2013-04-22T05:39:57Z"
                                                                                                                                  },
                                                                                                                                  "customs_info": {
                                                                                                                                    "id": "cstinfo_...",
                                                                                                                                    "object": "CustomsInfo",
                                                                                                                                    "created_at": "2013-04-22T05:39:57Z",
                                                                                                                                    "updated_at": "2013-04-22T05:39:57Z",
                                                                                                                                    "contents_explanation": null,
                                                                                                                                    "contents_type": "merchandise",
                                                                                                                                    "customs_certify": false,
                                                                                                                                    "customs_signer": null,
                                                                                                                                    "eel_pfc": null,
                                                                                                                                    "non_delivery_option": "return",
                                                                                                                                    "restriction_comments": null,
                                                                                                                                    "restriction_type": "none",
                                                                                                                                    "customs_items": [
                                                                                                                                      {
                                                                                                                                        "id": "cstitem_...",
                                                                                                                                        "object": "CustomsItem",
                                                                                                                                        "description": "Many, many EasyPost stickers.",
                                                                                                                                        "hs_tariff_number": "123456",
                                                                                                                                        "origin_country": "US",
                                                                                                                                        "quantity": 1,
                                                                                                                                        "value": 879,
                                                                                                                                        "weight": 140,
                                                                                                                                        "created_at": "2013-04-22T05:39:57Z",
                                                                                                                                        "updated_at": "2013-04-22T05:39:57Z"
                                                                                                                                      }
                                                                                                                                    ]
                                                                                                                                  },
                                                                                                                                  "rates": [
                                                                                                                                    {
                                                                                                                                      "id": "rate_...",
                                                                                                                                      "object": "Rate",
                                                                                                                                      "carrier_account_id": "ca_...",
                                                                                                                                      "service": "FirstClassPackageInternationalService",
                                                                                                                                      "rate": "9.50",
                                                                                                                                      "billing_type" : "easypost",
                                                                                                                                      "carrier": "USPS",
                                                                                                                                      "shipment_id": "shp_...",
                                                                                                                                      "delivery_days": 4,
                                                                                                                                      "delivery_date": "2013-04-26T05:40:57Z",
                                                                                                                                      "delivery_date_guaranteed": false,
                                                                                                                                      "created_at": "2013-04-22T05:40:57Z",
                                                                                                                                      "updated_at": "2013-04-22T05:40:57Z"
                                                                                                                                    }, {
                                                                                                                                      "id": "rate_...",
                                                                                                                                      "object": "Rate",
                                                                                                                                      "carrier_account_id": "ca_...",
                                                                                                                                      "service": "PriorityMailInternational",
                                                                                                                                      "rate": "27.40",
                                                                                                                                      "billing_type" : "easypost",
                                                                                                                                      "carrier": "USPS",
                                                                                                                                      "shipment_id": "shp_...",
                                                                                                                                      "delivery_days": 2,
                                                                                                                                      "delivery_date": "2013-04-24T05:40:57Z",
                                                                                                                                      "delivery_date_guaranteed": false,
                                                                                                                                      "created_at": "2013-04-22T05:40:57Z",
                                                                                                                                      "updated_at": "2013-04-22T05:40:57Z"
                                                                                                                                    }, {
                                                                                                                                      "id": "rate_...",
                                                                                                                                      "object": "Rate",
                                                                                                                                      "carrier_account_id": "ca_...",
                                                                                                                                      "service": "ExpressMailInternational",
                                                                                                                                      "rate": "35.48",
                                                                                                                                      "billing_type" : "easypost",
                                                                                                                                      "carrier": "USPS",
                                                                                                                                      "shipment_id": "shp_...",
                                                                                                                                      "delivery_days": 1,
                                                                                                                                      "delivery_date": "2013-04-23T05:40:57Z",
                                                                                                                                      "delivery_date_guaranteed": true,
                                                                                                                                      "created_at": "2013-04-22T05:40:57Z",
                                                                                                                                      "updated_at": "2013-04-22T05:40:57Z"
                                                                                                                                    }
                                                                                                                                  ],
                                                                                                                                  "scan_form": null,
                                                                                                                                  "selected_rate": null,
                                                                                                                                  "postage_label": null,
                                                                                                                                  "tracking_code": null,
                                                                                                                                  "refund_status": null,
                                                                                                                                  "insurance": null,
                                                                                                                                  "created_at": "2013-04-22T05:40:57Z",
                                                                                                                                  "updated_at": "2013-04-22T05:40:57Z"
                                                                                                                                }

                                                                                                                                Messages

                                                                                                                                When rating a Shipment or Pickup, some carriers may fail to generate rates. These failures are returned as part of the Shipment or Pickup as part of their messages attribute, and follow a common object structure.

                                                                                                                                It is important to note that the message value for any member of this list comes directly from the carrier, not from EasyPost. This means that if you see an authentication or other non-shipping error here, it is not an issue between you and EasyPost, it is an issue between you and the carrier, or an issue with the given data.

                                                                                                                                Message Object

                                                                                                                                attributetypespecification
                                                                                                                                carrierstringthe name of the carrier generating the error, e.g. "UPS"
                                                                                                                                typestringthe category of error that occurred. Most frequently "rate_error"
                                                                                                                                messagestringthe string from the carrier explaining the problem
                                                                                                                                carrier_account_idstringthe account id of the carrier. Useful if you have multiple accounts with the same carrier

                                                                                                                                SmartRate

                                                                                                                                The SmartRate API provides shippers with highly accurate, Shipment-level transit time predictions which can be used to save money, improve on-time delivery, and provide end customers with reliable delivery estimates.

                                                                                                                                The SmartRate API accepts a Shipment ID and returns predicted transit days across a variety of percentiles for each carrier service being evaluated for the Shipment. The transit time predictions in the response are based off of a sophisticated model using actual historical data for the shipping lane in question.

                                                                                                                                To make a request to the SmartRate API, first create a Shipment, then make the SmartRate call. Using the response, you can now make better data-driven decisions about which Rate to select when purchasing a label.

                                                                                                                                Time in Transit Object

                                                                                                                                attributetypespecification
                                                                                                                                percentile_50integerexpected transit days at the 50th percentile
                                                                                                                                percentile_75integerexpected transit days at the 75th percentile
                                                                                                                                percentile_85integerexpected transit days at the 85th percentile
                                                                                                                                percentile_90integerexpected transit days at the 90th percentile
                                                                                                                                percentile_95integerexpected transit days at the 95th percentile
                                                                                                                                percentile_97integerexpected transit days at the 97th percentile
                                                                                                                                percentile_99integerexpected transit days at the 99th percentile
                                                                                                                                GET/shipments/:id/smartrate

                                                                                                                                Retrieve Time in Transit statistics across all Rates for a Shipment

                                                                                                                                The SmartRate API returns a Time in Transit object with transit days across a variety of percentiles for every Rate for a given Shipment. Transit days are calculated as the number of business days between the first time the carrier acknowledges possession of the Shipment and the first out-for-delivery attempt.

                                                                                                                                Retrieve Time in Transit statistics across all Rates for Shipment Example
                                                                                                                                import com.easypost.EasyPost;
                                                                                                                                import com.easypost.exception.EasyPostException;
                                                                                                                                
                                                                                                                                EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                                                
                                                                                                                                Shipment shipment = Shipment.retrieve("shp_...");
                                                                                                                                shipment.getSmartrates();
                                                                                                                                {
                                                                                                                                  "result": [
                                                                                                                                      {
                                                                                                                                          "carrier": "USPS",
                                                                                                                                          "billing_type": "carrier",
                                                                                                                                          "carrier_account_id": "ca_...",
                                                                                                                                          "created_at": "2021-05-04T17:00:19Z",
                                                                                                                                          "currency": "USD",
                                                                                                                                          "delivery_date": null,
                                                                                                                                          "delivery_date_guaranteed": false,
                                                                                                                                          "delivery_days": 2,
                                                                                                                                          "est_delivery_days": 2,
                                                                                                                                          "id": "rate_...",
                                                                                                                                          "list_currency": "USD",
                                                                                                                                          "list_rate": 8.85,
                                                                                                                                          "mode": "production",
                                                                                                                                          "object": "Rate",
                                                                                                                                          "rate": 8.12,
                                                                                                                                          "retail_currency": "USD",
                                                                                                                                          "retail_rate": 11.1,
                                                                                                                                          "service": "Priority",
                                                                                                                                          "shipment_id": "shp_...",
                                                                                                                                          "time_in_transit": {
                                                                                                                                              "percentile_50": 2,
                                                                                                                                              "percentile_75": 3,
                                                                                                                                              "percentile_85": 3,
                                                                                                                                              "percentile_90": 3,
                                                                                                                                              "percentile_95": 4,
                                                                                                                                              "percentile_97": 4,
                                                                                                                                              "percentile_99": 6
                                                                                                                                          },
                                                                                                                                          "updated_at": "2021-05-04T17:00:19Z"
                                                                                                                                      },
                                                                                                                                      {
                                                                                                                                          "carrier": "USPS",
                                                                                                                                          "billing_type": "carrier",
                                                                                                                                          "carrier_account_id": "ca_...",
                                                                                                                                          "created_at": "2021-05-04T17:00:19Z",
                                                                                                                                          "currency": "USD",
                                                                                                                                          "delivery_date": null,
                                                                                                                                          "delivery_date_guaranteed": false,
                                                                                                                                          "delivery_days": 5,
                                                                                                                                          "est_delivery_days": 5,
                                                                                                                                          "id": "rate_...",
                                                                                                                                          "list_currency": "USD",
                                                                                                                                          "list_rate": 8.55,
                                                                                                                                          "mode": "production",
                                                                                                                                          "object": "Rate",
                                                                                                                                          "rate": 8.55,
                                                                                                                                          "retail_currency": "USD",
                                                                                                                                          "retail_rate": 8.55,
                                                                                                                                          "service": "ParcelSelect",
                                                                                                                                          "shipment_id": "shp_...",
                                                                                                                                          "time_in_transit": {
                                                                                                                                              "percentile_50": 2,
                                                                                                                                              "percentile_75": 3,
                                                                                                                                              "percentile_85": 4,
                                                                                                                                              "percentile_90": 5,
                                                                                                                                              "percentile_95": 6,
                                                                                                                                              "percentile_97": 7,
                                                                                                                                              "percentile_99": 10
                                                                                                                                          },
                                                                                                                                          "updated_at": "2021-05-04T17:00:19Z"
                                                                                                                                      },
                                                                                                                                {
                                                                                                                                          "carrier": "USPS",
                                                                                                                                          "billing_type": "carrier",
                                                                                                                                          "carrier_account_id": "ca_...",
                                                                                                                                          "created_at": "2021-05-04T17:00:19Z",
                                                                                                                                          "currency": "USD",
                                                                                                                                          "delivery_date": null,
                                                                                                                                          "delivery_date_guaranteed": false,
                                                                                                                                          "delivery_days": null,
                                                                                                                                          "est_delivery_days": null,
                                                                                                                                          "id": "rate_...",
                                                                                                                                          "list_currency": "USD",
                                                                                                                                          "list_rate": 37.5,
                                                                                                                                          "mode": "production",
                                                                                                                                          "object": "Rate",
                                                                                                                                          "rate": 37.5,
                                                                                                                                          "retail_currency": "USD",
                                                                                                                                          "retail_rate": 44.5,
                                                                                                                                          "service": "Express",
                                                                                                                                          "shipment_id": "shp_...",
                                                                                                                                          "time_in_transit": {
                                                                                                                                              "percentile_50": 1,
                                                                                                                                              "percentile_75": 2,
                                                                                                                                              "percentile_85": 3,
                                                                                                                                              "percentile_90": 3,
                                                                                                                                              "percentile_95": 4,
                                                                                                                                              "percentile_97": 5,
                                                                                                                                              "percentile_99": 8
                                                                                                                                          },
                                                                                                                                          "updated_at": "2021-05-04T17:00:19Z"
                                                                                                                                      }
                                                                                                                                  ]
                                                                                                                                }

                                                                                                                                Shipping Insurance

                                                                                                                                Insuring your Shipment is as simple as sending us the value of the contents. We charge 0.5% of the value, with a 50 cent minimum, and handle all the claims. All our claims are paid out within 10 days.

                                                                                                                                To buy insurance, first purchase the Shipment, then make the insurance call before the package begins being handled by the carrier.

                                                                                                                                POST/shipments/:id/insure

                                                                                                                                Insure a Shipment

                                                                                                                                paramexample
                                                                                                                                amount200.00
                                                                                                                                Insure Shipment Example
                                                                                                                                import com.easypost.EasyPost;
                                                                                                                                import com.easypost.exception.EasyPostException;
                                                                                                                                
                                                                                                                                EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                                                
                                                                                                                                Shipment purchasedShipment = Shipment.retrieve("shp_...");
                                                                                                                                Map<String, Object> insureMap = new HashMap<String, Object>();
                                                                                                                                insureMap.put("amount", 888.50);
                                                                                                                                purchasedShipment = purchasedShipment.insure(insureMap);
                                                                                                                                {
                                                                                                                                  "id": "shp_...",
                                                                                                                                  "object": "Shipment",
                                                                                                                                  "mode": "test",
                                                                                                                                  "insurance": "888.50",
                                                                                                                                  "to_address": {
                                                                                                                                    "id": "adr_...",
                                                                                                                                    "object": "Address",
                                                                                                                                    "name": "Maggie Simpson",
                                                                                                                                    "company": null,
                                                                                                                                    "street1": "742 Evergreen Terrace",
                                                                                                                                    "street2": null,
                                                                                                                                    "city": "Springfield",
                                                                                                                                    "state": "KY",
                                                                                                                                    "zip": "40069",
                                                                                                                                    "country": "US",
                                                                                                                                    "phone": "4163334444",
                                                                                                                                    "email": null,
                                                                                                                                    "created_at": "2013-04-22T05:39:56Z",
                                                                                                                                    "updated_at": "2013-04-22T05:39:56Z"
                                                                                                                                  },
                                                                                                                                  "from_address": {
                                                                                                                                    "id": "adr_...",
                                                                                                                                    "object": "Address",
                                                                                                                                    "name": "EasyPost",
                                                                                                                                    "company": null,
                                                                                                                                    "street1": "417 Montgomery Street",
                                                                                                                                    "street2": "5th Floor",
                                                                                                                                    "city": "San Francisco",
                                                                                                                                    "state": "CA",
                                                                                                                                    "zip": "94104",
                                                                                                                                    "country": "US",
                                                                                                                                    "phone": "4153334444",
                                                                                                                                    "email": "support@easypost.com",
                                                                                                                                    "created_at": "2013-04-22T05:39:57Z",
                                                                                                                                    "updated_at": "2013-04-22T05:39:57Z"
                                                                                                                                  },
                                                                                                                                  "parcel": {
                                                                                                                                    "id": "prcl_...",
                                                                                                                                    "object": "Parcel",
                                                                                                                                    "length": 20.2,
                                                                                                                                    "width": 10.9,
                                                                                                                                    "height": 5.0,
                                                                                                                                    "predefined_package": null,
                                                                                                                                    "weight": 140.8,
                                                                                                                                    "created_at": "2013-04-22T05:39:57Z",
                                                                                                                                    "updated_at": "2013-04-22T05:39:57Z"
                                                                                                                                  },
                                                                                                                                  "customs_info": {
                                                                                                                                    "id": "cstinfo_...",
                                                                                                                                    "object": "CustomsInfo",
                                                                                                                                    "created_at": "2013-04-22T05:39:57Z",
                                                                                                                                    "updated_at": "2013-04-22T05:39:57Z",
                                                                                                                                    "contents_explanation": null,
                                                                                                                                    "contents_type": "merchandise",
                                                                                                                                    "customs_certify": false,
                                                                                                                                    "customs_signer": null,
                                                                                                                                    "eel_pfc": null,
                                                                                                                                    "non_delivery_option": "return",
                                                                                                                                    "restriction_comments": null,
                                                                                                                                    "restriction_type": "none",
                                                                                                                                    "customs_items": [
                                                                                                                                      {
                                                                                                                                        "id": "cstitem_...",
                                                                                                                                        "object": "CustomsItem",
                                                                                                                                        "description": "Many, many EasyPost stickers.",
                                                                                                                                        "hs_tariff_number": "123456",
                                                                                                                                        "origin_country": "US",
                                                                                                                                        "quantity": 1,
                                                                                                                                        "value": 879,
                                                                                                                                        "weight": 140,
                                                                                                                                        "created_at": "2013-04-22T05:39:57Z",
                                                                                                                                        "updated_at": "2013-04-22T05:39:57Z"
                                                                                                                                      }
                                                                                                                                    ]
                                                                                                                                  },
                                                                                                                                  "rates": [
                                                                                                                                    {
                                                                                                                                      "id": "rate_...",
                                                                                                                                      "billing_type": "easypost",
                                                                                                                                      "object": "Rate",
                                                                                                                                      "service": "ExpressMailInternational",
                                                                                                                                      "rate": "35.48",
                                                                                                                                      "carrier": "USPS",
                                                                                                                                      "shipment_id": "shp_...",
                                                                                                                                      "created_at": "2013-04-22T05:40:57Z",
                                                                                                                                      "updated_at": "2013-04-22T05:40:57Z"
                                                                                                                                    }
                                                                                                                                  ],
                                                                                                                                  "scan_form": null,
                                                                                                                                  "selected_rate": null,
                                                                                                                                  "postage_label": null,
                                                                                                                                  "tracking_code": "",
                                                                                                                                  "refund_status": null,
                                                                                                                                  "created_at": "2013-04-22T05:40:57Z",
                                                                                                                                  "updated_at": "2013-04-22T05:40:57Z"
                                                                                                                                }

                                                                                                                                Refunds

                                                                                                                                USPS shipping labels can be refunded if requested within 30 days of generation. The processing time is at least 15 days, after which the funds will return to your EasyPost balance. EasyPost fees will also be refunded. To qualify, a shipment must not have been scanned by the USPS.

                                                                                                                                UPS and FedEx shipping labels may be refunded within 90 days of creation.

                                                                                                                                POST/shipments/:id/refund

                                                                                                                                Refund a Shipment

                                                                                                                                Refunding a Shipment is available for many carriers supported by EasyPost. Once the refund has been submitted, refund_status attribute of the Shipment will be populated with one of the possible values: "submitted", "refunded", "rejected". The most common initial status is "submitted". Many carriers require that the refund be processed before the refund_status will move to "refunded". The length of this process depends on the carrier, but no greater than 30 days.

                                                                                                                                Refunds created very shortly after a label is generated may be improperly flagged as invalid, but you may retry a refund with the "rejected" status by submitting the same request again. Carriers that are bill-on-scan tend to have refunds attempts return as "not_applicable", which will not change with multiple retries.

                                                                                                                                Refund Shipment Example
                                                                                                                                import com.easypost.EasyPost;
                                                                                                                                import com.easypost.exception.EasyPostException;
                                                                                                                                
                                                                                                                                EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                                                
                                                                                                                                Shipment shipment = Shipment.create(...);
                                                                                                                                // after purchasing shipment
                                                                                                                                shipment.refund();
                                                                                                                                {
                                                                                                                                  "batch_message": null,
                                                                                                                                  "batch_status": null,
                                                                                                                                  "created_at": "2013-11-08T15:50:00Z",
                                                                                                                                  "customs_info": null,
                                                                                                                                  "from_address": {
                                                                                                                                    "city": "San Francisco",
                                                                                                                                    "company": null,
                                                                                                                                    "country": "US",
                                                                                                                                    "created_at": "2013-11-08T15:49:59Z",
                                                                                                                                    "email": null,
                                                                                                                                    "id": "adr_...",
                                                                                                                                    "mode": "test",
                                                                                                                                    "name": "EasyPost",
                                                                                                                                    "object": "Address",
                                                                                                                                    "phone": "415-379-7678",
                                                                                                                                    "state": "CA",
                                                                                                                                    "street1": "417 Montgomery Street",
                                                                                                                                    "street2": "5th Floor",
                                                                                                                                    "updated_at": "2013-11-08T15:49:59Z",
                                                                                                                                    "zip": "94104"
                                                                                                                                  },
                                                                                                                                  "id": "shp_...",
                                                                                                                                  "insurance": null,
                                                                                                                                  "is_return": false,
                                                                                                                                  "mode": "test",
                                                                                                                                  "object": "Shipment",
                                                                                                                                  "parcel": {
                                                                                                                                    "created_at": "2013-11-08T15:49:59Z",
                                                                                                                                    "height": null,
                                                                                                                                    "id": "prcl_...",
                                                                                                                                    "length": null,
                                                                                                                                    "mode": "test",
                                                                                                                                    "object": "Parcel",
                                                                                                                                    "predefined_package": "UPSLetter",
                                                                                                                                    "updated_at": "2013-11-08T15:49:59Z",
                                                                                                                                    "weight": 3.0,
                                                                                                                                    "width": null
                                                                                                                                  },
                                                                                                                                  "postage_label": {
                                                                                                                                    "created_at": "2013-11-08T20:57:32Z",
                                                                                                                                    "id": "pl_...",
                                                                                                                                    "integrated_form": "none",
                                                                                                                                    "label_date": "2013-11-08T20:57:32Z",
                                                                                                                                    "label_epl2_url": null,
                                                                                                                                    "label_file_type": "image/png",
                                                                                                                                    "label_pdf_url": "https://amazonaws.com/.../a1b2c3.pdf",
                                                                                                                                    "label_resolution": 200,
                                                                                                                                    "label_size": "4x7",
                                                                                                                                    "label_type": "default",
                                                                                                                                    "label_url": "https://amazonaws.com/.../a1b2c3.png",
                                                                                                                                    "label_zpl_url": "https://amazonaws.com/.../a1b2c3.zpl",
                                                                                                                                    "object": "PostageLabel",
                                                                                                                                    "updated_at": "2013-11-08T21:11:14Z"
                                                                                                                                  },
                                                                                                                                  "rates": [
                                                                                                                                    {
                                                                                                                                      "carrier": "UPS",
                                                                                                                                      "billing_type": "carrier",
                                                                                                                                      "created_at": "2013-11-08T15:50:02Z",
                                                                                                                                      "currency": "USD",
                                                                                                                                      "id": "rate_...",
                                                                                                                                      "object": "Rate",
                                                                                                                                      "rate": "30.44",
                                                                                                                                      "service": "NextDayAir",
                                                                                                                                      "shipment_id": "shp_...",
                                                                                                                                      "updated_at": "2013-11-08T15:50:02Z"
                                                                                                                                    }, {
                                                                                                                                      "carrier": "UPS",
                                                                                                                                      "billing_type": "carrier",
                                                                                                                                      "created_at": "2013-11-08T15:50:02Z",
                                                                                                                                      "currency": "USD",
                                                                                                                                      "id": "rate_...",
                                                                                                                                      "object": "Rate",
                                                                                                                                      "rate": "60.28",
                                                                                                                                      "service": "NextDayAirEarlyAM",
                                                                                                                                      "shipment_id": "shp_...",
                                                                                                                                      "updated_at": "2013-11-08T15:50:02Z"
                                                                                                                                    }
                                                                                                                                  ],
                                                                                                                                  "reference": null,
                                                                                                                                  "refund_status": "submitted",
                                                                                                                                  "scan_form": null,
                                                                                                                                  "selected_rate": {
                                                                                                                                    "carrier": "UPS",
                                                                                                                                    "created_at": "2013-11-08T15:50:02Z",
                                                                                                                                    "currency": "USD",
                                                                                                                                    "id": "rate_...",
                                                                                                                                    "object": "Rate",
                                                                                                                                    "rate": "30.44",
                                                                                                                                    "service": "NextDayAir",
                                                                                                                                    "shipment_id": "shp_...",
                                                                                                                                    "updated_at": "2013-11-08T15:50:02Z"
                                                                                                                                  },
                                                                                                                                  "status": "unknown",
                                                                                                                                  "to_address": {
                                                                                                                                    "city": "Redondo Beach",
                                                                                                                                    "company": null,
                                                                                                                                    "country": "US",
                                                                                                                                    "created_at": "2013-11-08T15:49:58Z",
                                                                                                                                    "email": "dr_steve_brule@gmail.com",
                                                                                                                                    "id": "adr_...",
                                                                                                                                    "mode": "test",
                                                                                                                                    "name": "Dr. Steve Brule",
                                                                                                                                    "object": "Address",
                                                                                                                                    "phone": null,
                                                                                                                                    "state": "CA",
                                                                                                                                    "street1": "179 N Harbor Dr",
                                                                                                                                    "street2": null,
                                                                                                                                    "updated_at": "2013-11-08T15:49:58Z",
                                                                                                                                    "zip": "90277"
                                                                                                                                  },
                                                                                                                                  "tracker": {
                                                                                                                                    "created_at": "2013-11-08T20:57:32Z",
                                                                                                                                    "id": "trk_...",
                                                                                                                                    "mode": "test",
                                                                                                                                    "object": "Tracker",
                                                                                                                                    "shipment_id": "shp_...",
                                                                                                                                    "status": "unknown",
                                                                                                                                    "tracking_code": "1ZE6A4850190733810",
                                                                                                                                    "tracking_details": [ ],
                                                                                                                                    "updated_at": "2013-11-08T20:58:26Z",
                                                                                                                                    "public_url": "https://track.easypost.com/djE7..."
                                                                                                                                  },
                                                                                                                                  "tracking_code": "1ZE6A4850190733810",
                                                                                                                                  "updated_at": "2013-11-08T20:58:26Z"
                                                                                                                                }

                                                                                                                                Returns

                                                                                                                                If you are shipping merchandise or other frequently-returned products, you may wish to generate return labels to include with your shipment, for you customer's convenience. EasyPost offers a simple way to submit the same parameters as your initial shipment, but with an additional flag set, that will generate you a return label to receive any return shipments at your original from address.

                                                                                                                                It's important for some carriers, with different return billing, to specify a return label even if it's not a return label for an earlier Shipment.

                                                                                                                                If doing more than 10,000 USPS Returns in a year, please contact EasyPost for the USPS scan-based return program, which we also offer.

                                                                                                                                POST/shipments

                                                                                                                                Create Return for a Shipment

                                                                                                                                You can easily create return labels. All you need to do is set the is_return parameter to "true", leave the addresses the same as the initial Shipment's creation request and we switch the To and From Addresses for the return Shipment.

                                                                                                                                paramexample
                                                                                                                                is_returntrue
                                                                                                                                to_addressthe original Shipment's to_address
                                                                                                                                from_addressthe original Shipment's from_address
                                                                                                                                Create Return for Shipment Example
                                                                                                                                import com.easypost.EasyPost;
                                                                                                                                import com.easypost.exception.EasyPostException;
                                                                                                                                
                                                                                                                                EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                                                
                                                                                                                                
                                                                                                                                Map<String, Object> toAddressMap = new HashMap<String, Object>();
                                                                                                                                toAddressMap.put("name", "Maggie Simpson");
                                                                                                                                toAddressMap.put("street1", "742 Evergreen Terrace");
                                                                                                                                toAddressMap.put("street2", "");
                                                                                                                                toAddressMap.put("city", "Springfield");
                                                                                                                                toAddressMap.put("state", "KY");
                                                                                                                                toAddressMap.put("country", "US");
                                                                                                                                toAddressMap.put("zip", "40069");
                                                                                                                                
                                                                                                                                Map<String, Object> fromAddressMap = new HashMap<String, Object>();
                                                                                                                                ...
                                                                                                                                
                                                                                                                                Map<String, Object> parcelMap = new HashMap<String, Object>();
                                                                                                                                ...
                                                                                                                                
                                                                                                                                Map<String, Object> shipmentMap = new HashMap<String, Object>();
                                                                                                                                shipmentMap.put("to_address", toAddressMap);
                                                                                                                                shipmentMap.put("from_address", fromAddressMap);
                                                                                                                                shipmentMap.put("parcel", parcelMap);
                                                                                                                                shipmentMap.put("is_return", "true");
                                                                                                                                
                                                                                                                                Shipment shipment = Shipment.create(shipmentMap);
                                                                                                                                {
                                                                                                                                  "id": "shp_...",
                                                                                                                                  "object": "Shipment",
                                                                                                                                  "mode": "test",
                                                                                                                                  "to_address": {
                                                                                                                                    "id": "adr_...",
                                                                                                                                    "object": "Address",
                                                                                                                                    "name": "Maggie Simpson",
                                                                                                                                    "company": null,
                                                                                                                                    "street1": "742 Evergreen Terrace",
                                                                                                                                    "street2": null,
                                                                                                                                    "city": "Springfield",
                                                                                                                                    "state": "KY",
                                                                                                                                    "zip": "40069",
                                                                                                                                    "country": "US",
                                                                                                                                    "phone": "4163334444",
                                                                                                                                    "email": null,
                                                                                                                                    "created_at": "2013-04-22T05:39:56Z",
                                                                                                                                    "updated_at": "2013-04-22T05:39:56Z"
                                                                                                                                  },
                                                                                                                                  "from_address": {
                                                                                                                                    "id": "adr_...",
                                                                                                                                    "object": "Address",
                                                                                                                                    "name": "EasyPost",
                                                                                                                                    "company": null,
                                                                                                                                    "street1": "417 Montgomery Street",
                                                                                                                                    "street2": "5th Floor",
                                                                                                                                    "city": "San Francisco",
                                                                                                                                    "state": "CA",
                                                                                                                                    "zip": "94104",
                                                                                                                                    "country": "US",
                                                                                                                                    "phone": "4154567890",
                                                                                                                                    "email": null,
                                                                                                                                    "created_at": "2013-04-22T05:39:57Z",
                                                                                                                                    "updated_at": "2013-04-22T05:39:57Z"
                                                                                                                                  },
                                                                                                                                  "parcel": {
                                                                                                                                    "id": "prcl_...",
                                                                                                                                    "object": "Parcel",
                                                                                                                                    "length": 20.2,
                                                                                                                                    "width": 10.9,
                                                                                                                                    "height": 5.0,
                                                                                                                                    "predefined_package": null,
                                                                                                                                    "weight": 140.8,
                                                                                                                                    "created_at": "2013-04-22T05:39:57Z",
                                                                                                                                    "updated_at": "2013-04-22T05:39:57Z"
                                                                                                                                  },
                                                                                                                                  "customs_info": null,
                                                                                                                                  "rates": [
                                                                                                                                    {
                                                                                                                                      "id": "rate_...",
                                                                                                                                      "billing_type": "easypost",
                                                                                                                                      "object": "Rate",
                                                                                                                                      "service": "ExpressMailInternational",
                                                                                                                                      "rate": "35.48",
                                                                                                                                      "carrier": "USPS",
                                                                                                                                      "shipment_id": "shp_...",
                                                                                                                                      "created_at": "2013-04-22T05:40:57Z",
                                                                                                                                      "updated_at": "2013-04-22T05:40:57Z"
                                                                                                                                    }, {
                                                                                                                                      "id": "rate_...",
                                                                                                                                      "billing_type": "easypost",
                                                                                                                                      "object": "Rate",
                                                                                                                                      "service": "GXG",
                                                                                                                                      "rate": "55.41",
                                                                                                                                      "carrier": "USPS",
                                                                                                                                      "shipment_id": "shp_...",
                                                                                                                                      "created_at": "2013-04-22T05:40:57Z",
                                                                                                                                      "updated_at": "2013-04-22T05:40:57Z"
                                                                                                                                    }
                                                                                                                                  ],
                                                                                                                                  "scan_form": null,
                                                                                                                                  "selected_rate": null,
                                                                                                                                  "postage_label": null,
                                                                                                                                  "is_return": true,
                                                                                                                                  "tracking_code": null,
                                                                                                                                  "refund_status": null,
                                                                                                                                  "insurance": null,
                                                                                                                                  "created_at": "2013-04-22T05:40:57Z",
                                                                                                                                  "updated_at": "2013-04-22T05:40:57Z"
                                                                                                                                }

                                                                                                                                TaxIdentifiers

                                                                                                                                TaxIdentifiers are identifying numbers or IDs that are used to charge a specific party when dealing with the importing or exporting of good across international borders.

                                                                                                                                TaxIdentifiers is a list of TaxIdentifier objects, which allows you to supply up to 8 Tax Identification numbers. The fields for the TaxIdentifier object are outlined below.

                                                                                                                                TaxIdentifier Object

                                                                                                                                attributetypespecification
                                                                                                                                entitystringWhich entity the tax id belongs to ("SENDER" or "RECEIVER")
                                                                                                                                tax_idstringThe actual tax id number
                                                                                                                                tax_id_typestringThe type of tax id that is being used with the shipment (see possible types by carrier here)
                                                                                                                                issuing_countrystringThe issuing country of the tax id number
                                                                                                                                Create Shipment Example
                                                                                                                                import com.easypost.EasyPost;
                                                                                                                                import com.easypost.exception.EasyPostException;
                                                                                                                                EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                                                
                                                                                                                                Address toAddress = Address.Create(...);
                                                                                                                                Address fromAddress = Address.Create(...);
                                                                                                                                Parcel parcel = Parcel.Create(...);
                                                                                                                                CustomsInfo customsInfo = CustomsInfo.Create(...);
                                                                                                                                
                                                                                                                                HashMap<String, Object> taxIdentifier = new HashMap<>();
                                                                                                                                taxIdentifier.put("entity", "SENDER");
                                                                                                                                taxIdentifier.put("tax_id", "GB123456789");
                                                                                                                                taxIdentifier.put("tax_id_type", "IOSS");
                                                                                                                                taxIdentifier.put("issuing_country", "GB");
                                                                                                                                
                                                                                                                                HashMap<String, Object> shipmentMap = new HashMap<>();
                                                                                                                                shipmentMap.put("parcel", parcel);
                                                                                                                                shipmentMap.put("to_address", toAddress);
                                                                                                                                shipmentMap.put("from_address", fromAddress);
                                                                                                                                shipmentMap.put("customs_info", customsInfo);
                                                                                                                                shipmentMap.put("tax_identifiers", new ArrayList<>(Arrays.toList(taxIdentifier)));
                                                                                                                                
                                                                                                                                Shipment shipment = Shipment.Create(shipmentMap);
                                                                                                                                {
                                                                                                                                  "created_at": "2021-10-06T16:36:11Z",
                                                                                                                                  "is_return": false,
                                                                                                                                  "messages": [],
                                                                                                                                  "mode": "test",
                                                                                                                                  "options": {
                                                                                                                                    "currency": "USD",
                                                                                                                                    "payment": {
                                                                                                                                      "type": "SENDER"
                                                                                                                                    },
                                                                                                                                    "date_advance": 0
                                                                                                                                  },
                                                                                                                                  "reference": null,
                                                                                                                                  "status": "unknown",
                                                                                                                                  "tracking_code": "794670714284",
                                                                                                                                  "updated_at": "2021-10-06T16:36:14Z",
                                                                                                                                  "batch_id": null,
                                                                                                                                  "batch_status": null,
                                                                                                                                  "batch_message": null,
                                                                                                                                  "customs_info": {
                                                                                                                                    "id": "cstinfo_...",
                                                                                                                                    "object": "CustomsInfo",
                                                                                                                                    "created_at": "2021-10-06T16:36:11Z",
                                                                                                                                    "updated_at": "2021-10-06T16:36:11Z",
                                                                                                                                    "contents_explanation": "",
                                                                                                                                    "contents_type": "merchandise",
                                                                                                                                    "customs_certify": true,
                                                                                                                                    "customs_signer": "Steve Brule",
                                                                                                                                    "eel_pfc": "NOEEI 30.37(a)",
                                                                                                                                    "non_delivery_option": "return",
                                                                                                                                    "restriction_comments": null,
                                                                                                                                    "restriction_type": "none",
                                                                                                                                    "mode": "test",
                                                                                                                                    "declaration": null,
                                                                                                                                    "customs_items": [
                                                                                                                                      {
                                                                                                                                        "id": "cstitem_...",
                                                                                                                                        "object": "CustomsItem",
                                                                                                                                        "created_at": "2021-10-06T16:36:11Z",
                                                                                                                                        "updated_at": "2021-10-06T16:36:11Z",
                                                                                                                                        "description": "Sweet shirts",
                                                                                                                                        "hs_tariff_number": "654321",
                                                                                                                                        "origin_country": "US",
                                                                                                                                        "quantity": 2,
                                                                                                                                        "value": "23.0",
                                                                                                                                        "weight": 21,
                                                                                                                                        "code": null,
                                                                                                                                        "mode": "test",
                                                                                                                                        "manufacturer": null,
                                                                                                                                        "currency": null,
                                                                                                                                        "eccn": null,
                                                                                                                                        "printed_commodity_identifier": null
                                                                                                                                      }
                                                                                                                                    ]
                                                                                                                                  },
                                                                                                                                  "from_address": {
                                                                                                                                    "id": "adr_...",
                                                                                                                                    "object": "Address",
                                                                                                                                    "created_at": "2021-10-06T16:36:11+00:00",
                                                                                                                                    "updated_at": "2021-10-06T16:36:11+00:00",
                                                                                                                                    "name": "EasyPost",
                                                                                                                                    "company": null,
                                                                                                                                    "street1": "Linton Trading Estate",
                                                                                                                                    "street2": null,
                                                                                                                                    "city": "Bromyard",
                                                                                                                                    "state": "Herefordshire",
                                                                                                                                    "zip": "HR74QT",
                                                                                                                                    "country": "GB",
                                                                                                                                    "phone": "01010101010",
                                                                                                                                    "email": "support@easypost.com",
                                                                                                                                    "mode": "test",
                                                                                                                                    "carrier_facility": null,
                                                                                                                                    "residential": null,
                                                                                                                                    "federal_tax_id": null,
                                                                                                                                    "state_tax_id": null,
                                                                                                                                    "verifications": {}
                                                                                                                                  },
                                                                                                                                  "insurance": null,
                                                                                                                                  "order_id": null,
                                                                                                                                  "parcel": {
                                                                                                                                    "id": "prcl_...",
                                                                                                                                    "object": "Parcel",
                                                                                                                                    "created_at": "2021-10-06T16:36:11Z",
                                                                                                                                    "updated_at": "2021-10-06T16:36:11Z",
                                                                                                                                    "length": null,
                                                                                                                                    "width": null,
                                                                                                                                    "height": null,
                                                                                                                                    "predefined_package": null,
                                                                                                                                    "weight": 21,
                                                                                                                                    "mode": "test"
                                                                                                                                  },
                                                                                                                                  "postage_label": {
                                                                                                                                    "object": "PostageLabel",
                                                                                                                                    "id": "pl_...",
                                                                                                                                    "created_at": "2021-10-06T16:36:14Z",
                                                                                                                                    "updated_at": "2021-10-06T16:36:14Z",
                                                                                                                                    "date_advance": 0,
                                                                                                                                    "integrated_form": "none",
                                                                                                                                    "label_date": "2021-10-06T16:36:14Z",
                                                                                                                                    "label_resolution": 200,
                                                                                                                                    "label_size": "PAPER_4X6",
                                                                                                                                    "label_type": "default",
                                                                                                                                    "label_file_type": "image/png",
                                                                                                                                    "label_url": "https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/...",
                                                                                                                                    "label_pdf_url": null,
                                                                                                                                    "label_zpl_url": null,
                                                                                                                                    "label_epl2_url": null,
                                                                                                                                    "label_file": null
                                                                                                                                  },
                                                                                                                                  "rates": [
                                                                                                                                    {
                                                                                                                                      "id": "rate_...",
                                                                                                                                      "billing_type": "carrier",
                                                                                                                                      "object": "Rate",
                                                                                                                                      "created_at": "2021-10-06T16:36:11Z",
                                                                                                                                      "updated_at": "2021-10-06T16:36:11Z",
                                                                                                                                      "mode": "test",
                                                                                                                                      "service": "INTERNATIONAL_ECONOMY",
                                                                                                                                      "carrier": "FedEx",
                                                                                                                                      "rate": "0.01",
                                                                                                                                      "currency": "USD",
                                                                                                                                      "retail_rate": null,
                                                                                                                                      "retail_currency": null,
                                                                                                                                      "list_rate": null,
                                                                                                                                      "list_currency": null,
                                                                                                                                      "delivery_days": null,
                                                                                                                                      "delivery_date": null,
                                                                                                                                      "delivery_date_guaranteed": null,
                                                                                                                                      "est_delivery_days": null,
                                                                                                                                      "shipment_id": "shp_...",
                                                                                                                                      "carrier_account_id": "ca_..."
                                                                                                                                    }
                                                                                                                                  ],
                                                                                                                                  "refund_status": null,
                                                                                                                                  "scan_form": null,
                                                                                                                                  "selected_rate": {
                                                                                                                                    "id": "rate_...",
                                                                                                                                    "object": "Rate",
                                                                                                                                    "created_at": "2021-10-06T16:36:14Z",
                                                                                                                                    "updated_at": "2021-10-06T16:36:14Z",
                                                                                                                                    "mode": "test",
                                                                                                                                    "service": "INTERNATIONAL_ECONOMY",
                                                                                                                                    "carrier": "FedEx",
                                                                                                                                    "rate": "0.01",
                                                                                                                                    "currency": "USD",
                                                                                                                                    "retail_rate": null,
                                                                                                                                    "retail_currency": null,
                                                                                                                                    "list_rate": null,
                                                                                                                                    "list_currency": null,
                                                                                                                                    "delivery_days": null,
                                                                                                                                    "delivery_date": null,
                                                                                                                                    "delivery_date_guaranteed": null,
                                                                                                                                    "est_delivery_days": null,
                                                                                                                                    "shipment_id": "shp_...",
                                                                                                                                    "carrier_account_id": "ca_..."
                                                                                                                                  },
                                                                                                                                  "tracker": {
                                                                                                                                    "id": "trk_...",
                                                                                                                                    "object": "Tracker",
                                                                                                                                    "mode": "test",
                                                                                                                                    "tracking_code": "794670714284",
                                                                                                                                    "status": "unknown",
                                                                                                                                    "status_detail": "unknown",
                                                                                                                                    "created_at": "2021-10-06T16:36:14Z",
                                                                                                                                    "updated_at": "2021-10-06T16:36:14Z",
                                                                                                                                    "signed_by": null,
                                                                                                                                    "weight": null,
                                                                                                                                    "est_delivery_date": null,
                                                                                                                                    "shipment_id": "shp_...",
                                                                                                                                    "carrier": "FedEx",
                                                                                                                                    "tracking_details": [],
                                                                                                                                    "fees": [],
                                                                                                                                    "carrier_detail": null,
                                                                                                                                    "public_url": "https://track.easypost.com/djE6..."
                                                                                                                                  },
                                                                                                                                  "to_address": {
                                                                                                                                    "id": "adr_...",
                                                                                                                                    "object": "Address",
                                                                                                                                    "created_at": "2021-10-06T16:36:11+00:00",
                                                                                                                                    "updated_at": "2021-10-06T16:36:11+00:00",
                                                                                                                                    "name": "Becks Brewery",
                                                                                                                                    "company": null,
                                                                                                                                    "street1": "Am Deich 18-19",
                                                                                                                                    "street2": null,
                                                                                                                                    "city": "Bremen",
                                                                                                                                    "state": null,
                                                                                                                                    "zip": "28199",
                                                                                                                                    "country": "DE",
                                                                                                                                    "phone": "03333237728",
                                                                                                                                    "email": "dr_steve_brule@gmail.com",
                                                                                                                                    "mode": "test",
                                                                                                                                    "carrier_facility": null,
                                                                                                                                    "residential": null,
                                                                                                                                    "federal_tax_id": null,
                                                                                                                                    "state_tax_id": null,
                                                                                                                                    "verifications": {}
                                                                                                                                  },
                                                                                                                                  "usps_zone": null,
                                                                                                                                  "return_address": {
                                                                                                                                    "id": "adr_...",
                                                                                                                                    "object": "Address",
                                                                                                                                    "created_at": "2021-10-06T16:36:11+00:00",
                                                                                                                                    "updated_at": "2021-10-06T16:36:11+00:00",
                                                                                                                                    "name": "EasyPost",
                                                                                                                                    "company": null,
                                                                                                                                    "street1": "Linton Trading Estate",
                                                                                                                                    "street2": null,
                                                                                                                                    "city": "Bromyard",
                                                                                                                                    "state": "Herefordshire",
                                                                                                                                    "zip": "HR74QT",
                                                                                                                                    "country": "GB",
                                                                                                                                    "phone": "01010101010",
                                                                                                                                    "email": "support@easypost.com",
                                                                                                                                    "mode": "test",
                                                                                                                                    "carrier_facility": null,
                                                                                                                                    "residential": null,
                                                                                                                                    "federal_tax_id": null,
                                                                                                                                    "state_tax_id": null,
                                                                                                                                    "verifications": {}
                                                                                                                                  },
                                                                                                                                  "buyer_address": {
                                                                                                                                    "id": "adr_...",
                                                                                                                                    "object": "Address",
                                                                                                                                    "created_at": "2021-10-06T16:36:11+00:00",
                                                                                                                                    "updated_at": "2021-10-06T16:36:11+00:00",
                                                                                                                                    "name": "Becks Brewery",
                                                                                                                                    "company": null,
                                                                                                                                    "street1": "Am Deich 18-19",
                                                                                                                                    "street2": null,
                                                                                                                                    "city": "Bremen",
                                                                                                                                    "state": null,
                                                                                                                                    "zip": "28199",
                                                                                                                                    "country": "DE",
                                                                                                                                    "phone": "03333237728",
                                                                                                                                    "email": "dr_steve_brule@gmail.com",
                                                                                                                                    "mode": "test",
                                                                                                                                    "carrier_facility": null,
                                                                                                                                    "residential": null,
                                                                                                                                    "federal_tax_id": null,
                                                                                                                                    "state_tax_id": null,
                                                                                                                                    "verifications": {}
                                                                                                                                  },
                                                                                                                                  "forms": [
                                                                                                                                    {
                                                                                                                                      "object": "Form",
                                                                                                                                      "id": "form_...",
                                                                                                                                      "created_at": "2021-10-06T16:36:14Z",
                                                                                                                                      "updated_at": "2021-10-06T16:36:14Z",
                                                                                                                                      "mode": "test",
                                                                                                                                      "form_type": "commercial_invoice",
                                                                                                                                      "form_url": "https://easypost-files.s3-us-west-2.amazonaws.com/files/form/...",
                                                                                                                                      "submitted_electronically": true
                                                                                                                                    }
                                                                                                                                  ],
                                                                                                                                  "fees": [
                                                                                                                                    {
                                                                                                                                      "object": "Fee",
                                                                                                                                      "type": "LabelFee",
                                                                                                                                      "amount": "0.00000",
                                                                                                                                      "charged": true,
                                                                                                                                      "refunded": false
                                                                                                                                    }
                                                                                                                                  ],
                                                                                                                                  "id": "shp_...",
                                                                                                                                  "object": "Shipment",
                                                                                                                                  "tax_identifiers": [
                                                                                                                                    {
                                                                                                                                      "entity": "SENDER",
                                                                                                                                      "tax_id": "HIDDEN",
                                                                                                                                      "tax_id_type": "EORI",
                                                                                                                                      "issuing_country": "GB"
                                                                                                                                    },
                                                                                                                                    {
                                                                                                                                      "entity": "SENDER",
                                                                                                                                      "tax_id": "HIDDEN",
                                                                                                                                      "tax_id_type": "IOSS",
                                                                                                                                      "issuing_country": "GB"
                                                                                                                                    },
                                                                                                                                    {
                                                                                                                                      "entity": "SENDER",
                                                                                                                                      "tax_id": "HIDDEN",
                                                                                                                                      "tax_id_type": "VAT",
                                                                                                                                      "issuing_country": "GB"
                                                                                                                                    },
                                                                                                                                    {
                                                                                                                                      "entity": "RECEIVER",
                                                                                                                                      "tax_id": "HIDDEN",
                                                                                                                                      "tax_id_type": "PID",
                                                                                                                                      "issuing_country": "DE"
                                                                                                                                    },
                                                                                                                                    {
                                                                                                                                      "entity": "RECEIVER",
                                                                                                                                      "tax_id": "HIDDEN",
                                                                                                                                      "tax_id_type": "VAT",
                                                                                                                                      "issuing_country": "DE"
                                                                                                                                    }
                                                                                                                                  ]
                                                                                                                                }

                                                                                                                                Trackers

                                                                                                                                A Tracker object contains all of the tracking information for a package. A Tracker is created automatically whenever you buy a Shipment through EasyPost; if you don't use EasyPost to purchase your shipping labels, you can still track packages through our API by creating a Tracker object directly. Each Tracker is continually updated in the background as the package moves through its life cycle, regardless of whether or not the label was purchased through EasyPost.

                                                                                                                                After creation, a Tracker object will be updated periodically based on when the carrier provides EasyPost with new tracking information. This information can be consumed by using our webhooks infrastructure. Every time a Tracker is updated a webhook Event will be sent.

                                                                                                                                The Tracker object contains both the current information about the package as well as previous updates. All of the previous updates are stored in the tracking_details array. Each TrackingDetail object contains the status, the message from the carrier, and a TrackingLocation.

                                                                                                                                The TrackingLocation contains city, state, country, and zip information about the location where the package was scanned. The information each carrier provides is different, so some carriers may not make use of all of these fields.

                                                                                                                                Some Tracker objects may also contain a CarrierDetail, which stores some additional information about the Tracker that the carrier has made available to EasyPost. The CarrierDetail object contains the service and container_type of the package. Additionally, it also stores the est_delivery_date_local and est_delivery_time_local, which provide information about the local delivery time.

                                                                                                                                It's worth noting that tracking_codes are not globally unique. Each carrier promises uniqueness for a given tracking_code for a certain period of time, but the length of time varies greatly based on the specific carrier and service level. The carriers do eventually recycle tracking_codes, and for this reason enforcing uniqueness on the tracking_code field is not recommended. EasyPost does, however, prevent the creation of duplicate Trackers based on tracking_code and carrier; duplicate requests by the same User will simply return the original Tracker.

                                                                                                                                Tracker Object

                                                                                                                                attributetypespecification
                                                                                                                                idstringUnique identifier, begins with "trk_"
                                                                                                                                objectstring"Tracker"
                                                                                                                                modestring"test" or "production"
                                                                                                                                tracking_codestringThe tracking code provided by the carrier
                                                                                                                                statusstringThe current status of the package, possible values are "unknown", "pre_transit", "in_transit", "out_for_delivery", "delivered", "available_for_pickup", "return_to_sender", "failure", "cancelled" or "error"
                                                                                                                                signed_bystringThe name of the person who signed for the package (if available)
                                                                                                                                weightfloatThe weight of the package as measured by the carrier in ounces (if available)
                                                                                                                                est_delivery_datedatetimeThe estimated delivery date provided by the carrier (if available)
                                                                                                                                shipment_idstringThe id of the EasyPost Shipment object associated with the Tracker (if any)
                                                                                                                                carrierstringThe name of the carrier handling the shipment
                                                                                                                                tracking_detailsTrackingDetail arrayArray of the associated TrackingDetail objects
                                                                                                                                carrier_detailCarrierDetailThe associated CarrierDetail object (if available)
                                                                                                                                public_urlstringURL to a publicly-accessible html page that shows tracking details for this tracker
                                                                                                                                feesFee arrayArray of the associated Fee objects
                                                                                                                                created_atdatetime
                                                                                                                                updated_atdatetime

                                                                                                                                TrackingDetail Object

                                                                                                                                attributetypespecification
                                                                                                                                objectstring"TrackingDetail"
                                                                                                                                messagestringDescription of the scan event
                                                                                                                                statusstringStatus of the package at the time of the scan event, possible values are "unknown", "pre_transit", "in_transit", "out_for_delivery", "delivered", "available_for_pickup", "return_to_sender", "failure", "cancelled" or "error"
                                                                                                                                datetimedatetimeThe timestamp when the tracking scan occurred
                                                                                                                                sourcestringThe original source of the information for this scan event, usually the carrier
                                                                                                                                tracking_locationTrackingLocationThe location associated with the scan event

                                                                                                                                TrackingLocation Object

                                                                                                                                attributetypespecification
                                                                                                                                objectstring"TrackingLocation"
                                                                                                                                citystringThe city where the scan event occurred (if available)
                                                                                                                                statestringThe state where the scan event occurred (if available)
                                                                                                                                countrystringThe country where the scan event occurred (if available)
                                                                                                                                zipstringThe postal code where the scan event occurred (if available)

                                                                                                                                CarrierDetail Object

                                                                                                                                attributetypespecification
                                                                                                                                objectstring"CarrierDetail"
                                                                                                                                servicestringThe service level the associated shipment was shipped with (if available)
                                                                                                                                container_typestringThe type of container the associated shipment was shipped in (if available)
                                                                                                                                est_delivery_date_localdateThe estimated delivery date as provided by the carrier, in the local time zone (if available)
                                                                                                                                est_delivery_time_localtimeThe estimated delivery time as provided by the carrier, in the local time zone (if available)
                                                                                                                                origin_locationstringThe location from which the package originated, stringified for presentation (if available)
                                                                                                                                origin_tracking_locationTrackingLocationThe location from which the package originated, broken down by city/state/country/zip (if available)
                                                                                                                                destination_locationstringThe location to which the package is being sent, stringified for presentation (if available)
                                                                                                                                destination_tracking_locationTrackingLocationThe location to which the package is being sent, broken down by city/state/country/zip (if available)
                                                                                                                                guaranteed_delivery_datedatetimeThe date and time the carrier guarantees the package to be delivered by (if available)
                                                                                                                                alternate_identifierstringThe alternate identifier for this package as provided by the carrier (if available)
                                                                                                                                initial_delivery_attemptdatetimeThe date and time of the first attempt by the carrier to deliver the package (if available)

                                                                                                                                Testing Specific Tracking States

                                                                                                                                Sometimes you may want to simulate specific tracking statuses (e.g. "out_for_delivery") within your application to test how your application responds. EasyPost has a set of test tracking_codes that, when sent to the API, respond with specific tracking statuses and send a webhook Event to your test mode URL. The tracking updates that are sent by these tracking_codes will contain canned information, but it will be similar in form to the information normally provided by the carrier you selected.

                                                                                                                                Test Tracking Codes

                                                                                                                                tracking_codestatus
                                                                                                                                EZ1000000001pre_transit
                                                                                                                                EZ2000000002in_transit
                                                                                                                                EZ3000000003out_for_delivery
                                                                                                                                EZ4000000004delivered
                                                                                                                                EZ5000000005return_to_sender
                                                                                                                                EZ6000000006failure
                                                                                                                                EZ7000000007unknown

                                                                                                                                Carrier Tracking Strings

                                                                                                                                CarrierString Representation
                                                                                                                                AmazonMwsAmazonMws
                                                                                                                                APCAPC
                                                                                                                                AsendiaAsendia
                                                                                                                                Asendia USAAsendiaUsa
                                                                                                                                Australia PostAustraliaPost
                                                                                                                                AxlehireV3AxlehireV3
                                                                                                                                Better TrucksBetterTrucks
                                                                                                                                BondBond
                                                                                                                                Canada PostCanadaPost
                                                                                                                                CanparCanpar
                                                                                                                                CDL Last Mile SolutionsColumbusLastMile
                                                                                                                                ChronopostChronopost
                                                                                                                                CloudSortCloudSort
                                                                                                                                Courier ExpressCourierExpress
                                                                                                                                CouriersPleaseCouriersPlease
                                                                                                                                Dai PostDaiPost
                                                                                                                                Deutsche PostDeutschePost
                                                                                                                                Deutsche Post UKDeutschePostUK
                                                                                                                                DHL eCommerce AsiaDHLEcommerceAsia
                                                                                                                                DHL eCommerce SolutionsDhlEcs
                                                                                                                                DHL ExpressDHLExpress
                                                                                                                                DPDDPD
                                                                                                                                DPD UKDPDUK
                                                                                                                                ePost GlobalePostGlobal
                                                                                                                                EstafetaEstafeta
                                                                                                                                EvriEvri
                                                                                                                                FastwayFastway
                                                                                                                                FedExFedEx
                                                                                                                                FedEx Cross BorderFedExCrossBorder
                                                                                                                                FedEx MailviewFedExMailview
                                                                                                                                FedEx SameDay CityFedExSameDayCity
                                                                                                                                FedEx SmartPostFedexSmartPost
                                                                                                                                FirstMileFirstMile
                                                                                                                                GlobegisticsGlobegistics
                                                                                                                                GSOGSO
                                                                                                                                Interlink ExpressInterlinkExpress
                                                                                                                                JP PostJPPost
                                                                                                                                Kuroneko YamatoKuronekoYamato
                                                                                                                                La PosteLaPoste
                                                                                                                                LaserShipLaserShipV2
                                                                                                                                Loomis ExpressLoomisExpress
                                                                                                                                LSOLSO
                                                                                                                                NewgisticsNewgistics
                                                                                                                                OnTracOnTrac
                                                                                                                                Osm WorldwideOsmWorldwide
                                                                                                                                ParcelforceParcelforce
                                                                                                                                PARCLLParcll
                                                                                                                                PassportPassportGlobal
                                                                                                                                PostNLPostNL
                                                                                                                                PurolatorPurolator
                                                                                                                                Royal MailRoyalMail
                                                                                                                                SEKO OmniParcelOmniParcel
                                                                                                                                SendleSendle
                                                                                                                                SF ExpressSFExpress
                                                                                                                                Spee-DeeSpeeDee
                                                                                                                                StarTrackStarTrack
                                                                                                                                SwyftSwyft
                                                                                                                                TForce LogisticsTForce
                                                                                                                                UDSUDS
                                                                                                                                UPSUPS
                                                                                                                                UPS i-parcelUPSIparcel
                                                                                                                                UPS Mail InnovationsUPSMailInnovations
                                                                                                                                USPSUSPS
                                                                                                                                VehoVeho
                                                                                                                                XDeliveryXDelivery
                                                                                                                                YanwenYanwen
                                                                                                                                POST/trackers

                                                                                                                                Create a Tracker

                                                                                                                                A Tracker can be created with only a tracking_code. Optionally, you can provide the carrier parameter, which indicates the carrier the package was shipped with. If no carrier is provided, EasyPost will attempt to determine the carrier based on the tracking_code provided. Providing a carrier parameter is recommended, since some tracking_codes are ambiguous and may match with more than one carrier. In addition, not having to auto-match the carrier will significantly speed up the response time.

                                                                                                                                In an effort to reduce wasted resources, EasyPost prevents the creation of duplicate Trackers. A Tracker is considered to be a duplicate if another Tracker with the same tracking_code and carrier was created by the same User in the last three months. In the case where a duplicate request is submitted, the original Tracker will be returned.

                                                                                                                                Create Tracker Request Parameters
                                                                                                                                paramexampleinfo
                                                                                                                                tracking_code9400110898825022579493The tracking code associated with the package you'd like to track
                                                                                                                                carrierUSPSThe carrier associated with the tracking_code you provided. The carrier will get auto-detected if none is provided
                                                                                                                                Create Tracker Example
                                                                                                                                import com.easypost.EasyPost;
                                                                                                                                import com.easypost.exception.EasyPostException;
                                                                                                                                
                                                                                                                                EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                                                
                                                                                                                                Map<String, Object> trackerMap = new HashMap<String, Object>();
                                                                                                                                trackerMap.put("tracking_code","9400110898825022579493");
                                                                                                                                trackerMap.put("carrier", "USPS");
                                                                                                                                
                                                                                                                                Tracker tracker = Tracker.create(trackerMap);
                                                                                                                                {
                                                                                                                                  "id": "trk_...",
                                                                                                                                  "object": "Tracker",
                                                                                                                                  "mode": "test",
                                                                                                                                  "tracking_code": "9400110898825022579493",
                                                                                                                                  "status": "in_transit",
                                                                                                                                  "created_at": "2016-01-13T21:52:28Z",
                                                                                                                                  "updated_at": "2016-01-13T21:52:32Z",
                                                                                                                                  "signed_by": null,
                                                                                                                                  "weight": null,
                                                                                                                                  "est_delivery_date": null,
                                                                                                                                  "shipment_id": null,
                                                                                                                                  "carrier": "USPS",
                                                                                                                                  "public_url": "https://track.easypost.com/djE6...",
                                                                                                                                  "tracking_details": [
                                                                                                                                    {
                                                                                                                                      "object": "TrackingDetail",
                                                                                                                                      "message": "Shipping Label Created",
                                                                                                                                      "status": "pre_transit",
                                                                                                                                      "datetime": "2015-12-31T15:58:00Z",
                                                                                                                                      "source": "USPS",
                                                                                                                                      "tracking_location": {
                                                                                                                                        "object": "TrackingLocation",
                                                                                                                                        "city": "FOUNTAIN VALLEY",
                                                                                                                                        "state": "CA",
                                                                                                                                        "country": null,
                                                                                                                                        "zip": "92708"
                                                                                                                                      }
                                                                                                                                    },
                                                                                                                                    {
                                                                                                                                      "object": "TrackingDetail",
                                                                                                                                      "message": "Arrived at Post Office",
                                                                                                                                      "status": "in_transit",
                                                                                                                                      "datetime": "2016-01-07T06:58:00Z",
                                                                                                                                      "source": "USPS",
                                                                                                                                      "tracking_location": {
                                                                                                                                        "object": "TrackingLocation",
                                                                                                                                        "city": "FOUNTAIN VALLEY",
                                                                                                                                        "state": "CA",
                                                                                                                                        "country": null,
                                                                                                                                        "zip": "92728"
                                                                                                                                      }
                                                                                                                                    }
                                                                                                                                  ],
                                                                                                                                  "carrier_detail": null,
                                                                                                                                  "fees": [
                                                                                                                                    {
                                                                                                                                      "object": "Fee",
                                                                                                                                      "type": "TrackerFee",
                                                                                                                                      "amount": "0.00000",
                                                                                                                                      "charged": true,
                                                                                                                                      "refunded": false
                                                                                                                                    }
                                                                                                                                  ]
                                                                                                                                }
                                                                                                                                GET/trackers

                                                                                                                                Retrieve a list of Trackers

                                                                                                                                The Tracker List is a paginated list of all Tracker objects associated with the given API Key. It accepts a variety of parameters which can be used to modify the scope. The has_more attribute indicates whether or not additional pages can be requested. The recommended way of paginating is to use either the before_id or after_id parameter to specify where the next page begins.

                                                                                                                                Using the Tracker List endpoint is the recommended way of retrieving a Tracker by tracking_code or carrier. Unlike the retrieving a Tracker using the Retrieve endpoint, which accepts an id, the List endpoint accepts the tracking_code as the search parameter. Normally, you'll only have one Tracker with a given tracking_code, but it is also possible to further filter those results by including the carrier parameter in your request.

                                                                                                                                Retrieve a list of Tracker Request Parameters
                                                                                                                                paramexampleinfo
                                                                                                                                before_idtrk_...Optional pagination parameter. Only trackers created before the given ID will be included. May not be used with after_id
                                                                                                                                after_idtrk_...Optional pagination parameter. Only trackers created after the given ID will be included. May not be used with before_id
                                                                                                                                start_datetime2016-01-02T00:00:00ZOnly return Trackers created after this timestamp. Defaults to 1 month ago, or 1 month before a passed end_datetime
                                                                                                                                end_datetime2016-01-02T00:00:00ZOnly return Trackers created before this timestamp. Defaults to end of the current day, or 1 month after a passed start_datetime
                                                                                                                                page_size30The number of Trackers to return on each page. The maximum value is 100
                                                                                                                                tracking_code9400110898825022579493Only returns Trackers with the given tracking_code. Useful for retrieving an individual Tracker by tracking_code rather than by ID
                                                                                                                                carrierUSPSOnly returns Trackers with the given carrier value
                                                                                                                                Retrieve a list of Tracker Example
                                                                                                                                import com.easypost.EasyPost;
                                                                                                                                import com.easypost.exception.EasyPostException;
                                                                                                                                
                                                                                                                                EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                                                
                                                                                                                                Map<String, Object> list_params = new HashMap<>();
                                                                                                                                list_params.put("page_size", 2);
                                                                                                                                list_params.put("start_datetime", "2016-01-02T08:50:00Z");
                                                                                                                                
                                                                                                                                TrackerCollection trackers = Tracker.all(list_params);
                                                                                                                                {
                                                                                                                                  "trackers": [
                                                                                                                                    {
                                                                                                                                      "id": "trk_...",
                                                                                                                                      "object": "Tracker",
                                                                                                                                      "mode": "test",
                                                                                                                                      "tracking_code": "9400110898825022579493",
                                                                                                                                      "status": "in_transit",
                                                                                                                                      "created_at": "2016-01-13T21:52:28Z",
                                                                                                                                      "updated_at": "2016-01-13T21:52:32Z",
                                                                                                                                      "signed_by": null,
                                                                                                                                      "weight": null,
                                                                                                                                      "est_delivery_date": null,
                                                                                                                                      "shipment_id": null,
                                                                                                                                      "carrier": "USPS",
                                                                                                                                      "public_url": "https://track.easypost.com/djE6...",
                                                                                                                                      "tracking_details": [
                                                                                                                                        {
                                                                                                                                          "object": "TrackingDetail",
                                                                                                                                          "message": "Shipping Label Created",
                                                                                                                                          "status": "pre_transit",
                                                                                                                                          "datetime": "2015-12-31T15:58:00Z",
                                                                                                                                          "source": "USPS",
                                                                                                                                          "tracking_location": {
                                                                                                                                            "object": "TrackingLocation",
                                                                                                                                            "city": "FOUNTAIN VALLEY",
                                                                                                                                            "state": "CA",
                                                                                                                                            "country": null,
                                                                                                                                            "zip": "92708"
                                                                                                                                          }
                                                                                                                                        },
                                                                                                                                        {
                                                                                                                                          "object": "TrackingDetail",
                                                                                                                                          "message": "Arrived at Post Office",
                                                                                                                                          "status": "in_transit",
                                                                                                                                          "datetime": "2016-01-07T06:58:00Z",
                                                                                                                                          "source": "USPS",
                                                                                                                                          "tracking_location": {
                                                                                                                                            "object": "TrackingLocation",
                                                                                                                                            "city": "FOUNTAIN VALLEY",
                                                                                                                                            "state": "CA",
                                                                                                                                            "country": null,
                                                                                                                                            "zip": "92728"
                                                                                                                                          }
                                                                                                                                        }
                                                                                                                                      ],
                                                                                                                                      "carrier_detail": null,
                                                                                                                                      "fees": [
                                                                                                                                        {
                                                                                                                                          "object": "Fee",
                                                                                                                                          "type": "TrackerFee",
                                                                                                                                          "amount": "0.00000",
                                                                                                                                          "charged": true,
                                                                                                                                          "refunded": false
                                                                                                                                        }
                                                                                                                                      ]
                                                                                                                                    },
                                                                                                                                    {
                                                                                                                                      "id": "trk_...",
                                                                                                                                      "object": "Tracker",
                                                                                                                                      "mode": "test",
                                                                                                                                      "tracking_code": "JW061221982GB",
                                                                                                                                      "status": "unknown",
                                                                                                                                      "created_at": "2016-01-20T19:22:26Z",
                                                                                                                                      "updated_at": "2016-01-20T19:22:29Z",
                                                                                                                                      "signed_by": null,
                                                                                                                                      "weight": null,
                                                                                                                                      "est_delivery_date": null,
                                                                                                                                      "shipment_id": null,
                                                                                                                                      "carrier": "RoyalMail",
                                                                                                                                      "tracking_details": [],
                                                                                                                                      "carrier_detail": null,
                                                                                                                                      "public_url": "https://track.easypost.com/djE7...",
                                                                                                                                      "fees": [{
                                                                                                                                        "object": "Fee",
                                                                                                                                        "type": "TrackerFee",
                                                                                                                                        "amount": "0.00000",
                                                                                                                                        "charged": true,
                                                                                                                                        "refunded": false
                                                                                                                                      }]
                                                                                                                                    }
                                                                                                                                  ],
                                                                                                                                  "has_more": true
                                                                                                                                }
                                                                                                                                GET/trackers/:id

                                                                                                                                Retrieve a Tracker

                                                                                                                                Retrieve a Tracker by id.

                                                                                                                                Retrieve a Tracker Request Parameters
                                                                                                                                paramexampleinfo
                                                                                                                                idtrk_...Unique, starts with "trk_"
                                                                                                                                Retrieve a Tracker Example
                                                                                                                                import com.easypost.EasyPost;
                                                                                                                                import com.easypost.exception.EasyPostException;
                                                                                                                                
                                                                                                                                EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                                                
                                                                                                                                Tracker tracker = Tracker.retrieve("trk_...");
                                                                                                                                {
                                                                                                                                  "id": "trk_...",
                                                                                                                                  "object": "Tracker",
                                                                                                                                  "mode": "test",
                                                                                                                                  "tracking_code": "9400110898825022579493",
                                                                                                                                  "status": "in_transit",
                                                                                                                                  "created_at": "2016-01-13T21:52:28Z",
                                                                                                                                  "updated_at": "2016-01-15T20:56:56Z",
                                                                                                                                  "signed_by": null,
                                                                                                                                  "weight": null,
                                                                                                                                  "est_delivery_date": null,
                                                                                                                                  "shipment_id": null,
                                                                                                                                  "carrier": "USPS",
                                                                                                                                  "public_url": "https://track.easypost.com/djE8...",
                                                                                                                                  "tracking_details": [
                                                                                                                                    {
                                                                                                                                      "object": "TrackingDetail",
                                                                                                                                      "message": "Shipping Label Created",
                                                                                                                                      "status": "pre_transit",
                                                                                                                                      "datetime": "2015-12-31T15:58:00Z",
                                                                                                                                      "source": "USPS",
                                                                                                                                      "tracking_location": {
                                                                                                                                        "object": "TrackingLocation",
                                                                                                                                        "city": "FOUNTAIN VALLEY",
                                                                                                                                        "state": "CA",
                                                                                                                                        "country": null,
                                                                                                                                        "zip": "92708"
                                                                                                                                      }
                                                                                                                                    },
                                                                                                                                    {
                                                                                                                                      "object": "TrackingDetail",
                                                                                                                                      "message": "Arrived at Post Office",
                                                                                                                                      "status": "in_transit",
                                                                                                                                      "datetime": "2016-01-07T06:58:00Z",
                                                                                                                                      "source": "USPS",
                                                                                                                                      "tracking_location": {
                                                                                                                                        "object": "TrackingLocation",
                                                                                                                                        "city": "FOUNTAIN VALLEY",
                                                                                                                                        "state": "CA",
                                                                                                                                        "country": null,
                                                                                                                                        "zip": "92728"
                                                                                                                                      }
                                                                                                                                    }
                                                                                                                                  ],
                                                                                                                                  "carrier_detail": null,
                                                                                                                                  "fees": [
                                                                                                                                    {
                                                                                                                                      "object": "Fee",
                                                                                                                                      "type": "TrackerFee",
                                                                                                                                      "amount": "0.00000",
                                                                                                                                      "charged": true,
                                                                                                                                      "refunded": false
                                                                                                                                    }
                                                                                                                                  ]
                                                                                                                                }

                                                                                                                                Batches

                                                                                                                                The Batch object allows you to perform operations on multiple Shipments at once. This includes scheduling a Pickup, creating a ScanForm and consolidating labels. Operations performed on Batches are asynchronous and take advantage of our webhook infrastructure.

                                                                                                                                Batch Object

                                                                                                                                attributetypespecification
                                                                                                                                idstringUnique, begins with "batch_"
                                                                                                                                referencestringAn optional field that may be used in place of ID in some API endpoints
                                                                                                                                objectstring"Batch"
                                                                                                                                modestring"test" or "production"
                                                                                                                                statestringThe overall state. Possible values are "creating", "creation_failed", "created", "purchasing", "purchase_failed", "purchased", "label_generating", and "label_generated"
                                                                                                                                num_shipmentsintegerThe number of shipments added
                                                                                                                                shipmentsBatchShipment array
                                                                                                                                statusobjectA map of BatchShipment statuses to the count of BatchShipments with that status. Valid statuses are "postage_purchased", "postage_purchase_failed", "queued_for_purchase", and "creation_failed"
                                                                                                                                label_urlstringThe label image url
                                                                                                                                scan_formScanFormThe created ScanForm
                                                                                                                                pickupPickupThe created Pickup
                                                                                                                                created_atdatetime
                                                                                                                                updated_atdatetime

                                                                                                                                BatchShipment Object

                                                                                                                                attributetypespecification
                                                                                                                                idstringThe id of the Shipment. Unique, begins with "shp_"
                                                                                                                                referencestringAn optional field that may be used in place of ID in some API endpoints
                                                                                                                                batch_statusstringThe current status. Possible values are "postage_purchased", "postage_purchase_failed", "queued_for_purchase", and "creation_failed"
                                                                                                                                batch_messagestringA human readable message for any errors that occurred during the Batch's life cycle
                                                                                                                                POST/batches

                                                                                                                                Create a Batch

                                                                                                                                A Batch can be created with or without Shipments. When created with Shipments the initial state will be creating. Once the state changes to created a webhook Event will be sent. When created with no Shipments the initial state will be created and webhook will be sent.

                                                                                                                                Create Batch Example
                                                                                                                                import com.easypost.EasyPost;
                                                                                                                                import com.easypost.exception.EasyPostException;
                                                                                                                                
                                                                                                                                EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                                                
                                                                                                                                List<Map<String, Object>> shipmentsList = new ArrayList<Map<String, Object>>();
                                                                                                                                
                                                                                                                                Map<String, Object> shipmentMap = new HashMap<String, Object>();
                                                                                                                                shipmentMap.put("id", "shp_...");
                                                                                                                                
                                                                                                                                shipmentsList.add(shipmentMap);
                                                                                                                                
                                                                                                                                Map<String, Object> batchMap = new HashMap<String, Object>();
                                                                                                                                batchMap.put("shipment", shipmentsList);
                                                                                                                                Batch batch = Batch.create(batchMap);
                                                                                                                                {
                                                                                                                                  "id": "batch_...",
                                                                                                                                  "label_url": null,
                                                                                                                                  "mode": "test",
                                                                                                                                  "num_shipments": 1,
                                                                                                                                  "object": "Batch",
                                                                                                                                  "reference": null,
                                                                                                                                  "scan_form": null,
                                                                                                                                  "shipments": [
                                                                                                                                    {
                                                                                                                                      "id": "shp_...",
                                                                                                                                      "batch_status": "postage_purchased",
                                                                                                                                      "batch_message": null,
                                                                                                                                      "reference": null
                                                                                                                                    }
                                                                                                                                  ],
                                                                                                                                  "state": "created",
                                                                                                                                  "status": {
                                                                                                                                    "created": 0,
                                                                                                                                    "queued_for_purchase": 0,
                                                                                                                                    "creation_failed": 0,
                                                                                                                                    "postage_purchased": 0,
                                                                                                                                    "postage_purchase_failed": 0
                                                                                                                                  },
                                                                                                                                  "label_url": null,
                                                                                                                                  "created_at": "2014-07-22T07:34:39Z",
                                                                                                                                  "updated_at": "2014-07-22T07:34:39Z"
                                                                                                                                }
                                                                                                                                GET/batches/:id

                                                                                                                                Retrieve Batch

                                                                                                                                A Batch can be retrieved by either its id or reference. However it is recommended to use EasyPost's provided identifiers because uniqueness on reference is not enforced.

                                                                                                                                Retrieve Batch Example
                                                                                                                                import com.easypost.EasyPost;
                                                                                                                                import com.easypost.exception.EasyPostException;
                                                                                                                                
                                                                                                                                EasyPost.apiKey = "<YOUR_TEST/PRODUCTION_API_KEY>";
                                                                                                                                
                                                                                                                                Batch batch = Batch.retrieve("batch_...");
                                                                                                                                {
                                                                                                                                    "created_at": "2022-06-14T22:38:54Z",
                                                                                                                                    "id": "batch_...",
                                                                                                                                    "label_url": null,
                                                                                                                                    "mode": "test",
                                                                                                                                    "num_shipments": 1,
                                                                                                                                    "object": "Batch",
                                                                                                                                    "pickup": null,
                                                                                                                                    "reference": null,
                                                                                                                                    "scan_form": {
                                                                                                                                      "address": null,
                                                                                                                                      "batch_id": "batch_...",
                                                                                                                                      "confirmation": null,
                                                                                                                                      "created_at": "2022-06-14T22:38:54Z",
                                                                                                                                      "form_file_type": null,
                                                                                                                                      "form_url": null,
                                                                                                                                      "id": "sf_...",
                                                                                                                                      "message": "Please provide a valid list of shipments.",
                                                                                                                                      "object": "ScanForm",
                                                                                                                                      "status": "failed",
                                                                                                                                      "tracking_codes": [],
                                                                                                                                      "updated_at": "2022-06-14T22:38:54Z"
                                                                                                                                    },
                                                                                                                                    "shipments": [],
                                                                                                                                    "state": "creating",
                                                                                                                                    "status": {
                                                                                                                                      "created": 0,
                                                                                                                                      "creation_failed": 0,
                                                                                                                                      "postage_purchase_failed": 0,
                                                                                                                                      "postage_purchased": 0,
                                                                                                                                      "queued_for_purchase": 0
                                                                                                                                    },
                                                                                                                                    "updated_at": "2022-06-14T22:38:54Z"
                                                                                                                                  }
                                                                                                                                GET/batches

                                                                                                                                List all Batches

                                                                                                                                The Batch List is a paginated list of all Batch objects associated with the given API Key. It accepts a variety of parameters which can be used to modify the scope. The has_more attribute indicates whether or not additional pages can be requested. The recommended way of paginating is to use either the before_id or after_id parameter to specify where the next page begins.

                                                                                                                                Retrieve a list of Batch Request Parameters
                                                                                                                                paramexampleinfo
                                                                                                                                before_idbatch_...Optional pagination parameter. Only batches created before the given ID will be included. May not be used with after_id
                                                                                                                                after_idbatch_...Optional pagination parameter. Only batches created after the given ID will be included. May not be used with before_id
                                                                                                                                start_datetime2016-01-02T00:00:00ZOnly return Batches created after this timestamp. Defaults to 1 month ago, or 1 month before a passed end_datetime
                                                                                                                                end_datetime2016-01-02T00:00:00ZOnly return Batches created before this timestamp. Defaults to end of the current day, or 1 month after a passed start_datetime
                                                                                                                                page_size5The number of Batches to return on each page. The maximum value is 100
                                                                                                                                Retrieve a list of Batch Example