### Javascript Client Example Source: https://developer.shiphero.com/graphql-primer Example demonstrating how to consume the ShipHero API using Javascript with the `graphql-request` library. ```APIDOC ## Javascript Client Example ### Description An example for integrating with the ShipHero API using Javascript with the `graphql-request` library. ### Using graphql-request ```javascript import { GraphQLClient } from 'graphql-request' async function main() { const endpoint = 'https://public-api.shiphero.com/graphql' const graphQLClient = new GraphQLClient(endpoint, { headers: { authorization: 'Bearer TOKEN', }, }) const query = /* GraphQL */ ` { products { request_id complexity data(first: 10) { edges { node { id sku } } } } } ` const data = await graphQLClient.request(query) console.log(JSON.stringify(data, undefined, 2)) } main().catch(error => console.error(error)) ``` ``` -------------------------------- ### Python Client Examples Source: https://developer.shiphero.com/graphql-primer Examples demonstrating how to consume the ShipHero API using Python with `gql` and `sgqlc` libraries. ```APIDOC ## Python Client Examples ### Description Examples for integrating with the ShipHero API using Python. Two common libraries, `gql` and `sgqlc`, are demonstrated. ### Using gql ```python from gql import gql, Client from gql.transport.requests import RequestsHTTPTransport _transport = RequestsHTTPTransport( url='https://public-api.shiphero.com/graphql', use_json=True, ) _transport.headers = { "User-Agent": "Mozilla/5.0 (X11; ubuntu; " + "Linux x86_64; rv:58.0) Gecko/0100101 Firefox/58.0", "Authorization": "Bearer {}".format(YOUR_TOKEN), "content-type": "application/json", } client = Client( transport=_transport, fetch_schema_from_transport=True, ) query = gql(""" { products { request_id complexity data(first: 10) { edges { node { id sku } } } } } """) print(client.execute(query)) ``` ### Using sgqlc First, generate the schema: ```shell python3 -m sgqlc.introspection \ --exclude-deprecated \ --exclude-description \ -H "Authorization: Bearer YOUR_TOKEN" \ http://public-api.shiphero.com/graphql \ sh_public_api.json ``` Then, autogenerate the types: ```shell sgqlc-codegen sh_public_api.json sh_public_api_schema.py ``` Now start making requests: ```python from sgqlc.operation import Operation from sgqlc.endpoint.http import HTTPEndpoint from sh_public_api_schema import sh_public_api_schema as schema endpoint = HTTPEndpoint( 'http://http://public-api.shiphero.com/graphql', base_headers={'Authorization': 'Bearer YOUR_TOKEN'} ) # Build the query op = Operation(schema.Query) # Building the products query ps = op.products() # Make sure to request the complexity and request_id ps.complexity() ps.request_id() # Get the first 10 and define the selections p_data = ps.data(first=10) p_data.edges.node.sku() p_data.edges.node.id() # Executing the call data = endpoint(op) # Converting results to entities for p in (op + data).edges: print(p.node) # will return a ProductInfo entity ``` ``` -------------------------------- ### Example Staging Location Response - JSON Source: https://developer.shiphero.com/flows/wholesale-orders-packed-outside-shiphero This is an example JSON response when querying for available staging locations. ```json { "data": { "wholesale_staging_location_candidates": { "data": { "edges": [ { "node": { "id": "QmluOjI0MTYxMjY5", "name": "EAD_II_11" } } ] } } } } ``` -------------------------------- ### Vendor Create Mutation Response Example Source: https://developer.shiphero.com/examples This is an example response structure for the `vendor_create` mutation, showing the details of the newly created vendor. ```json { "data": { "vendor_create": { "request_id": "5d3fc85c0601361d5019d3eb", "complexity": 5, "vendor": { "id": "VmVuZG9yOjE1NjE4Nw==", "legacy_id": 156187, "name": "TestVendorCreate", "email": "testvendor@shiphero.com", "account_number": "11111111", "account_id": "QWNjb3VudDozODAx", "address": { "name": null, "address1": "2543 Duck St.", "address2": "Apt. 2", "city": "Oklahoma", "state": "Oklah", "country": "US", "zip": "73008", "phone": "5555555555" }, "currency": "USD", "default_po_note": "Default Note", "created_at": "2019-07-30T04:32:28+00:00" } } } } ``` -------------------------------- ### Example Response for Warehouse Products Query Source: https://developer.shiphero.com/examples This is an example JSON response structure for the `warehouse_products` query, illustrating the data format for product information within a warehouse. ```json { "data": { "warehouse_products": { "request_id": "5d3bdbbf69af712be6bacd5c", "complexity": 3, "data": { "edges": [ { "node": { "id": "UHJvZHVjdDoyODkxOTYyNjY=", "account_id": "QWNjb3VudDozODAx", "on_hand": 0, "inventory_bin": null, "reserve_inventory": 0, "reorder_amount": 1, "reorder_level": 0, "custom": false, "warehouse": { "id": "V2FyZWhvdXNlOjgwNzU=", "dynamic_slotting": false, "profile": "default" }, "product": { "id": "UHJvZHVjdEluZm86MjYyODc2NDA3", "name": "8th of LA Short Overalls- Ally Wash Large", "sku": "12258196226120" } }, "cursor": "YXJyYXljb25uZWN0aW9uOjA=" }, { "node": { "id": "UHJvZHVjdDoyODcxNTM4OTA=", "account_id": "QWNjb3VudDozODAx", "on_hand": 0, "inventory_bin": null, "reserve_inventory": 0, "reorder_amount": 1, "reorder_level": 0, "custom": false, "warehouse": { "id": "V2FyZWhvdXNlOjgwNzU=", "dynamic_slotting": false, "profile": "default" }, "product": { "id": "UHJvZHVjdEluZm86MjYyODc5NTI5", "name": "Deep Mint Ombre Hoodie X-Small", "sku": "12266021355592" } }, "cursor": "YXJyYXljb25uZWN0aW9uOjE=" } ] } } } } ``` -------------------------------- ### Example response for picks_per_day Source: https://developer.shiphero.com/examples The JSON response structure returned by the picks_per_day query. ```json { "data": { "picks_per_day": { "request_id": "5d3bd9ee370a8cb90b7a8013", "complexity": 101, "data": { "edges": [ { "node": { "id": "UGlja1Jlc3VsdDoxOTg0MzQ5OQ==", "user_id": "VXNlcjo5MTIz", "tote_id": "VG90ZToxMTk3OTc=", "line_item_id": "TGluZUl0ZW06Mjc4NDI2MDUw", "location_id": "QmluOjA=", "order_id": "T3JkZXI6OTU3MjQyNzk=", "order_number": "MO425", "user_first_name": "Tom", "user_last_name": "Wingord", "inventory_bin": null, "sku": "12347944271944", "quantity": 1, "picked_quantity": 1, "pick_type": null, "barcode_scanned": "No", "created_at": "2019-04-30T06:48:29+00:00" }, "cursor": "YXJyYXljb25uZWN0aW9uOjA=" }, { "node": { "id": "UGlja1Jlc3VsdDoxOTg0MzUwMg==", "user_id": "VXNlcjo5MTIz", "tote_id": "VG90ZToxMTk3OTc=", "line_item_id": "TGluZUl0ZW06Mjc4NDI2MDQ5", "location_id": "QmluOjA=", "order_id": "T3JkZXI6OTU3MjQyNzk=", "order_number": "MO425", "user_first_name": "Tom", "user_last_name": "Wingord", "inventory_bin": null, "sku": "12280811454536", "quantity": 1, "picked_quantity": 1, "pick_type": null, "barcode_scanned": "No", "created_at": "2019-04-30T06:48:32+00:00" }, "cursor": "YXJyYXljb25uZWN0aW9uOjE=" }, { "node": { "id": "UGlja1Jlc3VsdDoxOTg0MzUwOA==", "user_id": "VXNlcjo5MTIz", "tote_id": "VG90ZToxMTk3OTc=", "line_item_id": "TGluZUl0ZW06Mjc4NDI2MDQ3", "location_id": "QmluOjA=", "order_id": "T3JkZXI6OTU3MjQyNzk=", "order_number": "MO425", "user_first_name": "Tom", "user_last_name": "Wingord", "inventory_bin": null, "sku": "12838025822280", "quantity": 1, "picked_quantity": 1, "pick_type": null, "barcode_scanned": "No", "created_at": "2019-04-30T06:48:35+00:00" }, "cursor": "YXJyYXljb25uZWN0aW9uOjI=" } ] } } } } ``` -------------------------------- ### Webhook Enable Response Source: https://developer.shiphero.com/webhooks Example JSON response confirming that the webhook has been enabled. ```json { "data": { "webhook_enable": { "request_id": "60dd12525e4d76b3ee093d7e", "complexity": 5, "webhook": { "id": "QXBpV2ViaG9vazoxNjE0ODc4", "name": "Inventory Update", "enabled": true } } } } ``` -------------------------------- ### GraphQL Queries Source: https://developer.shiphero.com/getting-started Examples of common GraphQL queries, including fetching products and specific product details. ```APIDOC ## GraphQL Queries ### Description This section provides examples of how to perform queries against the GraphQL API. ### Queries #### Get All Products (Paginated) This query retrieves a list of products with pagination. ```graphql query { products { complexity request_id data(first: 10) { edges { node { id sku name warehouse_products { id warehouse_id on_hand } } } } } } ``` #### Get Product by SKU This query retrieves a specific product using its SKU. ```graphql query { product(sku: "some-sku") { complexity request_id data { id sku name warehouse_products { id warehouse_id on_hand } } } } ``` ### Parameters #### Query Parameters - **sort** (string) - Optional - Applicable for Connection Fields to sort results. Example: `"name, -price"`. - **analyze** (boolean) - Optional - Computes the complexity of the query without executing it. #### Connection Field Parameters - **first** (integer) - Optional - The number of results to retrieve from the beginning. - **last** (integer) - Optional - The number of results to retrieve from the end. *Note: If `first` and `last` are not provided, a default maximum of 100 results will be applied.* ### Response #### Success Response (200) The `BaseResponse` object is returned for all queries and mutations, containing: - **request_id** (string) - A unique identifier for the request. - **complexity** (integer) - The computed complexity of the query. - **data** (object) - The actual results of the query. This can be a Field, List, or Connection Field. ``` -------------------------------- ### Packs Per Day Query Response Example Source: https://developer.shiphero.com/examples This is an example JSON response for the packs_per_day GraphQL query, showing the structure of returned package details including shipment, warehouse, and order information. ```json { "data": { "packs_per_day": { "request_id": "5d3bd22669af712be6bacd54", "complexity": 101, "data": { "edges": [ { "node": { "id": "UGFja1Jlc3VsdDoyOTkwNDc0Nw==", "shipment_id": "U2hpcG1lbnQ6NTA3OTI2ODI=", "warehouse_id": "V2FyZWhvdXNlOjY1NDU=", "total_items": 1, "unique_items": 1, "barcodes_scanned": 0, "created_at": "2019-05-03T20:11:05+00:00", "order": { "id": "T3JkZXI6OTYwMzI2NjU=", "order_number": "MO451" } }, "cursor": "YXJyYXljb25uZWN0aW9uOjA=" }, { "node": { "id": "UGFja1Jlc3VsdDoyOTkwNTgzOQ==", "shipment_id": "U2hpcG1lbnQ6NTA3OTQxNzg=", "warehouse_id": "V2FyZWhvdXNlOjY1NDU=", "total_items": 2, "unique_items": 2, "barcodes_scanned": 0, "created_at": "2019-05-03T20:32:12+00:00", "order": { "id": "T3JkZXI6OTE3MDM5MTg=", "order_number": "MO335" } }, "cursor": "YXJyYXljb25uZWN0aW9uOjE=" }, { "node": { "id": "UGFja1Jlc3VsdDoyOTkwNjI5Mg==", "shipment_id": "U2hpcG1lbnQ6NTA3OTQ3MDU=", "warehouse_id": "V2FyZWhvdXNlOjY1NDU=", "total_items": 1, "unique_items": 1, "barcodes_scanned": 0, "created_at": "2019-05-03T20:40:52+00:00", "order": { "id": "T3JkZXI6OTU2NzQ1MTQ=", "order_number": "MO420" } }, "cursor": "YXJyYXljb25uZWN0aW9uOjI=" } ] } } } } ``` -------------------------------- ### Get Return Details Source: https://developer.shiphero.com/examples This section describes how to fetch detailed information about a specific return using the 'return' query. It includes the GraphQL query structure and an example of the expected JSON response. ```APIDOC ## GET /returns/{id} ### Description Retrieves detailed information about a specific return using its unique ID. ### Method GET ### Endpoint /returns/{id} ### Parameters #### Path Parameters - **id** (String) - Required - The unique identifier for the return. ### Request Example ```graphql query { return(id: "UmV0dXJuOjc1MzYyNA==") { request_id complexity data { id legacy_id account_id order_id reason status label_type label_cost total_items_expected total_items_received total_items_restocked cost_to_customer shipping_carrier shipping_method address { address1 address2 city state country zip } line_items { id line_item_id warehouse_id product_id return_id quantity condition } } } } ``` ### Response #### Success Response (200) - **request_id** (String) - The ID of the request. - **complexity** (Int) - The complexity score of the query. - **data** (Object) - Contains the detailed return information. - **id** (String) - The unique identifier for the return. - **legacy_id** (Int) - The legacy ID of the return. - **account_id** (String) - The ID of the associated account. - **order_id** (String) - The ID of the associated order. - **reason** (String) - The reason for the return. - **status** (String) - The current status of the return. - **label_type** (String) - The type of return label. - **label_cost** (String) - The cost of the return label. - **total_items_expected** (Int) - The total number of items expected for the return. - **total_items_received** (Int) - The total number of items received. - **total_items_restocked** (Int) - The total number of items restocked. - **cost_to_customer** (String) - The cost charged to the customer. - **shipping_carrier** (String) - The shipping carrier used for the return. - **shipping_method** (String) - The shipping method used for the return. - **address** (Object) - The return address details. - **address1** (String) - The first line of the address. - **address2** (String) - The second line of the address. - **city** (String) - The city of the address. - **state** (String) - The state of the address. - **country** (String) - The country of the address. - **zip** (String) - The zip code of the address. - **line_items** (Array) - A list of line items included in the return. - **id** (String) - The unique identifier for the line item. - **line_item_id** (String) - The legacy line item ID. - **warehouse_id** (String) - The ID of the warehouse. - **product_id** (String) - The ID of the product. - **return_id** (String) - The ID of the return this line item belongs to. - **quantity** (Int) - The quantity of the item. - **condition** (String) - The condition of the item. #### Response Example ```json { "data": { "return": { "request_id": "5f46b7577b7f0383ea23378e", "complexity": 1, "data": { "id": "UmV0dXJuOjEzMjkwMDE=", "legacy_id": 1329001, "account_id": "QWNjb3VudDo2MzM0", "order_id": "T3JkZXI6MTI3MTQ4NDU3", "reason": "Too small", "status": "warehouse complete", "label_type": "FREE", "label_cost": "0.00", "total_items_expected": 1, "total_items_received": 0, "total_items_restocked": 0, "cost_to_customer": "0.00", "shipping_carrier": "UPS", "shipping_method": "Ground", "address": { "address1": "55 W RAILROAD AVE", "address2": "BLDG 4", "city": "GARNERVILLE", "state": "NY", "country": "US", "zip": "10923-1261" }, "line_items": [ { "id": "UmV0dXJuSXRlbToyMTM4NTI4", "line_item_id": "TGluZUl0ZW06MzcwODgwNjMw", "warehouse_id": "V2FyZWhvdXNlOjExNzkw", "product_id": "UHJvZHVjdDozMDE3MDU0MzI=", "return_id": "UmV0dXJuOjEzMjkwMDE=", "quantity": 1, "condition": "Good" } ] } } } } ``` ``` -------------------------------- ### Order Status Response Source: https://developer.shiphero.com/flows/merge-orders Example response for an order query. ```json { "data": { "order": { "request_id": "691743275f2a04ad114163a9", "complexity": 32, "data": { "id": "T3JkZXI6NzA0MDExNjkw", "order_number": "custom-test-12", "fulfillment_status": "pending", "created_at": "2025-11-14T13:49:37", "updated_at": "2025-11-14T13:49:53", "merged_orders": [ { "order_id": "T3JkZXI6NzA0MDExOTY1", "is_master": false }, { "order_id": "T3JkZXI6NzA0MDEyMjUx", "is_master": false }, { "order_id": "T3JkZXI6NzA0MDEyNDc5", "is_master": false } ], "line_items": { "edges": [ { "node": { "sku": "ubik", "quantity": 2 } } ] } } } } } ``` -------------------------------- ### Webhook Creation Response Source: https://developer.shiphero.com/webhooks Example JSON response returned after successfully creating a webhook. ```json { "data": { "webhook_create": { "request_id": "60dd12525e4d76b3ee093d7d", "complexity": 5, "webhook": { "id": "QXBpV2ViaG9vazoxNjE0ODc4", "name": "Inventory Update", "url": "https://someValidURL.net/", "shop_name": "api", "enabled": true, "health": "HEALTHY", "created_at": "2025-01-15T10:30:00Z", "updated_at": "2025-01-15T10:30:00Z", "last_enabled_change": "2025-01-15T10:30:00Z", "shared_signature_secret": "b0b588622fb191c3d96c34c5f929fbae04b94e74" } } } } ``` -------------------------------- ### Customer Data Queries Source: https://developer.shiphero.com/graphql-primer Examples of GraphQL queries to retrieve customer information. ```APIDOC ## GraphQL Queries for Customer Data ### Description These GraphQL queries allow you to retrieve a list of customers associated with your account. ### Method POST ### Endpoint /graphql ### Request Body ```graphql query { account { data { customers { edges { node { id } } } } } } ``` ### Request Body ```graphql query { me { data { id email account { customers { edges { node { id } } } } } } } ``` ``` -------------------------------- ### Response for Create Return Mutation Source: https://developer.shiphero.com/examples Example JSON response after successfully creating a return. It includes request details and the created return object. ```json { "data": { "return_create": { "request_id": "5d547c8e47de2ba3e95322f3", "complexity": 10, "return": { "id": "UmV0dXJuOjc2MTQwMg==", "order_id": "T3JkZXI6MTAyMzYwNTcz", "reason": "No longer wants", "status": "pending", "label_type": "FREE", "label_cost": "1.00", "shipping_carrier": "UPS", "shipping_method": "UPS Ground", "address": { "name": null, "address1": "55 W RAILROAD AVE", "address2": "BLDG 4", "city": "GARNERVILLE", "state": "NY", "country": "US", "zip": "10923-1261", "phone": null }, "line_items": [ { "id": "UmV0dXJuSXRlbToxMjI1MzEw", "line_item_id": "TGluZUl0ZW06Mjk5Njc5OTEy", "product_id": "UHJvZHVjdDoyODI5NjA4MTU=", "quantity": 1, "reason": "No longer wants" } ], "created_at": "2019-08-14T21:26:38+00:00" } } } } ``` -------------------------------- ### Bill Creation Response Source: https://developer.shiphero.com/flows/3pl-billing Example JSON response returned after successfully executing the bill_create mutation. ```json { "data": { "bill_create": { "request_id": "618410c9dac8be5f60d8098a", "complexity": 1, "bill": { "id": "QmlsbDo1ODkxNQ==", "legacy_id": 58915, "status": "queued", "customer_name": "Child Account Nr2", "profile_name": "Test", "created_at": "2021-11-04T16:56:41", "due_date": null, "amount": "0.00", "totals": { "edges": [ { "node": { "id": "RmVlQ2F0ZWdvcnlUb3RhbDoxNzg2NzQ=", "legacy_id": 178674, "amount": "0.00", "label": null, "category": "recurring", "quantity": 0 } }, { "node": { "id": "RmVlQ2F0ZWdvcnlUb3RhbDoxNzg2NzU=", "legacy_id": 178675, "amount": "0.00", "label": null, "category": "order", "quantity": 0 } } ] }, "bill_exports": { "edges": [] }, "billing_period": { "start": "2021-11-01", "end": "2021-11-04" }, "billing_frequency": "monthly" } } } } ``` -------------------------------- ### Wholesale Order Input Variables Source: https://developer.shiphero.com/flows/wholesale Example JSON payload for the CreateWholesaleOrder mutation, including shipping, billing, and EDI-specific wholesale details. ```json { "data": { "order_number": "WO-12345", "partner_order_id": "WO-12345-pid", "shop_name": "B2B Channel", "order_date": "2025-12-09T00:00:00", "required_ship_date": "2025-12-15T00:00:00", "total_tax": "5.00", "total_discounts": "0.00", "total_price": "205.00", "currency": "USD", "email": "wholesale@example.com", "profile": "wholesale", "shipping_lines": { "title": "FREIGHT", "price": "25.00" }, "shipping_address": { "address1": "1000 Corporate Blvd", "city": "Los Angeles", "state": "CA", "country": "US", "zip": "90210", "first_name": "Warehouse", "last_name": "Manager" }, "billing_address": { "address1": "1000 Corporate Blvd", "city": "Los Angeles", "state": "CA", "country": "US", "zip": "90210", "first_name": "Warehouse", "last_name": "Manager" }, "line_items": [ { "sku": "PRODUCT-123", "partner_line_item_id": "LINE-PRODUCT-123", "quantity": 10, "price": "18.00", "quantity_pending_fulfillment": 10, "warehouse_id": "129172" } ], "wholesale_shipping_details": { "carrier": "freight_company", "shipping_method": "ltl", "pro_number": "PRO123456", "trailer_number": "TRL789012", "bill_of_lading": "BOL345678", "cost": 150 }, "picking_flow": "DESKTOP", "shipping_option": "FREIGHT", "gs1_labels_required": true, "trading_partner_id": "TARGET001", "trading_partner_name": "Target Corporation", "department": "APPAREL", "store_location_number": "1234" } } ``` -------------------------------- ### Order API Response Example Source: https://developer.shiphero.com/examples The JSON structure returned by the order query, containing the requested order details and metadata. ```json { "data": { "order": { "request_id": "624ed20433a41fbf119fb950", "complexity": 3, "data": { "id": "T3JkZXI6MTAwNTc0MjM1", "legacy_id": 100574235, "order_number": "MO519", "shop_name": "Manual Order", "fulfillment_status": "TESTING", "order_date": "2019-07-16T14:46:03", "profile": "default", "tote_qa": false, "required_ship_date": "2019-07-18T00:00:00", "shipping_lines": { "carrier": "amazon", "method": "99", "price": null }, "shipping_address": { "first_name": "Aaron", "last_name": "Rubin", "address1": "55 W RAILROAD AVE BLDG 4", "address2": "", "city": "GARNERVILLE", "state": "NY", "state_code": null, "zip": "10923-1261", "country": "US" }, "tags": [], "line_items": { "edges": [ { "node": { "id": "TGluZUl0ZW06Mjk0MDc2OTEw", "sku": "leandro-build-kit", "quantity": 1, "product_name": "Leandro Build Kit", "fulfillment_status": "broken_in_sets", "quantity_allocated": 0, "backorder_quantity": 0, "barcode": "1563302685" }, "cursor": "YXJyYXljb25uZWN0aW9uOjA=" }, { "node": { "id": "TGluZUl0ZW06Mjk0MDc2OTI0", "sku": "regular-kit-item-1", "quantity": 1, "product_name": "Regular Kit Item 1", "fulfillment_status": "pending", "quantity_allocated": 0, "backorder_quantity": 1, "barcode": "1563218450" }, "cursor": "YXJyYXljb25uZWN0aW9uOjE=" } ] }, "allocations": [ { "warehouse_id": "V2FyZWhvdXNlOjY1NDU=", "allocated_at": "2020-09-03T20:24:39", "allocation_reference": "UGVuZGluZ1NoaXBtZW50OjI1NDI4MjU2OA==", "line_items": [ { "line_item_id": "TGluZUl0ZW06Mjk0MDc2OTI4", "sku": "regular-kit-item-2", "quantity_allocated": 1, "is_kit_component": false, "warehouse_id": "V2FyZWhvdXNlOjY1NDU=", "allocated_at": "2020-09-03T20:24:39", "allocation_reference": "UGVuZGluZ1NoaXBtZW50TGluZUl0ZW06NTM4MTU1MTQ5" } ] } ], "shipments": [], "returns": [] } } } } ``` -------------------------------- ### POST wholesale_set_as_ready_to_pick Source: https://developer.shiphero.com/flows/wholesale-orders-packed-outside-shiphero Transitions the wholesale order status to ready_to_pick. ```APIDOC ## POST wholesale_set_as_ready_to_pick ### Description Updates the order status to indicate it is ready for the picking process. ### Method POST (GraphQL Mutation) ### Request Body - **data** (object) - Required - Contains order_id. ``` -------------------------------- ### GET /webhooks Source: https://developer.shiphero.com/webhooks Retrieves a list of all webhooks registered to the account. ```APIDOC ## GET webhooks ### Description Fetches all webhooks currently registered to the user account, including their status, health, and configuration details. ### Method GET ### Request Example query { webhooks { request_id complexity data { edges { node { id name enabled health url } } } } } ``` -------------------------------- ### Python API Request with sgqlc Source: https://developer.shiphero.com/graphql-primer Example of making a GraphQL request using the `sgqlc` library in Python after generating schema and types. This code demonstrates building a query for products and printing the results. ```python from sgqlc.operation import Operation from sgqlc.endpoint.http import HTTPEndpoint from sh_public_api_schema import sh_public_api_schema as schema endpoint = HTTPEndpoint( 'http://http://public-api.shiphero.com/graphql', base_headers={'Authorization': 'Bearer YOUR_TOKEN'} ) # Build the query op = Operation(schema.Query) # Building the products query ps = op.products() # Make sure to request the complexity and request_id ps.complexity() ps.request_id() # Get the first 10 and define the selections p_data = ps.data(first=10) p_data.edges.node.sku() p_data.edges.node.id() # Executing the call data = endpoint(op) # Converting results to entities for p in (op + data).edges: print(p.node) # will return a ProductInfo entity ``` -------------------------------- ### GET wholesale_order Source: https://developer.shiphero.com/flows/wholesale-orders-packed-outside-shiphero Retrieves the current state and details of a wholesale order. ```APIDOC ## GET wholesale_order ### Description Retrieves the final state and details of a wholesale order to verify its status. ### Method GET ### Query Parameters - **order_id** (string) - Required - The unique identifier of the wholesale order. ### Request Example query { wholesale_order(order_id: "T3JkZXI6Njg2MzAwMDEz") { request_id data { id status picking_flow staging_location_id order { order_number fulfillment_status } } } } ``` -------------------------------- ### Build a Kit using kit_build Mutation Source: https://developer.shiphero.com/examples Use the `kit_build` mutation to create a kit. Components must exist in the specified warehouse. `kit_build` determines if it's a build kit. ```graphql mutation { kit_build( data: { sku: "KitSKU" components: [ { sku: "Component1", quantity: 1 } { sku: "Component2", quantity: 1 } ] kit_build: false warehouse_id: "V2FyZW4junNlOjY1NDU=" } ) { request_id complexity product { id sku components { id sku } } } } ``` -------------------------------- ### Order Create Line Item with Custom Options Source: https://developer.shiphero.com/examples Example of how to format line items with custom options when creating an order. Ensure all keys are included if updating. ```graphql line_items: [ { partner_line_item_id: "TEST-EN-8550-1A" sku: "3004022005228" quantity: 1 price: "14.99" product_name: "Test product name" custom_options: { key1: "foo", key2: "bar", key3: "baz" } } ] ``` ```graphql line_items: [ { id: "4357356783" custom_options: { key1: "foo", key2: "bar", key3: "newvalue" } } ] ``` -------------------------------- ### GET wholesale_staging_location_candidates Source: https://developer.shiphero.com/flows/wholesale-orders-packed-outside-shiphero Retrieves a list of available staging locations for a specific warehouse. ```APIDOC ## GET wholesale_staging_location_candidates ### Description Fetches available staging bins to be used for wholesale order processing. ### Method GET (GraphQL Query) ### Parameters #### Query Parameters - **warehouse_id** (string) - Required - The ID of the warehouse to query. ### Response #### Success Response (200) - **data** (object) - Contains a list of available staging locations (edges/nodes). ``` -------------------------------- ### Create a Return using return_create Mutation Source: https://developer.shiphero.com/flows/returns Initiate a return process with the `return_create` mutation. Provide detailed information about the order, warehouse, return reason, shipping, and item specifics. Set `create_label` to `false` if a return label is not immediately required. ```graphql mutation { return_create( data: { order_id: "117384888" warehouse_id: "6545" return_reason: "Too small" label_type: FREE label_cost: "0.00" display_issue_refund: true address: { name: "Customer Example" address1: "55 W RAILROAD AVE" address2: "" city: "GARNERVILLE" state: "NY" country: "US" zip: "10923-1261" phone: "55555555555" } dimensions: { height: "1.00" width: "1.00" length: "1.00" weight: "1.00" } shipping_carrier: "UPS" shipping_method: "Ground" line_items: { sku: "10044334339" quantity: 1 return_reason: "Too small" condition: "Good" } tracking_number: "14322345667" create_label: false partner_id: "MO721" } ) { request_id complexity return { id legacy_id } } } ``` -------------------------------- ### POST /webhook_enable Source: https://developer.shiphero.com/webhooks Enables a previously disabled webhook to start receiving events. ```APIDOC ## POST webhook_enable ### Description Enables a disabled webhook so it can start receiving events immediately. ### Method POST (GraphQL Mutation) ### Parameters - **webhook_id** (String) - Required - The unique identifier of the webhook to enable ### Request Example mutation { webhook_enable( data: { webhook_id : "QXBpV2ViaG9vazoxNjE0ODc4" } ) { request_id complexity webhook { id name enabled } } } ``` -------------------------------- ### mutation product_create Source: https://developer.shiphero.com/examples Creates a new product in the system with specified attributes and warehouse settings. ```APIDOC ## mutation product_create ### Description Creates a new product record including dimensions, barcode, and initial warehouse product settings. ### Method POST (GraphQL Mutation) ### Request Body - **name** (String) - Required - Product name. - **sku** (String) - Required - Product SKU. - **warehouse_products** (Object) - Required - Initial warehouse settings. - **barcode** (String) - Optional - Product barcode. - **dimensions** (Object) - Optional - Weight, height, width, length. ### Request Example mutation { product_create( data: { name: "wood chair" sku: "123woodchair" warehouse_products: { warehouse_id: "V2FyZWhvdXNlOjY1NDU=" on_hand: 130 } } ) { request_id complexity product { id name sku } } } ```