### Example Request with Query Parameters Source: https://www.shipengine.com/docs/rest This example demonstrates how to make a GET request to retrieve labels, filtering by creation date range using URL query parameters. ```HTTP GET /v1/labels?created_at_start=2020-11-09T00:37:54.14212Z&created_at_end=2020-11-09T22:37:54.14212Z HTTP/1.1 ``` -------------------------------- ### Example Response for GET /v1/labels Source: https://www.shipengine.com/docs/shipping/manifests/create-a-manifest The response contains a list of labels created within the specified time range. The example shows a truncated response with two labels. ```JSON { "labels": [ { "label_id": "se-29602037", "status": "completed", "shipment_id": "se-6470112", "ship_date": "2020-11-05T00:00:00Z", "created_at": "2020-11-05T14:26:59.91Z", "shipment_cost": { "currency": "usd", "amount": 3.18 }, "insurance_cost": { "currency": "usd", "amount": 0.0 }, "tracking_number": "9400111899223674205955", "is_return_label": false, "rma_number": null, "is_international": false, "batch_id": "", "carrier_id": "se-82785", "service_code": "usps_first_class_mail", "package_code": "package", "voided": false, "voided_at": null, "label_format": "pdf", "display_scheme": "label", "label_layout": "4x6", "trackable": true, "label_image_id": null, "carrier_code": "stamps_com", "tracking_status": "in_transit", "label_download": { "pdf": "https://api.shipengine.com/v1/downloads/0/VIYxvqt0CEaeE6kVeQq7DQ/label-1049004.pdf", "png": "https://api.shipengine.com/v1/downloads/0/VIYxvqt0CEaeE6kVeQq7DQ/label-1049004.png", "zpl": "https://api.shipengine.com/v1/downloads/0/VIYxvqt0CEaeE6kVeQq7DQ/label-1049004.zpl", "href": "https://api.shipengine.com/v1/downloads/0/VIYxvqt0CEaeE6kVeQq7DQ/label-1049004.pdf" }, "form_download": null, "insurance_claim": null, "packages": [ { "package_code": "package", "weight": { "value": 1.00, "unit": "ounce" }, "dimensions": { "unit": "inch", "length": 0.0, "width": 0.0, "height": 0.0 }, "insured_value": { "currency": "usd", "amount": 0.00 }, "tracking_number": "9400111899223674205955", "label_messages": { "reference1": null, "reference2": null, "reference3": null }, "external_package_id": null } ], "charge_event": "carrier_default" }, { "label_id": "se-29544722", "status": "completed", "shipment_id": "se-6470260", "ship_date": "2020-11-05T00:00:00Z", "created_at": "2020-11-05T16:53:41.127Z", "shipment_cost": { "currency": "usd", "amount": 3.18 }, "insurance_cost": { "currency": "usd", "amount": 0.0 }, "tracking_number": "9400111899223674665629", "is_return_label": false, "rma_number": null, "is_international": false, "batch_id": "", "carrier_id": "se-82785", "service_code": "usps_first_class_mail", "package_code": "package", "voided": false, "voided_at": null, "label_format": "pdf", "display_scheme": "label", "label_layout": "4x6", "trackable": true, "label_image_id": null, "carrier_code": "stamps_com", "tracking_status": "in_transit", "label_download": { "pdf": "https://api.shipengine.com/v1/downloads/0/KVAY5M7MG0GvNLCBFBbM9Q/label-1049067.pdf", "png": "https://api.shipengine.com/v1/downloads/0/KVAY5M7MG0GvNLCBFBbM9Q/label-1049067.png", "zpl": "https://api.shipengine.com/v1/downloads/0/KVAY5M7MG0GvNLCBFBbM9Q/label-1049067.zpl", "href": "https://api.shipengine.com/v1/downloads/0/KVAY5M7MG0GvNLCBFBbM9Q/label-1049067.pdf" }, "form_download": null, "insurance_claim": null, "packages": [ { "package_code": "package", "weight": { "value": 1.00, "unit": "ounce" }, "dimensions": { "unit": "inch", "length": 0.0, "width": 0.0, "height": 0.0 }, "insured_value": { "currency": "usd", "amount": 0.00 }, "tracking_number": "9400111899223674665629", "label_messages": { "reference1": null, "reference2": null, "reference3": null }, "external_package_id": null } ], "charge_event": "carrier_default" } ], "total": 2, "page": 1, "pages": 1, "links": { ``` -------------------------------- ### Install Elements SDK via NPM Source: https://www.shipengine.com/docs/elements/elements-sdk Install the Elements SDK using NPM. Ensure you also install the required peer dependencies. ```bash npm install @shipengine/elements-sdk ``` ```bash npm install react@17.x react-dom@17.x i18next@22.x react-i18next@11.x @emotion/react@11.x ``` -------------------------------- ### Install ShipEngine Elements Source: https://www.shipengine.com/docs/elements/elements-react Install the core ShipEngine Elements package using npm. ```bash npm install @shipengine/elements ``` -------------------------------- ### Example Response for Listing Labels Source: https://www.shipengine.com/docs/reference/list-labels This is an example of a successful response when querying for labels. It includes details about the label, shipment, costs, and tracking information. ```JSON { "labels": [ { "label_id": "se-421357", "status": "completed", "shipment_id": "se-2129025", "ship_date": "2019-07-25T05:00:00.000Z", "created_at": "2019-07-25T15:24:46.657Z", "shipment_cost": { "currency": "usd", "amount": 18.49 }, "insurance_cost": { "currency": "usd", "amount": 0.0 }, "rate_details": [ { "rate_detail_type": "shipping", "carrier_description": null, "carrier_billing_code": "Base Rate", "carrier_memo": null, "amount": { "currency": "usd", "amount": 18.49 }, "billing_source": "Carrier" } ], "tracking_number": "1Z28A1R91201009738", "is_return_label": false, "is_international": false, "batch_id": "", "carrier_id": "se-123890", "service_code": "ups_3_day_select", "package_code": "package", "voided": false, "voided_at": null, "label_format": "pdf", "label_layout": "4x6", "trackable": false, "carrier_code": "ups", "tracking_status": "unknown", "label_download": { "pdf": "https://api.shipengine.com/v1/downloads/1/s_Tqsu9euEKub6Acc_9UIg/testlabel-2128732.pdf", "png": "https://api.shipengine.com/v1/downloads/1/s_Tqsu9euEKub6Acc_9UIg/testlabel-2128732.png", "zpl": "https://api.shipengine.com/v1/downloads/1/s_Tqsu9euEKub6Acc_9UIg/testlabel-2128732.zpl", "href": "https://api.shipengine.com/v1/downloads/1/s_Tqsu9euEKub6Acc_9UIg/testlabel-2128732.pdf" }, "form_download": null, "insurance_claim": null } ], "total": 3820, "page": 1, "pages": 3820, "links": { "first": { "href": "https://api.shipengine.com/v1/labels?label_status=completed&page=1&page_size=1" }, "last": { "href": "https://api.shipengine.com/v1/labels?label_status=completed&page=3820&page_size=1" }, "prev": {}, "next": { "href": "https://api.shipengine.com/v1/labels?label_status=completed&page=2&page_size=1" } } } ``` -------------------------------- ### Account List Response Example Source: https://www.shipengine.com/docs/partners/accounts/list This is an example of the JSON response when listing accounts. It includes details such as account ID, creation date, and company information. ```json { "accounts": [ { "account_id": 123456, "external_account_id": "819748723192", "created_at": "2022-12-04T23:06:39.197Z", "modified_at": "2022-12-04T23:06:39.197Z", "active": true, "email": "819748723192@acme.corp", "company_name": "Acme Corp.", "first_name": "John", "last_name": "Doe", "origin_country_code": "US" } ] } ``` -------------------------------- ### Create Label Response Example Source: https://www.shipengine.com/docs/shipping/collect-on-delivery This is an example response when a label is successfully created. Note that the collect on delivery payment option is not explicitly shown in the response. ```JSON { "label_id": "se-6615", "status": "completed", "shipment_id": "se-1020115", "ship_date": "2019-09-26T00:00:00Z", "created_at": "2019-09-26T17:48:59.2732285Z", "shipment_cost": { "currency": "usd", "amount": 27.27 }, "insurance_cost": { "currency": "usd", "amount": 0.0 }, "tracking_number": "1Z14Y0487211178222", "is_return_label": false, "rma_number": null, "is_international": false, "batch_id": "", "carrier_id": "se-95", "service_code": "ups_ground", "package_code": "package", "voided": false, "voided_at": null, "label_format": "pdf", "label_layout": "4x6", "trackable": true, "carrier_code": "ups", "tracking_status": "in_transit", "label_download": { "pdf": "http://localhost:55163/v1/downloads/1/7OC4emEGkEmtutHwzbhvwg/label-6615.pdf", "png": "http://localhost:55163/v1/downloads/1/7OC4emEGkEmtutHwzbhvwg/label-6615.png", "zpl": "http://localhost:55163/v1/downloads/1/7OC4emEGkEmtutHwzbhvwg/label-6615.zpl", "href": "http://localhost:55163/v1/downloads/1/7OC4emEGkEmtutHwzbhvwg/label-6615.pdf" }, "form_download": null, "insurance_claim": null, "packages": [ { "package_code": "package", "weight": { "value": 2.00, "unit": "pound" }, "dimensions": { "unit": "inch", "length": 2.00, "width": 14.00, "height": 17.00 }, "insured_value": { "currency": "usd", "amount": 0.00 }, "tracking_number": "1Z14Y0487211178222", "label_messages": { "reference1": null, "reference2": null, "reference3": null }, "external_package_id": null } ] } ``` -------------------------------- ### Get Custom Package Request Source: https://www.shipengine.com/docs/reference/get-package-by-id Use the GET method with the /v1/packages endpoint and the package_id to retrieve package details. This example shows the HTTP request line. ```http GET /v1/packages/se-100896 HTTP/1.1 ``` -------------------------------- ### Initialize Manage Funding Element with SDK Source: https://www.shipengine.com/docs/elements/account-settings/manage-funding Shows how to create an instance of the Elements SDK and then create the Manage Funding Element. This requires a getToken function and optionally accepts theme configuration and locale settings. ```javascript // Creates a new instance of the Elements SDK. const elements = new ElementsSDK(getToken, { onError: (err: Error) => console.error(err), themeConfig: themeConfig, locale: 'en-US', }); const manageFunding = elements.create('manageFunding'); ``` -------------------------------- ### Initialize Elements SDK and Create Onboarding Element Source: https://www.shipengine.com/docs/elements/onboarding Initializes the Elements SDK with authentication and theme configuration, then creates an instance of the Onboarding Element. The Onboarding Element is configured with callbacks for completion and a default ship-from address. ```typescript // Creates a new instance of the Elements SDK. const elements = new ElementsSDK(getToken, { onError: (err: Error) => console.error(err), themeConfig: themeConfig, locale: 'en-US', features: { globalFeatures: { enabledShipEngineCarriers: ['stamps_com', 'globalPost'], }, }, }); const onboarding = elements.create('onboarding', { onComplete: () => console.log('complete'), defaultShipFromAddress: defaultShipFromAddress, }); ``` -------------------------------- ### Example Response for Get Carrier by ID Source: https://www.shipengine.com/docs/reference/get-carrier-by-id This is an example response when successfully retrieving carrier information. It includes details like carrier code, services, and package types. ```JSON { "carrier_id": "se-123890", "carrier_code": "stamps_com", "account_number": null, "requires_funded_amount": true, "balance": 0.0, "nickname": "Free", "friendly_name": "Stamps.com", "primary": true, "services": [ { "carrier_id": "se-123890", "carrier_code": "stamps_com", "service_code": "usps_first_class_mail", "name": "USPS First Class Mail", "domestic": true, "international": false }, { "carrier_id": "se-123890", "carrier_code": "stamps_com", "service_code": "usps_media_mail", "name": "USPS Media Mail", "domestic": true, "international": false }, { "carrier_id": "se-123890", "carrier_code": "stamps_com", "service_code": "usps_parcel_select", "name": "USPS Parcel Select Ground", "domestic": true, "international": false }, { "carrier_id": "se-123890", "carrier_code": "stamps_com", "service_code": "usps_priority_mail", "name": "USPS Priority Mail", "domestic": true, "international": false }, { "carrier_id": "se-123890", "carrier_code": "stamps_com", "service_code": "usps_priority_mail_express", "name": "USPS Priority Mail Express", "domestic": true, "international": false }, { "carrier_id": "se-123890", "carrier_code": "stamps_com", "service_code": "usps_first_class_mail_international", "name": "USPS First Class Mail Intl", "domestic": false, "international": true }, { "carrier_id": "se-123890", "carrier_code": "stamps_com", "service_code": "usps_priority_mail_international", "name": "USPS Priority Mail Intl", "domestic": false, "international": true }, { "carrier_id": "se-123890", "carrier_code": "stamps_com", "service_code": "usps_priority_mail_express_international", "name": "USPS Priority Mail Express Intl", "domestic": false, "international": true } ], "packages": [ { "package_id": null, "package_code": "flat_rate_envelope", "name": "Flat Rate Envelope", "description": "USPS flat rate envelope. A special cardboard envelope provided by the USPS that clearly indicates \"Flat Rate\"" }, { "package_id": null, "package_code": "flat_rate_legal_envelope", "name": "Flat Rate Legal Envelope", "description": "Flat Rate Legal Envelope" }, { "package_id": null, "package_code": "flat_rate_padded_envelope", "name": "Flat Rate Padded Envelope", "description": "Flat Rate Padded Envelope" }, { "package_id": null, "package_code": "large_envelope_or_flat", "name": "Large Envelope or Flat", "description": "Large envelope or flat. Has one dimension that is between 11 1/2 and 15 long, 6 1/18 and 12 high, or 1/4 and 3/4 thick." }, { "package_id": null, "package_code": "large_flat_rate_box", "name": "Large Flat Rate Box", "description": "Large Flat Rate Box" }, { "package_id": null, "package_code": "large_package", "name": "Large Package (any side > 12)", "description": "Large package. Longest side plus the distance around the thickest part is over 84 and less than or equal to 108." }, { "package_id": null, "package_code": "letter", "name": "Letter", "description": "Letter" }, { "package_id": null, "package_code": "medium_flat_rate_box", "name": "Medium Flat Rate Box", "description": "USPS flat rate box. A special 11 x 8 1/2 x 5 1/2 or 14 x 3.5 x 12 USPS box that clearly indicates \"Flat Rate Box\"" }, { "package_id": null, "package_code": "package", "name": "Package", "description": "Package. Longest side plus the distance around the thickest part is less than or equal to 84" }, { "package_id": null, "package_code": "regional_rate_box_a", "name": "Regional Rate Box A", "description": "Regional Rate Box A" }, { "package_id": null, "package_code": "regional_rate_box_b", "name": "Regional Rate Box B", "description": "Regional Rate Box B" }, { "package_id": null, "package_code": "small_flat_rate_box", "name": "Small Flat Rate Box" } ], "options": { "saturday_delivery": false, "delivery_confirmation": "none" }, "connection_status": "approved" } ``` -------------------------------- ### Create a Theme Source: https://www.shipengine.com/docs/partners/customize-theme Use the `themes` endpoint to create a new theme for customizing the onboarding experience. You can create a maximum of 10 themes per partner. The request body includes details for branding, logo, and onboarding messages. ```APIDOC ## POST /v1/partners/themes ### Description Creates a new theme to customize the onboarding experience for your customers. Allows for customization of brand name, logo, and onboarding messages. ### Method POST ### Endpoint /v1/partners/themes ### Request Body - **name** (string) - Required - The name of the theme. - **brand** (string) - Required - The brand name to display. - **return_url** (string) - Required - The URL to redirect to after completion. - **logo** (object) - Required - Contains logo details. - **content_type** (string) - Required - The content type of the logo image (e.g., "image/png"). - **image_data** (string) - Required - Base64 encoded image data. - **onboarding** (object) - Optional - Customization for the onboarding flow. - **start_title** (string) - Optional - Title for the start screen. - **start_text** (string) - Optional - Text for the start screen. - **complete_title** (string) - Optional - Title for the completed screen. - **complete_text** (string) - Optional - Text for the completed screen. - **skip_shipstation_api_carriers** (boolean) - Optional - Whether to skip ShipStation API carriers. ### Request Example ```json { "name": "My theme", "brand": "Auctane brand", "return_url": "https://mydomain.com", "logo": { "content_type": "image/png", "image_data": "iVBORw0KGgoAAAANSUhEUg..." }, "onboarding": { "start_title": "Start shippping today!", "start_text": "Simply follow the steps to configure your carriers.", "complete_title": "You are done!", "complete_text": "Click continue to start shipping.", "skip_shipstation_api_carriers": false } } ``` ### Response #### Success Response (200) - **theme_id** (string) - The unique identifier for the created theme. - **name** (string) - The name of the theme. - **brand** (string) - The brand name. - **return_url** (string) - The return URL. - **logo** (object) - Logo details. - **content_type** (string) - The content type of the logo image. - **image_data** (string) - Base64 encoded image data. - **onboarding** (object) - Onboarding customization details. - **start_title** (string) - Title for the start screen. - **start_text** (string) - Text for the start screen. - **complete_title** (string) - Title for the completed screen. - **complete_text** (string) - Text for the completed screen. - **skip_shipstation_api_carriers** (boolean) - Whether to skip ShipStation API carriers. - **created_at** (string) - Timestamp when the theme was created. - **modified_at** (string) - Timestamp when the theme was last modified. #### Response Example ```json { "theme_id": "550e8400-e29b-41d4-a716-446655440000", "name": "My theme", "brand": "Auctane brand", "return_url": "https://mydomain.com", "logo": { "content_type": "image/png", "image_data": "iVBORw0KGgoAAAANSUhEUg..." }, "onboarding": { "start_title": "Start shippping today!", "start_text": "Simply follow the steps to configure your carriers.", "complete_title": "You are done!", "complete_text": "Click continue to start shipping.", "skip_shipstation_api_carriers": false }, "created_at": "2024-01-25T03:06:20.933Z", "modified_at": "2024-01-25T03:06:20.933Z" } ``` ``` -------------------------------- ### Example Tracking API Request Source: https://www.shipengine.com/docs/tracking This snippet shows an example HTTP GET request to the ShipEngine Tracking API. It includes the carrier code and tracking number as query parameters. ```HTTP GET /v1/tracking?carrier_code=stamps_com&tracking_number=9405511899223197428490 HTTP/1.1 ``` -------------------------------- ### Basic Onboarding Element Configuration in React Source: https://www.shipengine.com/docs/elements/onboarding This snippet shows how to configure and use the Onboarding Element within a React application. It includes setting up the ElementsProvider with a token retrieval function, theme configuration, error handling, and enabling specific ShipEngine carriers. ```jsx import { Onboarding, ElementsProvider } from '@shipengine/elements'; import { themeConfig } from '../themeConfig'; import { defaultShipFromAddress } from '../address'; const tokenPath = '/path/to/token/endpoint'; const Foo = () => { const getToken = useCallback(() => { return fetch(tokenPath).then((res) => res.text()); }, []); return ( console.log('complete')} defaultShipFromAddress={defaultShipFromAddress} /> ); }; ``` -------------------------------- ### Initialize PaymentMethodSettings with Elements SDK (Node.js) Source: https://www.shipengine.com/docs/elements/account-settings/payment-method Shows how to create an instance of the PaymentMethodSettings element using the ShipEngine Elements SDK. This requires initializing the SDK with a getToken function and optional configuration like onError, themeConfig, and locale. ```javascript // Creates a new instance of the Elements SDK. const elements = new ElementsSDK(getToken, { onError: (err: Error) => console.error(err), themeConfig: themeConfig, locale: 'en-US', }); const paymentMethodSettings = elements.create('paymentMethodSettings'); ``` -------------------------------- ### Example GET Request for Carrier Features Source: https://www.shipengine.com/docs/ltl/list-carrier-features This snippet shows the HTTP GET request format to retrieve features for a specific LTL carrier. Replace 'FXFE' with the desired carrier code. ```HTTP GET /v-beta/ltl/carriers/FXFE/features HTTP/1.1 ``` -------------------------------- ### Request Paginated Shipments Source: https://www.shipengine.com/docs/pagination Example of a GET request to the shipments endpoint with pagination parameters for page size, sort direction, and sort by field. ```http GET /v1/shipments?page_size=25&sort_dir=desc&sort_by=created_at HTTP/1.1 Host: api.shipengine.com API-Key: __YOUR_API_KEY_HERE__ ``` -------------------------------- ### Quick Rates Request Example Source: https://www.shipengine.com/docs/rates/advanced-features This example demonstrates the structure of a POST request to the /v1/rates/ endpoint using the 'quick' rate_type. It includes shipment details and carrier IDs. ```json POST /v1/rates/ HTTP/1.1 { "rate_options": { "rate_type": "quick", "carrier_ids": [ "se-12345" ] }, "shipment": { "ship_to": { "name": "The President", "phone": "222-333-4444", "company_name": "", "address_line1": "1600 Pennsylvania Avenue NW", "city_locality": "Washington", "state_province": "DC", "postal_code": "20500", "country_code": "US", "address_residential_indicator": "no" }, "ship_from": { "name": "ShipStation API Team", "phone": "222-333-4444", "company_name": "ShipStation API", "address_line1": "4301 Bull Creek Road", "city_locality": "Austin", "state_province": "TX", "postal_code": "78731", "country_code": "US", "address_residential_indicator": "no" }, "packages": [ { "package_code": "package", "weight": { "value": 6, "unit": "ounce" } } ] } } ``` -------------------------------- ### Initialize Unit Settings SDK Source: https://www.shipengine.com/docs/elements/account-settings/unit-settings This code snippet shows how to create an instance of the Elements SDK and then create a unitSettings instance from it. It configures error handling, theme, and locale during SDK initialization. ```javascript // Creates a new instance of the Elements SDK. const elements = new ElementsSDK(getToken, { onError: (err: Error) => console.error(err), themeConfig: themeConfig, locale: 'en-US', }); const unitSettings = elements.create('unitSettings'); ``` -------------------------------- ### Get Service Point by ID Request Example Source: https://www.shipengine.com/docs/pick-up-drop-off/find-service-points This example shows the HTTP request line for retrieving a specific service point by its carrier code, country code, and service point ID. This is useful when you already know the identifier of the service point you need. ```http GET /v1/service_points/{chronopost}/{FR}/{614940} HTTP/1.1 ``` -------------------------------- ### GET /v1/shipments Source: https://www.shipengine.com/docs/reference/list-shipments Retrieves a list of shipments. This example demonstrates fetching the last package sent using the `east_warehouse` tag, with pagination and sorting applied. ```APIDOC ## GET /v1/shipments ### Description Retrieves a list of shipments. Supports filtering by tags, pagination, and sorting. ### Method GET ### Endpoint /v1/shipments ### Parameters #### Query Parameters - **tag** (string) - Optional - Filter shipments by a specific tag. - **page** (integer) - Optional - The page number to retrieve. - **page_size** (integer) - Optional - The number of shipments to return per page. - **sort_dir** (string) - Optional - The direction to sort the results (`asc` or `desc`). Defaults to `asc`. - **sort_by** (string) - Optional - The field to sort the results by (e.g., `created_at`). ### Request Example ```http GET /v1/shipments?tag=east_warehouse&page=1&page_size=1&sort_dir=desc&sort_by=created_at HTTP/1.1 ``` ### Response #### Success Response (200) - **shipments** (array) - An array of shipment objects. - **shipment_id** (string) - The unique identifier for the shipment. - **carrier_id** (string) - The identifier for the carrier. - **external_shipment_id** (string) - An external identifier for the shipment. - **ship_date** (string) - The date the shipment was sent. - **created_at** (string) - The timestamp when the shipment was created. - **modified_at** (string) - The timestamp when the shipment was last modified. - **shipment_status** (string) - The current status of the shipment. - **ship_to** (object) - Information about the recipient. - **ship_from** (object) - Information about the sender. - **return_to** (object) - Information about the return address. - **confirmation** (string) - The confirmation type for the shipment. - **advanced_options** (object) - Advanced options for the shipment. - **insurance_provider** (string) - The insurance provider for the shipment. - **tags** (array) - An array of tags associated with the shipment. - **total_weight** (object) - The total weight of the shipment. - **packages** (array) - An array of package details within the shipment. - **total** (integer) - The total number of shipments available. - **page** (integer) - The current page number. - **pages** (integer) - The total number of pages available. - **links** (object) - Links for pagination (first, last, prev, next). #### Response Example ```json { "shipments": [ { "shipment_id": "se-2102034", "carrier_id": "", "external_shipment_id": "1daa0c22-0519-46d0-8653-9f3dc62e7d2c", "ship_date": "2019-07-25T05:00:00.000Z", "created_at": "2019-07-25T15:24:46.657Z", "modified_at": "2019-07-25T15:24:46.657Z", "shipment_status": "pending", "ship_to": { "name": "Amanda Miller", "phone": "555-555-5555", "email": "recipient@example.com", "address_line1": "525 S Winchester Blvd", "city_locality": "San Jose", "state_province": "CA", "postal_code": "95128", "country_code": "US", "address_residential_indicator": "yes" }, "ship_from": { "company_name": "Example Corp.", "name": "John Doe", "phone": "111-111-1111", "email": "sender@example.com", "address_line1": "4009 Marathon Blvd", "address_line2": "Suite 300", "city_locality": "Austin", "state_province": "TX", "postal_code": "78756", "country_code": "US", "address_residential_indicator": "no" }, "return_to": { "company_name": "Example Corp.", "name": "John Doe", "phone": "111-111-1111", "address_line1": "4009 Marathon Blvd", "address_line2": "Suite 300", "city_locality": "Austin", "state_province": "TX", "postal_code": "78756", "country_code": "US", "address_residential_indicator": "no" }, "confirmation": "none", "advanced_options": { "bill_to_account": null, "bill_to_country_code": null, "bill_to_party": null, "bill_to_postal_code": null, "contains_alcohol": false, "custom_field1": null, "custom_field2": null, "custom_field3": null, "non_machinable": false, "saturday_delivery": false }, "insurance_provider": "", "tags": [ { "name": "east_warehouse" } ], "total_weight": { "value": 9.60, "units": "ounce" }, "packages": [ { "weight": { "value": 9.60, "units": "ounce" }, "dimensions": { "units": "inch", "length": 12.00, "width": 7.10, "height": 6.00 }, "insured_value": { "currency": "usd", "amount": 0.0 } } ] } ], "total": 1, "page": 1, "pages": 2, "links": { "first": { "href": "https://api.shipengine.com/v1/shipments?tag=east_warehouse&shipment_status=any&sort_dir=desc&sort_by=created_at&page=1&page_size=1" }, "last": { "href": "https://api.shipengine.com/v1/shipments?tag=east_warehouse&shipment_status=any&sort_dir=desc&sort_by=created_at&page=2&page_size=1" }, "prev": {}, "next": { "href": "https://api.shipengine.com/v1/shipments?tag=east_warehouse&shipment_status=any&sort_dir=desc&sort_by=created_at&page=2&page_size=1" } } } ``` ``` -------------------------------- ### Initialize Elements SDK and Create Connect External Carrier Instance Source: https://www.shipengine.com/docs/elements/connect-external-carrier This snippet shows how to initialize the Elements SDK with a token and theme configuration, and then create an instance of the 'connectExternalCarrier' component. It demonstrates enabling specific ShipEngine carriers and a list of external carriers, and setting up a callback for when a carrier is successfully connected. ```javascript const elements = new ElementsSDK(getToken, { onError: (err: Error) => console.error(err), themeConfig: themeConfig, locale: 'en-US', features: { enabledShipEngineCarriers: ['stamps_com', 'dhl_express_worldwide'], // The list of external carriers that are available to be activated enabledExternalCarriers: [ 'apc', 'asendia', 'better_trucks', 'courierpost', 'dpd', 'seko', 'ups', 'yodel', ], }, }); const connectExternalCarrier = elements.create('connectExternalCarrier', { carrierName: 'ups', onCarrierConnected: () => console.log('carrier successfully connected'), }); ```