Shipment_create mutation issue with line_item_ids , line_items fields

I’m having an issue creating a shipment.

I’m getting the following errors:

{
  "errors": [
    {
      "message": "Field 'CreateShipmentInput.line_items' of required type '[CreateShipmentLineItemInput]!' was not provided.",
      "locations": [
        {
          "line": 35,
          "column": 11
        }
      ]
    },
    {
      "message": "Field 'line_items' is not defined by type 'CreateShipmentShippingLabelInput'. Did you mean 'line_item_ids'?",
      "locations": [
        {
          "line": 70,
          "column": 9
        }
      ]
    }
  ]
}

And I have no idea what line_item_ids it’s because it doesn’t appear in the schema documentation CreateShipmentInput | ShipHero GraphQL API
And then I’m getting erros for putting line_items which is the one in the schema, so I have no idea what to add.

This is my payload

mutation Shipment_create(
  $customer_account_id: String
  $order_id: String!
  $warehouse_id: String!
  $name: String
  $address1: String
  $address2: String
  $city: String
  $state: String
  $country: String
  $zip: String
  $carrier: String!
  $shipping_name: String!
  $shipping_method: String!
  $cost: String!
  $address_name: String
  $address_address1: String
  $address_address2: String
  $address_city: String
  $address_state: String
  $address_country: String
  $address_zip: String
  $weight: String
  $height: String
  $width: String
  $length: String
  $pdf_location: String
  # $line_item_ids: [String]!
  $tracking_number: String
  $tracking_url: String
  $notify_customer_via_shiphero: Boolean
  $notify_customer_via_store: Boolean
) {
  shipment_create(
    data: {
      customer_account_id: $customer_account_id
      order_id: $order_id
      warehouse_id: $warehouse_id
      address: {
        name: $name
        address1: $address1
        address2: $address2
        city: $city
        state: $state
        country: $country
        zip: $zip
      }
      labels: {
        carrier: $carrier
        shipping_name: $shipping_name
        shipping_method: $shipping_method
        cost: $cost
        address: {
          name: $address_name
          address1: $address_address1
          address2: $address_address2
          city: $address_city
          state: $address_state
          country: $address_country
          zip: $address_zip
        }
        dimensions: {
          weight: $weight
          height: $height
          width: $width
          length: $length
        }
        label: { pdf_location: $pdf_location }
        line_item_ids: ["UHJvZHVjdEluZm86MzM1MzMwNDYz"]
        line_items: [{ line_item_id: "UHJvZHVjdEluZm86MzM1MzMwNDYz", quantity: 3}]
        tracking_number: $tracking_number
        tracking_url: $tracking_url
      }
      notify_customer_via_shiphero: $notify_customer_via_shiphero
      notify_customer_via_store: $notify_customer_via_store
    }
  ) {
    request_id
    complexity
    shipment {
      id
      order_id
    }
  }
}

Hi @kevchcm! I hope you are doing well,

I looked into this and the two errors come from mixing up two fields that look similar but live at different levels of the input.

line_items (required, top-level of data)

CreateShipmentInput.line_items is required and describes what’s being shipped in this shipment overall: [{ line_item_id, quantity }]. It needs to be a sibling of order_id, warehouse_id, address, and labels, not nested inside labels. That’s the first error: line_items was missing from the top level.

line_item_ids (inside each labels entry)

CreateShipmentShippingLabelInput doesn’t have a line_items field, only line_item_ids, a plain list of ID strings. This says which of the shipment’s line items go on that specific package/label. If your shipment has one package, this list ends up matching line_items in content, just as IDs instead of objects. That’s the second error: line_items doesn’t exist on that type, hence the “did you mean line_item_ids” hint.

Worth noting: line_item_ids is documented in the schema, it’s just easy to miss since it’s on a different type than the one you’d expect. You can find it on the CreateShipmentShippingLabelInput page in the schema reference, or by introspecting that type directly if you’re browsing the schema in a GraphQL client like Postman or GraphiQL.

Corrected shape:

shipment_create(
  data: {
    order_id: $order_id
    warehouse_id: $warehouse_id
    address: { ... }
    line_items: [{ line_item_id: $line_item_id, quantity: $quantity }] HERE!!!
    labels: {
      carrier: $carrier
      shipping_name: $shipping_name
      shipping_method: $shipping_method
      cost: $cost
      address: { ... }
      dimensions: { ... }
      label: { pdf_location: $pdf_location }
      line_item_ids: [$line_item_id]
      tracking_number: $tracking_number
      tracking_url: $tracking_url
    }
  }
) { ... }

One more thing worth checking on your end: the line_item_id you used (UHJvZHVjdEluZm86MzM1MzMwNDYz) decodes to a ProductInfoID, not a LineItemID. line_item_id needs the line item ID from the order (the one you get from order.line_items or orders.line_items), not a productID. Even after fixing the structure above, that specific ID would likely fail with a not-found error. Worth double-checking where you’re sourcing that ID from before retrying.

I hope this helps! If you have any questions, don’t hesitate and ask!

Best regards, Luciano.