### Starting the Application Source: https://docs.easypost.com/guides/printing-with-printnode This output shows the application starting up and the WEBrick server listening on port 4567. Ensure your application starts successfully before proceeding. ```text [2016-04-28 19:45:52] INFO WEBrick 1.3.1 [2016-04-28 19:45:52] INFO ruby 2.3.1 (2016-04-26) [x86_64-darwin15] == Sinatra (v1.4.7) has taken the stage on 4567 for development with backup from WEBrick [2016-04-28 19:45:52] INFO WEBrick::HTTPServer#start: pid=63201 port=4567 ``` -------------------------------- ### Sinatra Development Server Output Source: https://docs.easypost.com/guides/ui-for-buying-shipments Example output when starting a Sinatra development server. This indicates the server is running and listening on a specific port. ```text [2016-06-07 15:51:45] INFO WEBrick 1.3.1 [2016-06-07 15:51:45] INFO ruby 2.0.0 (2015-04-13) [universal.x86_64-darwin15] == Sinatra (v1.4.7) has taken the stage on 4567 for development with backup from WEBrick [2016-06-07 15:51:45] INFO WEBrick::HTTPServer#start: pid=3336 port=4567 ``` -------------------------------- ### Install Dependencies Source: https://docs.easypost.com/guides/sms-tracking-tutorial Install the necessary Python libraries: Flask for the web framework, EasyPost for shipment tracking, and Twilio for SMS. ```bash pip install flask easypost twilio ``` -------------------------------- ### Basic Sinatra App Setup Source: https://docs.easypost.com/guides/printing-with-printnode Initialize the Sinatra application, load environment variables, and set up EasyPost and PrintNode clients. ```ruby require 'sinatra/base' require 'easypost' require 'printnode' require 'tilt/erb' require 'dotenv' class App < Sinatra::Base configure do Dotenv.load EasyPost::Client.new(api_key: 'EASYPOST_API_KEY') set :printnode_client, PrintNode::Client.new(PrintNode::Auth.new('PRINTNODE_API_KEY')) set :printer_id, 'PRINTNODE_PRINTER_ID' end get '/' do "Hello World! Our printer id is #{settings.printer_id}" end # start the server if this file is executed directly run! if app_file == $PROGRAM_NAME end ``` -------------------------------- ### Obtain Client Secret for Credit Card Setup Source: https://docs.easypost.com/docs/users/billing Call this endpoint to get a `client_secret` for securely collecting credit card details via Stripe.js. This is a prerequisite for adding credit cards for ReferralCustomers or Parent User accounts. ```bash curl -X POST "https://api.easypost.com/beta/setup_intents" \ -u "$REFERRAL_USER_API_KEY:" \ -H "Content-Type: application/json" ``` ```json { "client_secret": "seti_0RMykgDqT4huGUvdzbFGyga7_secret_SHXqqEv2YUaSYMysME8Nk06wfBtYk8w" } ``` -------------------------------- ### Create a Batch and Purchase Labels Source: https://docs.easypost.com/guides/batches-guide This example shows how to create a batch and immediately initiate the purchase of shipping labels. It's recommended to keep batches under 1,000 shipments to avoid timeouts. ```bash curl -X POST https://api.easypost.com/v2/batches \ -u "EASYPOST_API_KEY": \ -H 'Content-Type: application/json' \ -d '{ "batch": { "shipments": [ "from_address": {"id": "adr_..."}, "to_address": {"id": "adr_..."}, "parcel": {"id": "prcl_..."}, "service": "First", "carrier": "USPS", "carrier_accounts": ["ca_..."] ] } }' ``` -------------------------------- ### Initialize Flask App and Clients Source: https://docs.easypost.com/guides/sms-tracking-tutorial Set up the Flask application, load configuration from a file, and initialize the EasyPost and Twilio clients using API keys and tokens. ```python import easypost from flask import Flask from twilio.rest import TwilioRestClient app = Flask(__name__) app.config.from_object("config") client = easypost.EasyPostClient(app.config["EASYPOST_API_KEY"]) twilio_client = TwilioRestClient(app.config["TWILIO_ACCOUNT_SID"], app.config["TWILIO_AUTH_TOKEN"]) ``` -------------------------------- ### PostageLabel Object Example Source: https://docs.easypost.com/docs/shipments An example of a PostageLabel object returned by the API. ```json { "object": "PostageLabel", "id": "pl_6270007cad7643eaad274bb5c71e9614", "created_at": "2025-05-09T20:40:11Z", "updated_at": "2025-05-09T20:40:12Z", "date_advance": 0, "integrated_form": "none", "label_date": "2025-05-09T20:40:11Z", "label_resolution": 300, "label_size": "4x6", "label_type": "default", "label_file_type": "image/png", "label_url": "https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20250509/e857a7afd19edf498587cd09e2564722ab.png", "label_pdf_url": null, "label_zpl_url": "https://easypost-files.s3-us-west-2.amazonaws.com/files/postage_label/20250509/cbed7645eafc4a23af370b4525144fc3.zpl", "label_epl2_url": null, "label_file": null } ``` -------------------------------- ### Initialize Sinatra App and Clients Source: https://docs.easypost.com/guides/email-tracking-tutorial Set up a basic Sinatra application, load environment variables, and initialize EasyPost and SendGrid clients with API keys. ```ruby require 'sinatra/base' require 'easypost' require 'sendgrid-ruby' require 'tilt/erb' require 'pry' require 'dotenv' class App < Sinatra::Base set :show_exceptions, :after_handler configure :development, :test do Dotenv.load end configure do EasyPost::Client.new(api_key: 'EASYPOST_API_KEY') set :sendgrid, SendGrid::API.new(api_key: 'SENDGRID_API_KEY') end end ``` -------------------------------- ### Address Object Example Source: https://docs.easypost.com/docs/orders This is an example of an Address object, used for both sender and recipient details in shipments. ```json { "id": "adr_e476e5f52d1611f0b8e43cecef1b359e", "object": "Address", "created_at": "2025-05-09T20:47:59+00:00", "updated_at": "2025-05-09T20:47:59+00:00", "name": "EasyPost", "company": null, "street1": "417 Montgomery Street", "street2": "5th Floor", "city": "San Francisco", "state": "CA", "zip": "94104", "country": "US", "phone": "4153334445", "email": "support@easypost.com", "mode": "test", "carrier_facility": null, "residential": null, "federal_tax_id": null, "state_tax_id": null, "verifications": {} } ``` ```json { "id": "adr_e474df1f2d1611f0b8e33cecef1b359e", "object": "Address", "created_at": "2025-05-09T20:47:59+00:00", "updated_at": "2025-05-09T20:47:59+00:00", "name": "Dr. Steve Brule", "company": null, "street1": "179 N Harbor Dr", "street2": null, "city": "Redondo Beach", "state": "CA", "zip": "90277", "country": "US", "phone": "8573875756", "email": "dr_steve_brule@gmail.com", "mode": "test", "carrier_facility": null, "residential": null, "federal_tax_id": null, "state_tax_id": null, "verifications": {} } ``` -------------------------------- ### Claim Object Example Source: https://docs.easypost.com/docs/insurance/claims An example of a Claim object, illustrating its typical JSON structure and data. ```APIDOC ## Claim Object Copy code ```json { "approved_amount": null, "attachments": [ "https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20250512/a915d0e238074fff9729afa1bfb87a0e.png", "https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20250512/3020f31a57374dc3ace477f7a4ec860d.png", "https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20250512/88aada9e505f4e77bd6060710d78e497.png" ], "check_delivery_address": null, "contact_email": "test@example.com", "created_at": "2025-05-12T19:08:04Z", "description": "Test description", "history": [ { "status": "submitted", "status_detail": "Claim was created.", "timestamp": "2025-05-12T19:08:04Z" } ], "id": "clm_09d89e88a0c943d59018bc26b041c41c", "insurance_amount": "100.00", "insurance_id": "ins_da31156b6335407da23ee06fa2fe8a28", "mode": "test", "object": "Claim", "payment_method": "easypost_wallet", "recipient_name": null, "requested_amount": "100.00", "salvage_value": null, "shipment_id": "shp_531f76e4a4de491183f5cabb738cb828", "status": "submitted", "status_detail": "Claim was created.", "status_timestamp": "2025-05-12T19:08:04Z", "tracking_code": "9405500208303109888319", "type": "damage", "updated_at": "2025-05-12T19:08:04Z" } ``` ``` -------------------------------- ### CarrierAccount Object Example Source: https://docs.easypost.com/docs/carrier-accounts This is an example of the CarrierAccount object structure, including credentials and other account details. ```json { "id": "ca_a2cb50e6c5c3451586b3a507db5f163a", "object": "CarrierAccount", "type": "DhlEcsAccount", "clone": false, "created_at": "2025-05-09T20:39:13Z", "updated_at": "2025-05-09T20:39:13Z", "description": "CA Location DHL eCommerce Solutions Account", "reference": null, "billing_type": "carrier", "readable": "DHL eCommerce", "logo": null, "fields": { "credentials": { "client_id": { "visibility": "visible", "label": "DHL eCommerce client ID", "value": "123456" }, "client_secret": { "visibility": "password", "label": "DHL eCommerce client secret", "value": "********" }, "pickup_id": { "visibility": "visible", "label": "DHL eCommerce pickup ID", "value": "123456" }, "distribution_center": { "visibility": "visible", "label": "DHL eCommerce distribution center", "value": "USLAX1" } }, "test_credentials": { "client_id": { "visibility": "visible", "label": "Test DHL eCommerce client ID", "value": "123456" }, "client_secret": { "visibility": "password", "label": "Test DHL eCommerce client secret", "value": "********" }, "pickup_id": { "visibility": "visible", "label": "Test DHL eCommerce pickup ID", "value": "123456" }, "distribution_center": { "visibility": "visible", "label": "Test DHL eCommerce distribution center", "value": "USLAX1" } } }, "credentials": { "client_id": "123456", "client_secret": "********", "pickup_id": "123456", "distribution_center": "USLAX1" }, "test_credentials": { "client_id": "123456", "client_secret": "********", "pickup_id": "123456", "distribution_center": "USLAX1" } } ``` -------------------------------- ### Basic Sinatra Application Source: https://docs.easypost.com/guides/ui-for-buying-shipments Create a basic Sinatra application that requires necessary gems, loads environment variables, initializes the EasyPost client, and sets up a root route. ```ruby require 'sinatra/base' require 'easypost' require 'tilt/erb' require 'dotenv' class App < Sinatra::Base configure :development, :test do Dotenv.load end configure do EasyPost::Client.new(api_key: 'EASYPOST_API_KEY') end get '/' do 'Hello World' end # start the server if this file is executed directly run! if app_file == $PROGRAM_NAME end ``` -------------------------------- ### Receiving a Webhook Example in Ruby Source: https://docs.easypost.com/guides/webhooks-guide This Ruby example demonstrates how to receive and process webhook events using Sinatra. It specifically handles batch creation events and checks for purchase failures. ```ruby require 'easypost' require 'sinatra' post '/easypost-webhook' do result = params['result'] case result['object'] when 'Batch' batch = client.batch.create(result) case batch.state when 'purchase_failed' batch.shipments.each do |shipment| if shipment.batch_status == 'postage_purchase_failed' client.batch.remove_shipments(batch.id, shipments: [shipment]) end end end end end ``` -------------------------------- ### Fee Object Example Source: https://docs.easypost.com/docs/fees This is an example of a Fee object, illustrating the structure and possible values for its properties. ```json { "object": "Fee", "type": "PostageFee", "amount": "8.20000", "charged": true, "refunded": false } ``` -------------------------------- ### Webhook POST JSON Example Source: https://docs.easypost.com/guides/webhooks-guide This is an example of a webhook POST request payload for a batch creation event. ```json { "mode": "production", "description": "batch.created", "previous_attributes": { "state": "purchasing" }, "pending_urls": ["example.com/easypost-webhook"], "completed_urls": [], "created_at": "2015-12-03T19:09:19Z", "updated_at": "2015-12-03T19:09:19Z", "result": { "id": "batch_...", "object": "Batch", "mode": "production", "state": "purchased", "num_shipments": 1, "reference": null, "created_at": "2015-12-03T19:09:19Z", "updated_at": "2015-12-03T19:09:19Z", "scan_form": null, "shipments": [ { "batch_status": "postage_purchased", "batch_message": null, "id": "shp_a5b1348307694736aaqqqq8fqda53f93" } ], "status": { "created": 0, "queued_for_purchase": 0, "creation_failed": 0, "postage_purchased": 1, "postage_purchase_failed": 0 }, "pickup": null, "label_url": null }, "id": "evt_...", "object": "Event" } ``` -------------------------------- ### Create a Webhook Source: https://docs.easypost.com/guides/webhooks-guide This example demonstrates how to create a new webhook using a cURL command. It includes setting the webhook URL, a webhook secret for security, and custom headers. ```APIDOC ## POST /webhooks ### Description Creates a new webhook endpoint to receive event notifications. ### Method POST ### Endpoint /webhooks ### Request Body - **webhook** (object) - Required - Contains webhook configuration details. - **url** (string) - Required - The URL where webhook events will be sent. - **webhook_secret** (string) - Optional - A secret used for HMAC signature generation. - **custom_headers** (array) - Optional - An array of custom headers to include with webhook requests. - **name** (string) - Required - The name of the custom header. - **value** (string) - Required - The value of the custom header. ### Request Example ```json { "webhook": { "url": "example.com", "webhook_secret": "A1B2C3", "custom_headers": [ { "name": "X-Header-Name", "value": "header_value" } ] } } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the webhook. - **object** (string) - The type of object, which is "Webhook". - **created_at** (string) - The timestamp when the webhook was created. - **updated_at** (string) - The timestamp when the webhook was last updated. - **url** (string) - The configured webhook URL. - **webhook_secret** (string) - The webhook secret used for authentication. - **custom_headers** (array) - An array of custom headers configured for the webhook. #### Response Example ```json { "id": "wh_12345", "object": "Webhook", "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:00:00Z", "url": "example.com", "webhook_secret": "A1B2C3", "custom_headers": [ { "name": "X-Header-Name", "value": "header_value" } ] } ``` ``` -------------------------------- ### Rate Object Example Source: https://docs.easypost.com/docs/shipments/rates This is an example of the Rate object returned by the API. It includes all available fields and their typical values. ```json { "id": "rate_1ad9f7990aa6453d8060325fd7f17d8a", "object": "Rate", "created_at": "2025-05-09T20:39:58Z", "updated_at": "2025-05-09T20:39:58Z", "mode": "test", "service": "Priority", "carrier": "USPS", "rate": "11.01", "currency": "USD", "retail_rate": "15.40", "retail_currency": "USD", "list_rate": "11.01", "list_currency": "USD", "billing_type": "easypost", "delivery_days": 2, "delivery_date": null, "delivery_date_guaranteed": false, "est_delivery_days": 2, "shipment_id": "shp_d121498c06864586b0c9d961e971f509", "carrier_account_id": "ca_9685a1198a75477885a3cdca37559bac" } ``` -------------------------------- ### Order Creation Response Example Source: https://docs.easypost.com/docs/orders This is a sample response when an Order is successfully created. It includes details of the created Order, including addresses and shipment information. ```json { "mode": "test", "reference": "", "is_return": false, "options": { "currency": "USD", "payment": { "type": "SENDER" } }, "messages": [], "created_at": "2025-05-09T20:47:59Z", "updated_at": "2025-05-09T20:47:59Z", "customs_info": null, "from_address": { "id": "adr_e476e5f52d1611f0b8e43cecef1b359e", "object": "Address", "created_at": "2025-05-09T20:47:59+00:00", "updated_at": "2025-05-09T20:47:59+00:00", "name": "EasyPost", "company": null, "street1": "417 Montgomery Street", "street2": "5th Floor", "city": "San Francisco", "state": "CA", "zip": "94104", "country": "US", "phone": "4153334445", "email": "support@easypost.com", "mode": "test", "carrier_facility": null, "residential": null, "federal_tax_id": null, "state_tax_id": null, "verifications": {} }, "to_address": { "id": "adr_e474df1f2d1611f0b8e33cecef1b359e", "object": "Address", "created_at": "2025-05-09T20:47:59+00:00", "updated_at": "2025-05-09T20:47:59+00:00", "name": "Dr. Steve Brule", "company": null, "street1": "179 N Harbor Dr", "street2": null, "city": "Redondo Beach", "state": "CA", "zip": "90277", "country": "US", "phone": "8573875756", "email": "dr_steve_brule@gmail.com", "mode": "test", "carrier_facility": null, "residential": null, "federal_tax_id": null, "state_tax_id": null, "verifications": {} }, "buyer_address": { "id": "adr_e474df1f2d1611f0b8e33cecef1b359e", "object": "Address", "created_at": "2025-05-09T20:47:59+00:00", "updated_at": "2025-05-09T20:47:59+00:00", "name": "Dr. Steve Brule", "company": null, "street1": "179 N Harbor Dr", "street2": null, "city": "Redondo Beach", "state": "CA", "zip": "90277", "country": "US", "phone": "8573875756", "email": "dr_steve_brule@gmail.com", "mode": "test", "carrier_facility": null, "residential": null, "federal_tax_id": null, "state_tax_id": null, "verifications": {} }, "return_address": { "id": "adr_e476e5f52d1611f0b8e43cecef1b359e", "object": "Address", "created_at": "2025-05-09T20:47:59+00:00", "updated_at": "2025-05-09T20:47:59+00:00", "name": "EasyPost", "company": null, "street1": "417 Montgomery Street", "street2": "5th Floor", "city": "San Francisco", "state": "CA", "zip": "94104", "country": "US", "phone": "4153334445", "email": "support@easypost.com", "mode": "test", "carrier_facility": null, "residential": null, "federal_tax_id": null, "state_tax_id": null, "verifications": {} }, "shipments": [ { "id": "shp_6a74ecd236cd4ce2abfda24c65cb1bf4", "created_at": "2025-05-09T20:47:59Z", "is_return": false, "messages": [], "mode": "test", "options": { "currency": "USD", "payment": { "type": "SENDER" }, "date_advance": 0 }, "reference": null, "status": "unknown", "tracking_code": null ``` -------------------------------- ### VerificationDetails Object Example Source: https://docs.easypost.com/docs/addresses Provides an example of the VerificationDetails object, containing geographical coordinates and time zone information. ```json { "latitude": 37.79342, "longitude": -122.40288, "time_zone": "America/Los_Angeles" } ``` -------------------------------- ### Retrieve a Webhook Event JSON Example Source: https://docs.easypost.com/guides/webhooks-guide This is an example of a JSON payload for a retrieved webhook event, specifically a tracker update. ```json { "description": "tracker.updated", "mode": "test", "previous_attributes": { "status": "pre_transit" }, "created_at": "2022-10-26T20:18:21.000Z", "pending_urls": [], "completed_urls": [], "updated_at": "2022-10-26T20:18:21.000Z", "id": "evt_55a53eb2556b11ed8945059f515d2b6d", "user_id": "user_060ab38db3c04ffaa60f262e5781a9be", "status": "pending", "object": "Event" } ``` -------------------------------- ### Create a Shipment with Options Source: https://docs.easypost.com/docs/shipments/options This example demonstrates how to create a shipment and include custom options, such as a custom message for the label. ```APIDOC ## Create a Shipment with Options Any number of `options` can be specified during `Shipment` creation. A **Shipment** object is immutable once created. All information must be provided during creation; **it cannot be modified later**. ### Method POST ### Endpoint /shipments ### Request Body - **shipment** (object) - Required - The shipment object containing details like addresses, parcel, and options. - **to_address** (object) - Required - The recipient's address. - **id** (string) - Required - The ID of a saved address. - **from_address** (object) - Required - The sender's address. - **id** (string) - Required - The ID of a saved address. - **parcel** (object) - Required - The parcel details. - **id** (string) - Required - The ID of a saved parcel. - **options** (object) - Optional - Customization options for the shipment. - **print_custom_1** (string) - Optional - A custom message to print on the label. ### Request Example ```json { "shipment": { "to_address": { "id": "adr_..." }, "from_address": { "id": "adr_..." }, "parcel": { "id": "prcl_..." }, "options": { "print_custom_1": "Custom label message" } } } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the shipment. - **created_at** (string) - The timestamp when the shipment was created. - **is_return** (boolean) - Indicates if the shipment is a return. - **messages** (array) - A list of messages associated with the shipment. - **mode** (string) - The mode of the shipment (e.g., 'test', 'production'). - **options** (object) - The options applied to the shipment. - **print_custom_1** (string) - The custom message for the label. - **currency** (string) - The currency used for the shipment. - **print_custom** (array) - A list of custom print elements. - **payment** (object) - Payment details. - **type** (string) - The type of payment. - **date_advance** (integer) - The number of days to advance the shipment date. - **reference** (string) - A reference identifier for the shipment. - **status** (string) - The current status of the shipment. - **tracking_code** (string) - The tracking code for the shipment. - **updated_at** (string) - The timestamp when the shipment was last updated. - **batch_id** (string) - The ID of the batch the shipment belongs to. - **batch_status** (string) - The status of the batch. - **batch_message** (string) - A message related to the batch. - **customs_info** (object) - Customs information for international shipments. - **from_address** (object) - The sender's address details. - **insurance** (string) - Insurance details for the shipment. - **order_id** (string) - The order ID associated with the shipment. - **parcel** (object) - The details of the parcel. - **postage_label** (object) - The postage label information. - **rates** (array) - A list of available shipping rates. ### Response Example ```json { "id": "shp_7c61909a41584d3f8fa3bd63c3c2c0af", "created_at": "2025-05-09T20:39:23Z", "is_return": false, "messages": [], "mode": "test", "options": { "print_custom_1": "Custom label message", "currency": "USD", "print_custom": [ { "value": "Custom label message" } ], "payment": { "type": "SENDER" }, "date_advance": 0 }, "reference": null, "status": "unknown", "tracking_code": null, "updated_at": "2025-05-09T20:39:23Z", "batch_id": null, "batch_status": null, "batch_message": null, "customs_info": { "id": "cstinfo_34644b53f63c40959fdd19b446e6a8bc", "object": "CustomsInfo", "created_at": "2025-05-09T20:39:23Z", "updated_at": "2025-05-09T20:39:23Z", "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_3f59190656964a7697f0a366d3d549c9", "object": "CustomsItem", "created_at": "2025-05-09T20:39:23Z", "updated_at": "2025-05-09T20:39:23Z", "description": "T-shirt", "hs_tariff_number": "123456", "origin_country": "US", "quantity": 1, "value": "10.0", "weight": 5.0, "code": "123", "mode": "test", "manufacturer": null, "currency": null, "eccn": null, "printed_commodity_identifier": null } ] }, "from_address": { "id": "adr_b0b977532d1511f083b1ac1f6bc539aa", "object": "Address", "created_at": "2025-05-09T20:39:23+00:00", "updated_at": "2025-05-09T20:39:23+00:00", "name": "EasyPost", "company": null, "street1": "417 Montgomery Street", "street2": "5th Floor", "city": "San Francisco", "state": "CA", "zip": "94104", "country": "US", "phone": "4153334445", "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_7218c32c547c451a9f93c0be8efb8328", "object": "Parcel", "created_at": "2025-05-09T20:39:23Z", "updated_at": "2025-05-09T20:39:23Z", "length": 20.2, "width": 10.9, "height": 5.0, "predefined_package": null, "weight": 65.9, "mode": "test" }, "postage_label": null, "rates": [ { "id": "rate_799b8c20e3644f6bac47f613062e0bf5", "object": "Rate", "created_at": "2025-05-09T20:39:23Z", "updated_at": "2025-05-09T20:39:23Z", "mode": "test", "service": "Express", "carrier": "USPS", "rate": "51.20", "currency": "USD", "retail_rate": "59.25", "retail_currency": "USD", "list_rate": "51.20", "list_currency": "USD", "billing_type": "easypost", "delivery_days": 2, "delivery_date": null, "delivery_date_guaranteed": false, "est_delivery_days": 2, "shipment_id": "shp_7c61909a41584d3f8fa3bd63c3c2c0af", "carrier_account_id": "ca_9685a1198a75477885a3cdca37559bac" }, { "id": "rate_a23973392089450d9956b6d84a5f66c2", "object": "Rate", "created_at": "2025-05-09T20:39:23Z", "updated_at": "2025-05-09T20:39:23Z", "mode": "test", "service": "Priority", "carrier": "USPS", "rate": "11.01", "currency": "USD", "retail_rate": "15.40", "retail_currency": "USD", "list_rate": "11.01", "list_currency": "USD", "billing_type": "easypost", "delivery_days": 2, "delivery_date": null, "delivery_date_guaranteed": false, "est_delivery_days": 2 } ] } ``` ``` -------------------------------- ### Shipment Creation Response with Options Source: https://docs.easypost.com/docs/shipments/options This is an example response after creating a shipment with options. It shows the included 'options' object, detailing the custom label message and other settings like payment and currency. ```json { "id": "shp_7c61909a41584d3f8fa3bd63c3c2c0af", "created_at": "2025-05-09T20:39:23Z", "is_return": false, "messages": [], "mode": "test", "options": { "print_custom_1": "Custom label message", "currency": "USD", "print_custom": [ { "value": "Custom label message" } ], "payment": { "type": "SENDER" }, "date_advance": 0 }, "reference": null, "status": "unknown", "tracking_code": null, "updated_at": "2025-05-09T20:39:23Z", "batch_id": null, "batch_status": null, "batch_message": null, "customs_info": { "id": "cstinfo_34644b53f63c40959fdd19b446e6a8bc", "object": "CustomsInfo", "created_at": "2025-05-09T20:39:23Z", "updated_at": "2025-05-09T20:39:23Z", "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_3f59190656964a7697f0a366d3d549c9", "object": "CustomsItem", "created_at": "2025-05-09T20:39:23Z", "updated_at": "2025-05-09T20:39:23Z", "description": "T-shirt", "hs_tariff_number": "123456", "origin_country": "US", "quantity": 1, "value": "10.0", "weight": 5.0, "code": "123", "mode": "test", "manufacturer": null, "currency": null, "eccn": null, "printed_commodity_identifier": null } ] }, "from_address": { "id": "adr_b0b977532d1511f083b1ac1f6bc539aa", "object": "Address", "created_at": "2025-05-09T20:39:23+00:00", "updated_at": "2025-05-09T20:39:23+00:00", "name": "EasyPost", "company": null, "street1": "417 Montgomery Street", "street2": "5th Floor", "city": "San Francisco", "state": "CA", "zip": "94104", "country": "US", "phone": "4153334445", "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_7218c32c547c451a9f93c0be8efb8328", "object": "Parcel", "created_at": "2025-05-09T20:39:23Z", "updated_at": "2025-05-09T20:39:23Z", "length": 20.2, "width": 10.9, "height": 5.0, "predefined_package": null, "weight": 65.9, "mode": "test" }, "postage_label": null, "rates": [ { "id": "rate_799b8c20e3644f6bac47f613062e0bf5", "object": "Rate", "created_at": "2025-05-09T20:39:23Z", "updated_at": "2025-05-09T20:39:23Z", "mode": "test", "service": "Express", "carrier": "USPS", "rate": "51.20", "currency": "USD", "retail_rate": "59.25", "retail_currency": "USD", "list_rate": "51.20", "list_currency": "USD", "billing_type": "easypost", "delivery_days": 2, "delivery_date": null, "delivery_date_guaranteed": false, "est_delivery_days": 2, "shipment_id": "shp_7c61909a41584d3f8fa3bd63c3c2c0af", "carrier_account_id": "ca_9685a1198a75477885a3cdca37559bac" }, { "id": "rate_a23973392089450d9956b6d84a5f66c2", "object": "Rate", "created_at": "2025-05-09T20:39:23Z", "updated_at": "2025-05-09T20:39:23Z", "mode": "test", "service": "Priority", "carrier": "USPS", "rate": "11.01", "currency": "USD", "retail_rate": "15.40", "retail_currency": "USD", "list_rate": "11.01", "list_currency": "USD", "billing_type": "easypost", "delivery_days": 2, "delivery_date": null, "delivery_date_guaranteed": false, "est_delivery_days": 2 } ] } ```