### Example GET Request with Query Parameters Source: https://docs.shipstation.com/apis/shipengine/docs/getting-started/rest.md Demonstrates a GET request to retrieve labels, utilizing query parameters to filter by creation date. Includes Host, API-Key, and Content-Type headers. ```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 Host: https://api-stage.shipengine.com API-Key: __YOUR_API_KEY_HERE__ Content-Type: application/json ``` -------------------------------- ### Example Request with Date Range Query Parameters Source: https://docs.shipstation.com/rest.md This example demonstrates a GET request to retrieve labels within a specific date range using `created_at_start` and `created_at_end` query parameters. ```http GET /v2/labels?created_at_start=2020-11-09T00:37:54.14212Z&created_at_end=2020-11-09T22:37:54.14212Z HTTP/1.1 Host: https://api-stage.shipstation.com API-Key: __YOUR_API_KEY_HERE__ Content-Type: application/json ``` -------------------------------- ### List Batches Request Example Source: https://docs.shipstation.com/apis/shipengine/docs/reference/list-batches.md Demonstrates how to make a GET request to the /v1/batches endpoint to retrieve batches with a specific status. Ensure you replace '__YOUR_API_KEY_HERE__' with your actual API key. ```http GET /v1/batches?status=open HTTP/1.1 Host: api.shipengine.com API-Key: __YOUR_API_KEY_HERE__ ``` -------------------------------- ### Install @shipengine/elements Source: https://docs.shipstation.com/apis/shipengine/docs/elements/elements-react.md Install the ShipEngine Elements package using npm. ```bash npm install @shipengine/elements ``` -------------------------------- ### Example Response for GET /v2/labels Source: https://docs.shipstation.com/creating-manifests.md This is an example response for the GET /v2/labels endpoint, showing two labels created within the specified time range. The response includes details for each label, such as ID, status, creation timestamp, and tracking information. ```json { "labels": [ { "label_id": "se-29602037", "status": "completed", "shipment_id": "se-6470112", "ship_date": "2023-11-05T00:00:00Z", "created_at": "2023-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.shipstation.com/v2/downloads/0/VIYxvqt0CEaeE6kVeQq7DQ/label-1049004.pdf", "png": "https://api.shipstation.com/v2/downloads/0/VIYxvqt0CEaeE6kVeQq7DQ/label-1049004.png", "zpl": "https://api.shipstation.com/v2/downloads/0/VIYxvqt0CEaeE6kVeQq7DQ/label-1049004.zpl", "href": "https://api.shipstation.com/v2/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": "2023-11-05T00:00:00Z", "created_at": "2023-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.shipstation.com/v2/downloads/0/KVAY5M7MG0GvNLCBFBbM9Q/label-1049067.pdf", "png": "https://api.shipstation.com/v2/downloads/0/KVAY5M7MG0GvNLCBFBbM9Q/label-1049067.png", "zpl": "https://api.shipstation.com/v2/downloads/0/KVAY5M7MG0GvNLCBFBbM9Q/label-1049067.zpl", "href": "https://api.shipstation.com/v2/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": { "first": { ``` -------------------------------- ### Initialize Elements SDK for Payment Method Settings Source: https://docs.shipstation.com/apis/shipengine/docs/elements/account-settings/payment-method Shows how to create an instance of the Elements SDK and then create the paymentMethodSettings element. Requires a getToken function and optional configuration for error handling, theming, and locale. ```js // 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'); ``` -------------------------------- ### Get Labels with Query Parameters Example Source: https://docs.shipstation.com/apis/shipengine/docs/getting-started/rest.md Demonstrates how to retrieve labels using GET request and filtering with URL query parameters. ```APIDOC ## GET /v1/labels ### Description Retrieves a list of shipping labels, optionally filtered by query parameters. ### Method GET ### Endpoint https://api.shipengine.com/v1/labels ### Query Parameters - **carrier_id** (string) - Optional - Filters labels by a specific carrier ID. - **warehouse_id** (string) - Optional - Filters labels by a specific warehouse ID. - **created_at_start** (string) - Optional - Filters labels created after this date/time (ISO 8601 format). - **created_at_end** (string) - Optional - Filters labels created before this date/time (ISO 8601 format). ### Request Example ```http GET /v1/labels?carrier_id=se-28529731&created_at_start=2020-11-09T00:37:54.14212Z HTTP/1.1 Host: https://api.shipengine.com API-Key: __YOUR_API_KEY_HERE__ Content-Type: application/json ``` ### Response #### Success Response (200) - **labels** (array) - An array of label objects. - **label_id** (string) - The unique identifier for the label. - **tracking_number** (string) - The tracking number for the shipment. - **created_at** (string) - The timestamp when the label was created. #### Response Example ```json { "labels": [ { "label_id": "se-111111111", "tracking_number": "1ZABCDEFGHIJKLMN", "created_at": "2020-11-09T10:00:00.000Z" }, { "label_id": "se-222222222", "tracking_number": "1ZOPQRSTUVWXYZ123", "created_at": "2020-11-09T11:00:00.000Z" } ] } ``` ``` -------------------------------- ### Initialize Account Settings with SDK Source: https://docs.shipstation.com/apis/shipengine/docs/elements/account-settings/account-settings This JavaScript snippet demonstrates how to create an instance of the Elements SDK and then instantiate the Account Settings element. It requires a getToken function and allows for feature configuration. ```js // 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: { // The list of all ShipEngine carriers available to be activated 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', ], }, accountSettingsFeatures: { showLabelLayout: false, }, }, }); const accountSettings = elements.create('accountSettings'); ``` -------------------------------- ### Download Manifest PDF using HTTP GET Source: https://docs.shipstation.com/apis/shipengine/docs/shipping/manifests/create-a-manifest.md This example demonstrates how to programmatically download a manifest PDF using an HTTP GET request. Ensure the `Accept-Type` header is set to `application/pdf`. ```http GET https://api.shipengine.com/v1/downloads/0/BpP_fo0d9EiiQJ7hqDQGmA/manifest-11112.pdf HTTP/1.1 Host: api.shipengine.com API-Key: __YOUR_API_KEY_HERE__ Accept-Type: application/pdf ``` -------------------------------- ### Download a Manifest Source: https://docs.shipstation.com/apis/shipengine/docs/shipping/manifests/create-a-manifest.md This example demonstrates how to download a manifest PDF using the provided URL. Ensure the `Accept-Type` header is set to `application/pdf`. ```APIDOC ## Download the Manifest This example downloads the manifest using the URL returned in the response above. Notice that you must change the `Content-Type` to `Accept-type: application/pdf`. ### Example Request ```http GET https://api.shipengine.com/v1/downloads/0/BpP_fo0d9EiiQJ7hqDQGmA/manifest-11102.pdf HTTP/1.1 Host: api.shipengine.com API-Key: __YOUR_API_KEY_HERE__ Accept-Type: application/pdf ``` ``` -------------------------------- ### Initialize Unit Settings with Elements SDK Source: https://docs.shipstation.com/apis/shipengine/docs/elements/account-settings/unit-settings This snippet demonstrates how to create a new instance of the Elements SDK and then create a 'unitSettings' component. It requires a getToken function and an optional configuration object for error handling, theme, and locale. ```js // 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 Shipment by ID Response Source: https://docs.shipstation.com/list-shipments.md This is an example of the JSON response you will receive when successfully retrieving a shipment by its `shipment_id`. It contains all details about the shipment. ```json { "shipment_id": "se-202902255", "carrier_id": "se-123890", "service_code": "usps_priority_mail", "external_shipment_id": "0bcb569d-1727-4ff9-ab49-b2fec0cee5ae", "ship_date": "2024-02-12T00:00:00Z", "created_at": "2024-02-13T00:53:52.027Z", "modified_at": "2024-02-13T00:53:52.027Z", "shipment_status": "pending", "ship_to": { "name": "Amanda Miller", "phone": "555-555-5555", "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", "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" }, "warehouse_id": null, "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" }, "insurance_provider": "none", "tags": [], "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 }, "label_messages": { "reference1": null, "reference2": null, "reference3": null } } ], "total_weight": { "value": 1.00, "unit": "ounce" } } ``` -------------------------------- ### Response with Multiple Manifests Example Source: https://docs.shipstation.com/apis/shipengine/docs/shipping/manifests/create-a-manifest.md This JSON response shows an example where multiple manifests are generated. Each manifest object includes a download URL and the specific label IDs it contains. A top-level href is also provided for the first manifest. ```json { "manifests": [ { "manifest_id": "se-11116", "form_id": "se-11116", "created_at": "2020-11-09T18:16:09.793Z", "ship_date": "2020-11-09T00:00:00Z", "shipments": 1, "label_ids": [ "se-1050621" ], "warehouse_id": null, "submission_id": "9475711201080306528571", "carrier_id": "se-82785", "manifest_download": { "href": "https://api-stage.shipengine.com/v1/downloads/0/mQ3QZQL6-0SLESTz43Y8vw/manifest-11116.pdf" } }, { "manifest_id": "se-11117", "form_id": "se-11117", "created_at": "2020-11-09T18:16:11.233Z", "ship_date": "2020-11-09T00:00:00Z", "shipments": 1, "label_ids": [ "se-1050622" ], "warehouse_id": null, "submission_id": "1120014041604945770433", "carrier_id": "se-88270", "manifest_download": { "href": "https://api-stage.shipengine.com/v1/downloads/0/5GOUrT4TRkWgygJyvJt0kA/manifest-11117.pdf" } } ], "manifest_requests": [ { "manifest_request_id": "se-28529731", "status": "in_progress" } ], "manifest_id": "se-11116", "form_id": "se-11116", "created_at": "2020-11-09T18:16:09.793Z", "ship_date": "2020-11-09T00:00:00Z", "shipments": 1, "warehouse_id": null, "submission_id": "9475711201080306528571", "carrier_id": "se-82785", "manifest_download": { "href": "https://api-stage.shipengine.com/v1/downloads/0/mQ3QZQL6-0SLESTz43Y8vw/manifest-11116.pdf" }, "label_ids": [ "se-1050621", "se-1050622" ], "request_id": "9367f24f-9aa6-4358-8dd7-a73bb38e8870", "errors": [] } ``` -------------------------------- ### Get Shipping Rates Source: https://docs.shipstation.com/apis/shipengine/docs/rates/advanced-features.md This example demonstrates how to request shipping rates for a shipment. It includes the necessary shipment details and rate options. ```APIDOC ## POST /v1/rates ### Description Requests shipping rates for a given shipment based on specified criteria. ### Method POST ### Endpoint /v1/rates ### Parameters #### Request Body - **shipment** (object) - Required - Details of the shipment, including origin, destination, and package information. - **comparison_rate_type** (string) - Optional - The type of rate to compare (e.g., "retail"). - **ship_to** (object) - Required - Information about the recipient. - **name** (string) - Required - Recipient's name. - **phone** (string) - Required - Recipient's phone number. - **company_name** (string) - Optional - Recipient's company name. - **address_line1** (string) - Required - First line of the recipient's address. - **city_locality** (string) - Required - Recipient's city. - **state_province** (string) - Required - Recipient's state or province. - **postal_code** (string) - Required - Recipient's postal code. - **country_code** (string) - Required - Recipient's country code (e.g., "US"). - **address_residential_indicator** (string) - Required - Indicates if the address is residential ('yes' or 'no'). - **ship_from** (object) - Required - Information about the sender. - **name** (string) - Required - Sender's name. - **phone** (string) - Required - Sender's phone number. - **company_name** (string) - Optional - Sender's company name. - **address_line1** (string) - Required - First line of the sender's address. - **city_locality** (string) - Required - Sender's city. - **state_province** (string) - Required - Sender's state or province. - **postal_code** (string) - Required - Sender's postal code. - **country_code** (string) - Required - Sender's country code (e.g., "US"). - **address_residential_indicator** (string) - Required - Indicates if the address is residential ('yes' or 'no'). - **packages** (array) - Required - An array of package objects. - **package_code** (string) - Required - The code for the package type. - **weight** (object) - Required - The weight of the package. - **value** (number) - Required - The weight value. - **unit** (string) - Required - The unit of weight (e.g., "ounce"). - **rate_options** (object) - Optional - Options for rate calculation. - **carrier_ids** (array) - Optional - An array of carrier IDs to filter rates by. ### Request Example ```json { "shipment": { "comparison_rate_type": "retail", "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" } } ] }, "rate_options": { "carrier_ids": [ "se-12345" ] } } ``` ### Response #### Success Response (200) - **rate_response** (object) - Contains the calculated rates and related information. - **rates** (array) - A list of available shipping rates. - **rate_id** (string) - Unique identifier for the rate. - **rate_type** (string) - Type of rate (e.g., "shipment"). - **carrier_id** (string) - ID of the carrier providing the rate. - **shipping_amount** (object) - The cost of shipping. - **currency** (string) - Currency code (e.g., "usd"). - **amount** (number) - The shipping cost. - **insurance_amount** (object) - Cost of insurance. - **confirmation_amount** (object) - Cost of confirmation. - **other_amount** (object) - Cost of other services. - **requested_comparison_amount** (object) - The comparison amount requested. - **rate_details** (array) - Details about the rate. - **zone** (number) - The shipping zone. - **package_type** (string) - The type of package. - **delivery_days** (number) - Estimated delivery days. - **guaranteed_service** (boolean) - Indicates if the service is guaranteed. - **estimated_delivery_date** (string) - The estimated delivery date. - **carrier_delivery_days** (string) - Carrier's estimated delivery days. - **ship_date** (string) - The ship date. - **negotiated_rate** (boolean) - Indicates if it's a negotiated rate. - **service_type** (string) - The type of service (e.g., "USPS Priority Mail"). - **service_code** (string) - The code for the service. - **trackable** (boolean) - Indicates if the shipment is trackable. - **carrier_code** (string) - The carrier's code. - **carrier_nickname** (string) - The carrier's nickname. - **carrier_friendly_name** (string) - A user-friendly name for the carrier. - **validation_status** (string) - The validation status of the rate. - **warning_messages** (array) - Any warning messages. - **error_messages** (array) - Any error messages. - **invalid_rates** (array) - A list of invalid rates. - **rate_request_id** (string) - The ID of the rate request. - **shipment_id** (string) - The ID of the shipment. - **created_at** (string) - Timestamp of when the rate was created. - **status** (string) - The status of the rate request. - **errors** (array) - Any errors encountered during the rate request. #### Response Example ```json { "rate_response": { "rates": [ { "rate_id": "se-6384266", "rate_type": "shipment", "carrier_id": "se-204152", "shipping_amount": { "currency": "usd", "amount": 6.7300 }, "insurance_amount": { "currency": "usd", "amount": 0.0 }, "confirmation_amount": { "currency": "usd", "amount": 0.0 }, "other_amount": { "currency": "usd", "amount": 0.0 }, "requested_comparison_amount": { "currency": "usd", "amount": 9.3500 }, "rate_details": [], "zone": 1, "package_type": "package", "delivery_days": 1, "guaranteed_service": false, "estimated_delivery_date": "2023-11-02T00:00:00Z", "carrier_delivery_days": "1", "ship_date": "2023-11-01T00:00:00Z", "negotiated_rate": false, "service_type": "USPS Priority Mail", "service_code": "usps_priority_mail", "trackable": true, "carrier_code": "usps", "carrier_nickname": "My Stamps account", "carrier_friendly_name": "USPS", "validation_status": "valid", "warning_messages": [], "error_messages": [] } ], "invalid_rates": [], "rate_request_id": "se-12345", "shipment_id": "se-12345", "created_at": "2023-11-01T15:53:03.8069761Z", "status": "completed", "errors": [] }, "shipment_id": "se-12345", "carrier_id": null, "service_code": null, "external_shipment_id": null, "shipment_number": null, "ship_date": "2023-11-01T00:00:00Z", "created_at": "2023-11-01T15:52:52.833Z", "modified_at": "2023-11-01T15:52:52.773Z", "shipment_status": "pending", "ship_to": { "instructions": null, "name": "Bruce Wayne", "phone": "222-333-4444", "email": null, "company_name": "Wayne Enterprises", "address_line1": "1990 E. Grand Ave", "address_line2": null, "address_line3": null, "city_locality": "El Segundo", "state_province": "CA", "postal_code": "90245", "country_code": "US", "address_residential_indicator": "no" }, "ship_from": { "instructions": null, "name": "Bruce Wayne", "phone": "222-333-4444", "email": null, "company_name": "Wayne Enterprises", "address_line1": "1990 E. Grand Ave", "address_line2": null, "address_line3": null, "city_locality": "El Segundo", "state_province": "CA", "postal_code": "90245", "country_code": "US", "address_residential_indicator": "no" }, "warehouse_id": null, "return_to": { "instructions": null, "name": "Bruce Wayne", "phone": "222-333-4444", "email": null, "company_name": "Wayne Enterprises", "address_line1": "1990 E. Grand Ave", "address_line2": null, "address_line3": null, "city_locality": "El Segundo", "state_province": "CA", } } ``` ``` -------------------------------- ### Example Manifest Response Source: https://docs.shipstation.com/apis/shipengine/docs/shipping/manifests/explicit-vs-implicit.md This is an example of a successful response when creating a manifest. It includes details about the manifest, associated labels, and download links. ```json { "manifests": [ { "manifest_id": "se-11119", "form_id": "se-11119", "created_at": "2020-11-09T19:59:22.837Z", "ship_date": "2020-11-09T00:00:00Z", "shipments": 3, "label_ids": [ "se-1050678", "se-1050679", "se-1050680" ], "warehouse_id": "se-107273", "submission_id": "9475711201080306735429", "carrier_id": "se-82785", "manifest_download": { "href": "https://api-stage.shipengine.com/v1/downloads/0/WPZ_DNt2dUKPX4L9pOh71g/manifest-11119.pdf" } } ], "request_id": "ed87e59c-bd95-468b-a4fb-5b55e8630df9", "errors": [], "manifest_id": "se-11119", "form_id": "se-11119", "created_at": "2020-11-09T19:59:22.837Z", "ship_date": "2020-11-09T00:00:00Z", "shipments": 3, "label_ids": [ "se-1050678", "se-1050679", "se-1050680" ], "warehouse_id": "se-107273", "submission_id": "9475711201080306735429", "carrier_id": "se-82785", "manifest_download": { "href": "https://api-stage.shipengine.com/v1/downloads/0/WPZ_DNt2dUKPX4L9pOh71g/manifest-11119.pdf" } } ``` -------------------------------- ### Example Label Response Source: https://docs.shipstation.com/apis/shipengine/docs/shipping/manifests/create-a-manifest.md This is an example JSON response for the GET /v1/labels endpoint, showing two completed labels created within the specified time range. The response includes details such as label ID, status, shipment information, and tracking details. ```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 } ``` -------------------------------- ### List All Suppliers Source: https://docs.shipstation.com/suppliers/list.md Use the GET method with `/v2/suppliers` to retrieve a paginated list of all your suppliers. This example shows how to list suppliers without any filters. ```http GET /v2/suppliers?page_size=100 ``` -------------------------------- ### Initialize Elements SDK and Create Label Workflow Source: https://docs.shipstation.com/apis/shipengine/docs/elements/label-workflow/label-workflow This snippet demonstrates how to initialize the Elements SDK with configuration options and then create a Label Workflow element. It includes setting up global features, purchase label features, and shipment summary features, along with defining callbacks for various events. ```javascript const elements = new ElementsSDK(getToken, { onError: (err: Error) => console.error(err), themeConfig: themeConfig, locale: 'en-US', features: { globalFeatures: { // The list of all ShipEngine carriers available to be activated enabledShipEngineCarriers: ['ups', 'stamps_com'], }, purchaseLabelFeatures: { rateForm: { enableFunding: true }, shipmentForm: { shippingPresets: true }, }, shipmentSummaryFeatures: { schedulePickup: true, }, }, }); const labelWorkflow = elements.create('labelWorkflow', { multiplexedId: { shipmentId: 'se-4352331', }, onViewShipment: () => console.log('go to shipment summary.'), onVoidLabelSuccess: () => console.log('Label Voided!'), onLabelCreateSuccess: () => console.log('Label Purchased!'), }); ``` -------------------------------- ### Quick Rates Request Example Source: https://docs.shipstation.com/apis/shipengine/docs/rates/advanced-features.md This example demonstrates a POST request to the /v1/rates endpoint using the 'quick' rate_type. It includes shipment details and specifies carrier IDs for rate retrieval. ```http POST /v1/rates/ HTTP/1.1 Host: api.shipengine.com API-Key: __YOUR_API_KEY_HERE__ Content-Type: application/json { "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" } } ] } } ``` -------------------------------- ### Example Paginated Request Source: https://docs.shipstation.com/apis/shipengine/docs/reference/pagination.md Demonstrates how to make a GET request to a paginated endpoint, specifying 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__ ``` -------------------------------- ### List Available Adjustment Reports Source: https://docs.shipstation.com/apis/shipengine/docs/reference/adjustments Retrieve a list of available adjustment reports. This example demonstrates a basic GET request to the reports endpoint. ```http GET /v1/incubator/adjustments/reports HTTP/1.1 Host: app.shipengine.com ``` ```json { "reports": [ { "report_id": "rpt_7QwpuXmAqPRRSfbX8QbAZ1", "created_at": "2019-09-03T16:04:18.052402-04:00", "report_download": { "href": "https://api.shipengine.com/v1/incubator/adjustments/reports/rpt_7QwpuXmAqPRRSfbX8QbAZ1" } }, { "report_id": "rpt_Xqg2eaygL7i5XzWJuuGENc", "created_at": "2019-10-07T15:15:21.758769-04:00", "report_download": { "href": "https://api.shipengine.com/v1/incubator/adjustments/reports/rpt_Xqg2eaygL7i5XzWJuuGENc" } } ], "total": 2, "page": 1, "pages": 1, "links": { "first": { "href": "https://api.shipengine.com/v1/incubator/adjustments/reports?page=1&page_size=50&sort_dir=asc&sort_by=created_at" }, "last": { "href": "https://api.shipengine.com/v1/incubator/adjustments/reports?page=1&page_size=50&sort_dir=asc&sort_by=created_at" }, "prev": { "href": "https://api.shipengine.com/v1/incubator/adjustments/reports?page=1&page_size=50&sort_dir=asc&sort_by=created_at" }, "next": { "href": "https://api.shipengine.com/v1/incubator/adjustments/reports?page=1&page_size=50&sort_dir=asc&sort_by=created_at" } } } ``` -------------------------------- ### List Accounts with Filters Source: https://docs.shipstation.com/apis/shipengine/docs/partners/accounts/list.md Use this example to retrieve a list of accounts, filtering by active status and a date range. Ensure you replace `__PARTNER_API_KEY_HERE__` with your actual API key. ```http GET /v1/partners/accounts?active=true&created_at_start=2022-01-01T00:00:00.000Z&created_at_end=2022-12-31T23:59:59.999Z HTTP/1.1 Host: api.shipengine.com API-Key: __PARTNER_API_KEY_HERE__ ```