### Get SKU Inventory Levels (Node.js) Source: https://docs.shipstation.com/openapi/inventory/createinventorylocation This Node.js example shows how to retrieve SKU inventory levels from the ShipStation API. It uses the 'node-fetch' library to make an asynchronous GET request, handling authentication via an API key and passing relevant query parameters. ```javascript const fetch = require('node-fetch'); const apiKey = 'YOUR_API_KEY_HERE'; const url = 'https://docs.shipstation.com/_mock/openapi/v2/inventory?group_by=warehouse&inventory_location_id=string&inventory_warehouse_id=string&limit=0&sku=string'; fetch(url, { method: 'GET', headers: { 'Api-Key': apiKey } }) .then(res => res.json()) .then(json => console.log(json)) .catch(err => console.error(err)); ``` -------------------------------- ### Downloads API Source: https://docs.shipstation.com/openapi/labels/create_return_label Download your label files in PDF, PNG, and ZPL. ```APIDOC ## Downloads API ### Description Download your label files in PDF, PNG, and ZPL. ### Operations #### Download File - **Method**: GET - **Endpoint**: `/v2/downloads/{dir}/{subdir}/{filename}` ``` -------------------------------- ### Manifests API Source: https://docs.shipstation.com/openapi/users Create and manage manifests, which are documents listing the day's shipments for efficient pickup scanning. ```APIDOC ## Manifests API ### Description A manifest is a document that provides a list of the day's shipments. It typically contains a barcode that allows the pickup driver to scan a single document to register all shipments, rather than scanning each shipment individually. ### Operations - **GET /v2/manifests**: Retrieve a list of manifests. - **POST /v2/manifests**: Create a new manifest. - **GET /v2/manifests/{manifest_id}**: Retrieve details of a specific manifest. ``` -------------------------------- ### Get SKU Inventory Levels (Node.js) Source: https://docs.shipstation.com/openapi/inventory/updateinventorylocation Retrieves inventory levels for specified SKUs using Node.js. This example utilizes the 'axios' library to send a GET request to the ShipStation API. It includes parameters for filtering and grouping inventory data, essential for managing stock across different locations and warehouses. ```javascript const axios = require('axios'); async function getInventoryLevelsNode(apiKey, sku, inventoryWarehouseId, inventoryLocationId, groupBy, limit) { const url = `https://api.shipstation.com/v2/inventory`; const params = { sku: sku || undefined, inventory_warehouse_id: inventoryWarehouseId || undefined, inventory_location_id: inventoryLocationId || undefined, group_by: groupBy || undefined, limit: limit || undefined }; try { const response = await axios.get(url, { params: params, headers: { 'Authorization': `Basic ${Buffer.from(apiKey + ':').toString('base64')}` } }); return response.data; } catch (error) { console.error('Error fetching inventory levels:', error); throw error; } } // Example usage: // const apiKey = 'YOUR_API_KEY_HERE'; // getInventoryLevelsNode(apiKey, 'SKU123', 'WAREHOUSE456', '', 'warehouse', 10).then(data => console.log(data)).catch(error => console.error('Error:', error)); ``` -------------------------------- ### Downloads API Source: https://docs.shipstation.com/openapi/warehouses/list_warehouses Download your label files in PDF, PNG, and ZPL. ```APIDOC ## Downloads API ### Description Download your label files in PDF, PNG, and ZPL. ### Operations - GET /v2/downloads/{dir}/{subdir}/{filename} ``` -------------------------------- ### Get Carrier Details (Implicit) Source: https://docs.shipstation.com/openapi/carriers/get_carrier_options Retrieves detailed information about a specific carrier. The request body example is provided as a representation of the data returned for a carrier. ```APIDOC ## GET /v2/carriers/{carrier_id} ### Description Retrieves detailed information about a specific carrier. ### Method GET ### Endpoint /v2/carriers/{carrier_id} ### Parameters #### Path Parameters - **carrier_id** (string) - Required - A string that uniquely identifies a ShipStation resource, such as a carrier, label, shipment, etc. ### Request Example (No explicit request example provided for this GET endpoint, typically requires only path parameters) ### Response #### Success Response (200) - **carrier_id** (string) - A string that uniquely identifies a ShipStation resource. - **carrier_code** (string) - A shipping carrier code (e.g., `fedex`, `dhl_express`). - **account_number** (string) - The account number associated with the carrier. - **requires_funded_amount** (boolean) - Indicates if the carrier requires funding. - **balance** (number) - Current available balance for the carrier. - **nickname** (string) - Nickname given to the account when setting up the carrier. - **friendly_name** (string) - Screen readable name of the carrier. - **funding_source_id** (string | null) - A string that uniquely identifies a ShipStation resource, or null. - **primary** (boolean) - Indicates if this is the primary carrier. - **has_multi_package_supporting_services** (boolean) - Whether the carrier supports multiple packages per shipment. - **supports_label_messages** (boolean) - Whether the carrier supports custom label messages. - **disabled_by_billing_plan** (boolean) - Whether the carrier is disabled by the billing plan. - **services** (Array of objects) - A list of services offered by the carrier. - **packages** (Array of objects) - A list of package types supported by the carrier. - **options** (Array of objects) - A list of advanced options available for the carrier. #### Response Example ```json { "carrier_id": "se-8412", "carrier_code": "dhl_express", "account_number": "account_570827", "requires_funded_amount": true, "balance": 3799.52, "nickname": "ShipStation Account - Stamps.com", "friendly_name": "Stamps.com", "funding_source_id": "se-28529731", "primary": true, "has_multi_package_supporting_services": true, "supports_label_messages": true, "disabled_by_billing_plan": true, "services": [ { … } ], "packages": [ { … } ], "options": [ { … } ] } ``` ``` -------------------------------- ### Products API Source: https://docs.shipstation.com/openapi/package_pickups Manage products in your ShipStation account. ```APIDOC ## Products API Manage products in your ShipStation account. Products represent the items you sell and ship to customers. ### Operations - **GET** `/v2/products` ``` -------------------------------- ### ShipStation Batch Response Example (JSON) Source: https://docs.shipstation.com/openapi/batches/list_batch_errors This JSON object represents a typical response for batch-related API calls, detailing batch information, download links for labels and forms, and status. ```json { "label_layout": "4x6", "label_format": "pdf", "batch_id": "se-28529731", "batch_number": "123456", "external_batch_id": "12323aaaar", "batch_notes": "Batch for morning shipment", "created_at": "2018-09-23T15:00:00.000Z", "processed_at": "2018-09-23T15:00:00.000Z", "errors": 2, "process_errors": [ { ... } ], "warnings": 1, "completed": 1, "forms": 3, "count": 2, "batch_shipments_url": { "href": "http://api.shipstation.com/v2/labels/se-28529731", "type": "child" }, "batch_labels_url": { "href": "http://api.shipstation.com/v2/labels/se-28529731", "type": "child" }, "batch_errors_url": { "href": "http://api.shipstation.com/v2/labels/se-28529731", "type": "child" }, "label_download": { "href": "http://api.shipstation.com/v2/labels/se-28529731", "pdf": "http://api.shipstation.com/v2/labels/se-28529731", "png": "http://api.shipstation.com/v2/labels/se-28529731", "zpl": "http://api.shipstation.com/v2/labels/se-28529731" }, "form_download": { "href": "http://api.shipstation.com/v2/labels/se-28529731", "type": "child" }, "paperless_download": { "href": "http://api.shipstation.com/v2/labels/se-28529731", "instructions": "any instructions", "handoff_code": "122334" }, "status": "open" } ``` -------------------------------- ### Get Tags (JavaScript) Source: https://docs.shipstation.com/openapi/tags/create_tag Fetches all tags associated with a ShipStation account using JavaScript. This example demonstrates an asynchronous fetch request, requiring an API key for authorization. The result is a JSON object containing a list of tags. ```javascript async function getTags() { const apiKey = 'YOUR_API_KEY_HERE'; const response = await fetch('https://docs.shipstation.com/_mock/openapi/v2/tags', { method: 'GET', headers: { 'api-key': apiKey } }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log(data.tags); return data.tags; } ``` -------------------------------- ### List Products using Python Source: https://docs.shipstation.com/openapi/products/listproducts This Python code snippet demonstrates how to list products from the ShipStation API. It uses the 'requests' library to send a GET request to the /v2/products endpoint, with query parameters for filtering and pagination. The 'api-key' is passed in the headers for authentication. ```python import requests def list_products(): api_key = 'YOUR_API_KEY_HERE' base_url = 'https://docs.shipstation.com/_mock/openapi/v2/products' params = { 'active': 'true', 'name': 'string', 'page': '1', 'page_size': '100', 'sku': 'string' } headers = { 'api-key': api_key } try: response = requests.get(base_url, params=params, headers=headers) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) return data except requests.exceptions.RequestException as e: print(f'Error fetching products: {e}') list_products() ``` -------------------------------- ### ShipStation Carrier Options JSON Response Source: https://docs.shipstation.com/openapi/carriers/get_carrier_options Example JSON response for carrier options in ShipStation. It contains an 'options' array, where each element represents a configurable option for the carrier. This is typically returned after a successful API request to get carrier options. ```JSON { "options": [ { "…" } ] } ``` -------------------------------- ### Downloads API Source: https://docs.shipstation.com/openapi/webhooks/list_webhooks Download your label files in PDF, PNG, and ZPL. ```APIDOC ## Downloads Operations ### Download File **Description**: Downloads a label file in various formats (PDF, PNG, ZPL). **Method**: GET **Endpoint**: `/v2/downloads/{dir}/{subdir}/{filename}` ``` -------------------------------- ### Downloads API Source: https://docs.shipstation.com/openapi/rates Download your label files in PDF, PNG, and ZPL. ```APIDOC ## Downloads ### Description Download your label files in PDF, PNG, and ZPL. ### Operations - **GET** `/v2/downloads/{dir}/{subdir}/{filename}` ``` -------------------------------- ### Get SKU Inventory Levels (Node.js) Source: https://docs.shipstation.com/openapi/inventory/updateinventorywarehouse This Node.js example demonstrates how to retrieve SKU inventory levels. It supports filtering parameters like SKU, warehouse ID, and location ID, along with grouping and limiting the results. An API key is necessary for authentication. ```javascript const fetch = require('node-fetch'); async function getInventory(apiKey, params) { const url = new URL('https://docs.shipstation.com/_mock/openapi/v2/inventory'); Object.keys(params).forEach(key => url.searchParams.append(key, params[key])); try { const response = await fetch(url.toString(), { method: 'GET', headers: { 'api-key': apiKey } }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return await response.json(); } catch (error) { console.error('Error fetching inventory:', error); throw error; } } // Example usage: // const apiKey = 'YOUR_API_KEY_HERE'; // const queryParams = { // sku: 'ITEM456', // inventory_location_id: 'LOC1', // group_by: 'location', // limit: 5 // }; // getInventory(apiKey, queryParams).then(data => console.log(data)).catch(error => console.error(error)); ``` -------------------------------- ### List Batches - cURL Example Source: https://docs.shipstation.com/openapi/batches/list_batch_errors This cURL command demonstrates how to list batches from your ShipStation account. It includes parameters for filtering by batch number, pagination, sorting direction and field, and status. Ensure you replace 'YOUR_API_KEY_HERE' with your actual API key. ```bash curl -i -X GET \ 'https://docs.shipstation.com/_mock/openapi/v2/batches?batch_number=string&page=1&page_size=25&sort_by=ship_date&sort_dir=desc&status=open' \ -H 'api-key: YOUR_API_KEY_HERE' ``` -------------------------------- ### List Products using JavaScript Source: https://docs.shipstation.com/openapi/products/listproducts This JavaScript code snippet illustrates how to fetch a list of products from the ShipStation API. It utilizes the 'fetch' API to make a GET request to the /v2/products endpoint, including query parameters for filtering and pagination. Authentication is handled via an 'api-key' in the request headers. ```javascript async function listProducts() { const apiKey = 'YOUR_API_KEY_HERE'; const baseUrl = 'https://docs.shipstation.com/_mock/openapi/v2/products'; const params = new URLSearchParams({ active: 'true', name: 'string', page: '1', page_size: '100', sku: 'string' }); const url = `${baseUrl}?${params}`; try { const response = await fetch(url, { method: 'GET', headers: { 'api-key': apiKey } }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log(data); return data; } catch (error) { console.error('Error fetching products:', error); } } listProducts(); ``` -------------------------------- ### Downloads API Source: https://docs.shipstation.com/openapi/shipments/list_shipment_rates Download your label files in PDF, PNG, and ZPL. ```APIDOC ## Downloads API ### Description Download your label files in PDF, PNG, and ZPL. ### Endpoints #### Download Label File **Method**: GET **Endpoint**: `/v2/downloads/{dir}/{subdir}/{filename}` ``` -------------------------------- ### List ShipStation Fulfillments (Python) Source: https://docs.shipstation.com/openapi/fulfillments/list_fulfillments Python code snippet for retrieving ShipStation fulfillments. This example uses the 'requests' library to send a GET request to the API endpoint with specified query parameters for filtering and sorting. It includes basic error handling for the HTTP request. ```python import requests api_key = 'YOUR_API_KEY_HERE' base_url = 'https://docs.shipstation.com/_mock/openapi' endpoint = '/v2/fulfillments' params = { 'batch_id': 'string', 'create_date_end': '2019-08-24T14:15:22Z', 'create_date_start': '2019-08-24T14:15:22Z', 'fulfillment_id': 'string', 'fulfillment_provider_code': 'string', 'order_source_id': 'string', 'page': 1, 'page_size': 25, 'ship_date_end': '2019-08-24T14:15:22Z', 'ship_date_start': '2019-08-24T14:15:22Z', 'ship_to_country_code': 'string', 'ship_to_name': 'string', 'shipment_id': 'string', 'shipment_number': 'string', 'sort_by': 'created_at', 'sort_dir': 'asc', 'tracking_number': 'string' } headers = { 'api-key': api_key, 'Content-Type': 'application/json' } try: response = requests.get(f'{base_url}{endpoint}', params=params, headers=headers) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f'Error listing fulfillments: {e}') ``` -------------------------------- ### List ShipStation Fulfillments (Node.js) Source: https://docs.shipstation.com/openapi/fulfillments/list_fulfillments This Node.js example shows how to fetch a list of ShipStation fulfillments. It uses the built-in 'https' module to make a GET request, including necessary headers like 'api-key'. The code demonstrates how to construct the URL with query parameters for filtering. ```javascript const https = require('https'); const apiKey = 'YOUR_API_KEY_HERE'; const apiUrl = '/v2/fulfillments'; const host = 'docs.shipstation.com'; // Use _mock host for testing if available const port = 443; const queryParams = { batch_id: 'string', create_date_end: '2019-08-24T14:15:22Z', create_date_start: '2019-08-24T14:15:22Z', fulfillment_id: 'string', fulfillment_provider_code: 'string', order_source_id: 'string', page: '1', page_size: '25', ship_date_end: '2019-08-24T14:15:22Z', ship_date_start: '2019-08-24T14:15:22Z', ship_to_country_code: 'string', ship_to_name: 'string', shipment_id: 'string', shipment_number: 'string', sort_by: 'created_at', sort_dir: 'asc', tracking_number: 'string' }; const queryString = Object.keys(queryParams).map(key => `${key}=${queryParams[key]}`).join('&'); const requestUrl = `${apiUrl}?${queryString}`; const options = { hostname: host, port: port, path: requestUrl, method: 'GET', headers: { 'api-key': apiKey, 'Content-Type': 'application/json' } }; const req = https.request(options, (res) => { let data = ''; res.on('data', (chunk) => { data += chunk; }); res.on('end', () => { console.log(JSON.parse(data)); }); }).on('error', (err) => { console.error('Error:', err); }); req.end(); ``` -------------------------------- ### Downloads API Source: https://docs.shipstation.com/openapi/users/listusers Download your label files in PDF, PNG, and ZPL formats. ```APIDOC ## Downloads API ### Description Download your label files in PDF, PNG, and ZPL. ### Operations - **GET `/v2/downloads/{dir}/{subdir}/{filename}`**: Download a label file. ``` -------------------------------- ### List ShipStation Fulfillments (JavaScript) Source: https://docs.shipstation.com/openapi/fulfillments/list_fulfillments Example of how to list ShipStation fulfillments using JavaScript. This code snippet demonstrates making a GET request to the fulfillments endpoint with various query parameters for filtering and sorting. Ensure you replace placeholders with actual values and handle API key securely. ```javascript const apiKey = 'YOUR_API_KEY_HERE'; const apiUrl = 'https://docs.shipstation.com/_mock/openapi/v2/fulfillments'; async function listFulfillments() { const params = new URLSearchParams({ batch_id: 'string', create_date_end: '2019-08-24T14:15:22Z', create_date_start: '2019-08-24T14:15:22Z', fulfillment_id: 'string', fulfillment_provider_code: 'string', order_source_id: 'string', page: '1', page_size: '25', ship_date_end: '2019-08-24T14:15:22Z', ship_date_start: '2019-08-24T14:15:22Z', ship_to_country_code: 'string', ship_to_name: 'string', shipment_id: 'string', shipment_number: 'string', sort_by: 'created_at', sort_dir: 'asc', tracking_number: 'string' }); try { const response = await fetch(`${apiUrl}?${params.toString()}`, { method: 'GET', headers: { 'api-key': apiKey, 'Content-Type': 'application/json' } }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log(data); return data; } catch (error) { console.error('Error listing fulfillments:', error); } } listFulfillments(); ``` -------------------------------- ### Manifests API Source: https://docs.shipstation.com/openapi/users/listusers Create and retrieve manifests, which are documents listing the day's shipments for carrier pickup drivers. ```APIDOC ## Manifests API ### Description A manifest is a document that provides a list of the day's shipments. It typically contains a barcode that allows the pickup driver to scan a single document to register all shipments, rather than scanning each shipment individually. ### Operations - **GET `/v2/manifests`**: Retrieve a list of manifests. - **POST `/v2/manifests`**: Create a new manifest. - **GET `/v2/manifests/{manifest_id}`**: Retrieve details for a specific manifest. ``` -------------------------------- ### Downloads API Source: https://docs.shipstation.com/openapi/inventory/createinventorylocation Download your label files in PDF, PNG, and ZPL formats. ```APIDOC ## GET /v2/downloads/{dir}/{subdir}/{filename} ### Description Downloads a label file. ### Method GET ### Endpoint /v2/downloads/{dir}/{subdir}/{filename} ### Parameters #### Path Parameters - **dir** (string) - Required - The directory of the file. - **subdir** (string) - Required - The subdirectory of the file. - **filename** (string) - Required - The name of the file. ### Response #### Success Response (200) - The content of the requested file (e.g., PDF, PNG, ZPL). #### Response Example (Binary file content) ``` -------------------------------- ### JSON Response Example for Batch Details Source: https://docs.shipstation.com/openapi/batches/list_batch_errors This JSON object represents the details of a batch, including layout, format, IDs, timestamps, counts of errors and completed items, and various download URLs for labels, forms, and paperless options. It also indicates the batch status. ```json { "label_layout": "4x6", "label_format": "pdf", "batch_id": "se-28529731", "batch_number": "123456", "external_batch_id": "12323aaaar", "batch_notes": "Batch for morning shipment", "created_at": "2018-09-23T15:00:00.000Z", "processed_at": "2018-09-23T15:00:00.000Z", "errors": 2, "process_errors": [ { … } ], "warnings": 1, "completed": 1, "forms": 3, "count": 2, "batch_shipments_url": { "href": "http://api.shipstation.com/v2/labels/se-28529731", "type": "child" }, "batch_labels_url": { "href": "http://api.shipstation.com/v2/labels/se-28529731", "type": "child" }, "batch_errors_url": { "href": "http://api.shipstation.com/v2/labels/se-28529731", "type": "child" }, "label_download": { "href": "http://api.shipstation.com/v2/labels/se-28529731", "pdf": "http://api.shipstation.com/v2/labels/se-28529731", "png": "http://api.shipstation.com/v2/labels/se-28529731", "zpl": "http://api.shipstation.com/v2/labels/se-28529731" }, "form_download": { "href": "http://api.shipstation.com/v2/labels/se-28529731", "type": "child" }, "paperless_download": { "href": "http://api.shipstation.com/v2/labels/se-28529731", "instructions": "any instructions", "handoff_code": "122334" }, "status": "open" } ``` -------------------------------- ### Downloads API Source: https://docs.shipstation.com/openapi/downloads Download your label files in PDF, PNG, and ZPL. ```APIDOC ## GET /v2/downloads/{dir}/{subdir}/{filename} ### Description Download labels and other shipment-related documents. ### Method GET ### Endpoint /v2/downloads/{dir}/{subdir}/{filename} ### Parameters #### Path Parameters - **dir** (string) - Required - The directory of the file. - **subdir** (string) - Required - The subdirectory of the file. - **filename** (string) - Required - The name of the file to download. #### Query Parameters - **download** (string) - Optional - Specifies the download format (e.g., 'pdf'). - **rotation** (integer) - Optional - Rotation value for the download. ### Request Example ```bash curl -i -X GET \ 'https://api.shipstation.com/v2/downloads/labels/pdf/12345.pdf?download=pdf&rotation=0' \ -H 'api-key: YOUR_API_KEY_HERE' ``` ### Response #### Success Response (200) - **download_file_pdf_response_body** (binary) - The content of the requested file (e.g., PDF). #### Response Example (Binary file content, e.g., PDF data) #### Error Response (400, 404, 500) - **request_id** (string) - Unique identifier for the request. - **errors** (array) - A list of error objects. #### Error Response Example ```json { "request_id": "aa3d8e8e-462b-4476-9618-72db7f7b7009", "errors": [ { "code": "INVALID_PARAMETER", "message": "The provided parameter is invalid." } ] } ``` ``` -------------------------------- ### List SKU Inventory Levels - Python Source: https://docs.shipstation.com/openapi/inventory/updateskustocklevels A Python script demonstrating how to query SKU inventory levels from the ShipStation API v2. This example uses the `requests` library to make a GET request, passing necessary headers including the API key and query parameters for filtering and grouping inventory data. ```python import requests def list_inventory(api_key, params): base_url = "https://api.shipstation.com/v2/inventory" headers = { "Authorization": f"ApiKey {api_key}" } try: response = requests.get(base_url, headers=headers, params=params) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) return data except requests.exceptions.RequestException as e: print(f"Error fetching inventory: {e}") return None # Example Usage: # api_key = "YOUR_API_KEY_HERE" # inventory_params = { # "group_by": "warehouse", # "sku": "EXAMPLE_SKU" # } # list_inventory(api_key, inventory_params) ``` -------------------------------- ### Package Pickups API Source: https://docs.shipstation.com/openapi/index Schedule pickups and manage pickup requests for supported carriers. ```APIDOC ## Package Pickups API ### Description Schedule and manage package pickup requests. ### Operations * **GET** `/v2/pickups` * Description: Retrieves a list of scheduled pickups. * **POST** `/v2/pickups` * Description: Schedules a new package pickup. * **GET** `/v2/pickups/{pickup_id}` * Description: Retrieves details for a specific pickup by ID. * **DELETE** `/v2/pickups/{pickup_id}` * Description: Cancels a scheduled pickup. ``` -------------------------------- ### Get Warehouse by ID Source: https://docs.shipstation.com/openapi/warehouses/list_warehouses Get details for a specific warehouse by its ID. ```APIDOC ## GET /v2/warehouses/{warehouse_id} ### Description Get details for a specific warehouse by its ID. ### Method GET ### Endpoint /v2/warehouses/{warehouse_id} ### Parameters #### Path Parameters - **warehouse_id** (integer) - Required - The unique identifier for the warehouse. #### Query Parameters None #### Request Body None ### Request Example ```bash curl -i -X GET \ https://docs.shipstation.com/_mock/openapi/v2/warehouses/1 \ -H 'api-key: YOUR_API_KEY_HERE' ``` ### Response #### Success Response (200) - **warehouse_id** (integer) - The unique identifier for the warehouse. - **warehouse_name** (string) - The name of the warehouse. - **is_default** (boolean) - Indicates if this is the default warehouse. - **address** (object) - Details of the warehouse address. - **street1** (string) - **street2** (string) - **street3** (string) - **city** (string) - **state** (string) - **zip** (string) - **country** (string) - **phone** (string) #### Response Example ```json { "warehouse_id": 1, "warehouse_name": "Main Warehouse", "is_default": true, "address": { "street1": "123 Main St", "street2": "", "street3": "", "city": "Anytown", "state": "CA", "zip": "90210", "country": "US", "phone": "555-123-4567" } } ``` ``` -------------------------------- ### List SKU Inventory Levels - JavaScript (Node.js) Source: https://docs.shipstation.com/openapi/inventory/updateskustocklevels Provides a JavaScript example for fetching SKU inventory levels using the ShipStation API v2. This snippet illustrates making a GET request to the inventory endpoint, including query parameters for filtering and grouping. Assumes the use of a library like 'axios' for HTTP requests and requires your API key. ```javascript // Example using fetch API (Node.js environment with fetch available or browser) async function listInventory(apiKey, params) { const url = `https://api.shipstation.com/v2/inventory?${new URLSearchParams(params).toString()}`; try { const response = await fetch(url, { method: 'GET', headers: { 'Authorization': `ApiKey ${apiKey}` } }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log(data); return data; } catch (error) { console.error('Error fetching inventory:', error); } } // Example Usage: // const apiKey = 'YOUR_API_KEY_HERE'; // const inventoryParams = { // group_by: 'warehouse', // sku: 'EXAMPLE_SKU' // }; // listInventory(apiKey, inventoryParams); ``` -------------------------------- ### Downloads API Source: https://docs.shipstation.com/openapi/labels/void_label Download your label files in PDF, PNG, and ZPL formats. ```APIDOC ## GET /v2/downloads/{dir}/{subdir}/{filename} ### Description Downloads a label file in a specified format. ### Method GET ### Endpoint /v2/downloads/{dir}/{subdir}/{filename} ### Parameters #### Path Parameters - **dir** (string) - Required - The directory where the file is located. - **subdir** (string) - Required - The subdirectory where the file is located. - **filename** (string) - Required - The name of the file to download. ### Request Example (No request body for GET) ### Response #### Success Response (200) - The response will be the content of the requested file (e.g., PDF, PNG, ZPL). #### Response Example (Content of the downloaded file) ``` -------------------------------- ### Downloads API Source: https://docs.shipstation.com/openapi/package_pickups/schedule_pickup Download your label files in PDF, PNG, and ZPL formats. ```APIDOC ## GET /v2/downloads/{dir}/{subdir}/{filename} ### Description Download a label file. ### Method GET ### Endpoint /v2/downloads/{dir}/{subdir}/{filename} ### Parameters #### Path Parameters - **dir** (string) - Required - The directory of the file. - **subdir** (string) - Required - The subdirectory of the file. - **filename** (string) - Required - The name of the file. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - File content in the specified format (PDF, PNG, ZPL). #### Response Example ```json { "example": "[File Content]" } ``` ``` -------------------------------- ### GET /v2/tags Source: https://docs.shipstation.com/openapi/tags/create_tag Get a list of all tags associated with an account. ```APIDOC ## GET /v2/tags ### Description Get a list of all tags associated with an account. ### Method GET ### Endpoint `/v2/tags` ### Parameters #### Query Parameters * `api-key` (string) - Required - Your ShipStation API key. ### Request Example ```curl curl -i -X GET \ https://api.shipstation.com/v2/tags \ -H 'api-key: YOUR_API_KEY_HERE' ``` ### Response #### Success Response (200) - `tags` (Array of objects) - An array of tag objects. - `tag` (object) - Represents a single tag. #### Response Example ```json { "tags": [ { "tagId": 1, "tagName": "Priority" }, { "tagId": 2, "tagName": "Urgent" } ] } ``` #### Error Responses - **400**: Bad Request - **404**: Not Found - **500**: Internal Server Error ``` -------------------------------- ### Example Request Body for Rate Calculation Source: https://docs.shipstation.com/openapi/rates/calculate_rates An example JSON payload for requesting shipping rates. ```APIDOC ## Example Request Body for Rate Calculation ### Request Body ```json { "shipment_id": "se-28529731", "carrier_id": "se-1234567", "service_code": "se_1234567", "requested_shipment_service": "usps_priority_mail", "shipping_rule_id": "se-1234", "external_order_id": "1232434", "hold_until_date": "2025-01-15T00:00:00.000Z", "ship_by_date": "2025-01-15T00:00:00.000Z", "retail_rate": { "currency": "string", "amount": 12 }, "store_id": "se-12345", "items": [], "notes_from_buyer": "Please handle with care", "notes_for_gift": "Happy Birthday!", "is_gift": true, "assigned_user": "user@example.com", "amount_paid": { "currency": "string", "amount": 12 }, "shipping_paid": { "currency": "string", "amount": 12 }, "tax_paid": { "currency": "string", "amount": 12 } } ``` ``` -------------------------------- ### Downloads API Source: https://docs.shipstation.com/openapi/warehouses Download your label files in PDF, PNG, and ZPL formats. ```APIDOC ## GET /v2/downloads/{dir}/{subdir}/{filename} ### Description Downloads a label file from the specified path. ### Method GET ### Endpoint /v2/downloads/{dir}/{subdir}/{filename} ### Parameters #### Path Parameters - **dir** (string) - Required - The directory containing the file. - **subdir** (string) - Required - The subdirectory containing the file. - **filename** (string) - Required - The name of the file to download. ### Response #### Success Response (200) The content of the requested file (e.g., PDF, PNG, ZPL). #### Response Example (This endpoint returns file content, not JSON. Example shows a placeholder for file content.) ``` [Binary file content - PDF, PNG, or ZPL] ``` ``` -------------------------------- ### GET /websites/shipstation/rates Source: https://docs.shipstation.com/openapi/shipments/list_shipment_rates Retrieves available shipping rates for a given shipment. This endpoint allows users to get a list of shipping options with associated costs and delivery estimates. ```APIDOC ## GET /websites/shipstation/rates ### Description Retrieves available shipping rates for a given shipment. This endpoint allows users to get a list of shipping options with associated costs and delivery estimates. ### Method GET ### Endpoint /websites/shipstation/rates ### Parameters #### Query Parameters - **destination_postal_code** (string) - Required - The postal code of the destination address. - **destination_country_code** (string) - Required - The country code of the destination address (ISO 3166-1 alpha-2). - **ship_date** (string) - Required - The date the shipment will be sent (YYYY-MM-DD). - **shipment_total_weight** (number) - Required - The total weight of the shipment. - **insurance_value** (number) - Optional - The insured value of the shipment. - **customs_value** (number) - Optional - The customs value of the shipment for international orders. - **package_type** (string) - Optional - The type of package (e.g., "package", "large_envelope"). - **dimensions_length** (number) - Optional - The length of the package in inches. - **dimensions_width** (number) - Optional - The width of the package in inches. - **dimensions_height** (number) - Optional - The height of the package in inches. - **from_postal_code** (string) - Optional - The postal code of the origin address. Defaults to the sender's primary postal code. - **from_country_code** (string) - Optional - The country code of the origin address. Defaults to the sender's primary country code. ### Request Example ``` GET /websites/shipstation/rates?destination_postal_code=90210&destination_country_code=US&ship_date=2023-10-27&shipment_total_weight=5 ``` ### Response #### Success Response (200) - **rates** (array of objects) - An array of shipment rates. - **rate_id** (string) - A unique identifier for the rate. - **rate_type** (string) - The type of rate (e.g., "check", "shipment"). - **carrier_id** (string) - The identifier for the carrier. - **shipping_amount** (object) - The cost of shipping. - **currency** (string) - The currency code (ISO 4217). - **amount** (number) - The shipping cost amount. - **insurance_amount** (object) - The cost of insurance. - **currency** (string) - The currency code (ISO 4217). - **amount** (number) - The insurance cost amount. - **confirmation_amount** (object) - The cost of confirmation services. - **currency** (string) - The currency code (ISO 4217). - **amount** (number) - The confirmation cost amount. - **other_amount** (object) - The cost of other services. - **currency** (string) - The currency code (ISO 4217). - **amount** (number) - The other services cost amount. - **requested_comparison_amount** (object) - The requested comparison amount. - **tax_amount** (object) - The tax amount. - **zone** (integer) - The shipping zone. - **package_type** (string) - The type of package for this rate. - **delivery_days** (integer) - The estimated number of delivery days. - **guaranteed_service** (boolean) - Indicates if the service is guaranteed. - **estimated_delivery_date** (string) - The estimated delivery date (ISO 8601 format). - **carrier_delivery_days** (string) - The carrier's estimated delivery days. - **ship_date** (string) - The ship date. - **negotiated_rate** (boolean) - Indicates if the rate is negotiated. - **service_type** (string) - The type of service. - **service_code** (string) - The code for the service. - **trackable** (boolean) - Indicates if the rate is trackable. - **carrier_code** (string) - The code for the carrier. - **carrier_nickname** (string) - The nickname of the carrier. #### Response Example ```json { "rates": [ { "rate_id": "se-1234567890", "rate_type": "shipment", "carrier_id": "se-9876543210", "shipping_amount": { "currency": "USD", "amount": 15.50 }, "insurance_amount": { "currency": "USD", "amount": 2.00 }, "confirmation_amount": { "currency": "USD", "amount": 0.00 }, "other_amount": { "currency": "USD", "amount": 0.00 }, "requested_comparison_amount": null, "tax_amount": null, "zone": 3, "package_type": "package", "delivery_days": 3, "guaranteed_service": false, "estimated_delivery_date": "2023-10-30", "carrier_delivery_days": "3", "ship_date": "2023-10-27", "negotiated_rate": false, "service_type": "ground", "service_code": "ups_ground", "trackable": true, "carrier_code": "ups", "carrier_nickname": "UPS Ground" } ] } ``` #### Error Response (400, 404, 500) - A JSON object containing an error message. #### Error Response Example ```json { "error": "Invalid parameters provided." } ``` ``` -------------------------------- ### Package Pickups API Source: https://docs.shipstation.com/openapi/users/listusers Schedule pickups and manage pickup requests for supported carriers. ```APIDOC ## Package Pickups API ### Description Scheduled pickups and manage pickup requests for supported carriers. ### Operations - **GET `/v2/pickups`**: Retrieve a list of scheduled pickups. - **POST `/v2/pickups`**: Schedule a new pickup. - **GET `/v2/pickups/{pickup_id}`**: Retrieve details for a specific pickup. - **DELETE `/v2/pickups/{pickup_id}`**: Cancel a pickup. ``` -------------------------------- ### ShipStation API - Get Warehouses Endpoint Source: https://docs.shipstation.com/openapi/rates/estimate_rates This GET endpoint retrieves a list of all warehouses configured in ShipStation. It provides basic information about each warehouse. ```http GET /v2/warehouses ``` -------------------------------- ### Downloads API Source: https://docs.shipstation.com/openapi/tags/list_tags Download your label files in PDF, PNG, and ZPL. ```APIDOC ## GET /v2/downloads/{dir}/{subdir}/{filename} ### Description Downloads a label file. ### Method GET ### Endpoint /v2/downloads/{dir}/{subdir}/{filename} ### Parameters #### Path Parameters - **dir** (string) - Required - The directory of the file. - **subdir** (string) - Required - The subdirectory of the file. - **filename** (string) - Required - The name of the file. ### Response #### Success Response (200) - The content of the requested file (e.g., PDF, PNG, ZPL). #### Response Example (Binary content of the file) ``` -------------------------------- ### Warehouses API Source: https://docs.shipstation.com/openapi/batches/list_batch_errors Get warehouse details like warehouse ID and related addresses using the warehouses endpoint. ```APIDOC ## Warehouses Get warehouse details like warehouse ID and related addresses using the warehouses endpoint. ### Operations - GET /v2/warehouses - GET /v2/warehouses/{warehouse_id} ``` -------------------------------- ### Downloads API Source: https://docs.shipstation.com/openapi/products/listproducts Download your label files in PDF, PNG, and ZPL formats. ```APIDOC ## GET /v2/downloads/{dir}/{subdir}/{filename} ### Description Downloads a label file. ### Method GET ### Endpoint /v2/downloads/{dir}/{subdir}/{filename} ### Parameters #### Path Parameters - **dir** (string) - Required - The directory of the file. - **subdir** (string) - Required - The subdirectory of the file. - **filename** (string) - Required - The name of the file to download. ### Response #### Success Response (200) - The content of the requested file (e.g., PDF, PNG, ZPL). ### Response Example (Response content will vary based on the file type) ```