# Shipment Create Mutation is not working

**URL:** <https://community.shiphero.com/t/shipment-create-mutation-is-not-working/1771>\
**Category:** GraphQL API\
**Created:** [December 23, 2021, 5:02pm UTC](https://community.shiphero.com/t/shipment-create-mutation-is-not-working/1771 "2021-12-23T17:02:07Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![JMMTech](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@JMMTech](https://community.shiphero.com/u/JMMTech)\
**Post date:** [December 23, 2021, 5:02pm UTC](https://community.shiphero.com/t/shipment-create-mutation-is-not-working/1771/1 "2021-12-23T17:02:08Z")

</div>

Hello Everyone, I’m trying to create a shipment using the shipment\_create mutation but I’m getting the error, **address is invalid**. I also tried different addresses but all time I have the same error. Following is the link that I’m following to create a shipment.  
[https://developer.shiphero.com/order-fulfillment/](https://developer.shiphero.com/order-fulfillment/)

my mutation looks like below

```auto
mutation($data: CreateShipmentInput!) {
  shipment_create(data: $data) {
    request_id
    complexity
    shipment{
      id
    }
  }
}

```

and the variables are as follows

```auto
{
  "data": {
      "customer_account_id": "QWNj........",
      "order_id": "T3JkZX.............",
  "warehouse_id": "V2FyZWhvd......",
  "address": {
    "name": "John",
    "address1": "2543 Johnson St.",
    "address2": "",
    "city": "Oklahoma",
    "country": "US",
    "phone": "5555555555"
  },
  "line_items": [{ "line_item_id": "TGluZUl0ZW06NDA5MjA2ODkw", "quantity": 1 }],
  "labels": {
    "address": {
    "name": "John",
    "address1": "2545 Johnson St.",
    "address2": "",
    "city": "lo",
    "country": "US",
    "phone": "5555555555"
    },
    "carrier": "Generic",
    "shipping_name": "Generic",
    "shipping_method": "Generic",
    "cost": "0.00",
    "dimensions": { "weight": "0", "height": "0", "width": "0", "length": "0" },
    "label": {
      "paper_pdf_location": "https://ws.aramex.net/content/rpt_cache/b2878efbeb6c48bd8c9bdc364cff5882.pdf"
    },
    "line_item_ids": ["TGluZUl0ZW06NDA5MjA2ODkw"],
    "tracking_number": "1234434242444444434"
  },
  "notify_customer_via_shiphero": true,
  "notify_customer_via_store": true
  }
}

```

I’m getting the following error

```auto
{
  "errors": [
    {
      "message": "Variable \"$data\" got invalid value {\"address\": {\"address1\": \"2543 Johnson St.\", \"address2\": \"\", \"city\": \"Oklahoma\", \"country\": \"US\", \"name\": \"John\", \"phone\": \"5555555555\"}, \"customer_account_id\": \"QWNjb3VudDo2MjczMQ==\", \"labels\": {\"address\": {\"address1\": \"2543 Johnson St.\", \"address2\": \"\", \"city\": \"Oklahoma\", \"country\": \"US\", \"name\": \"John\", \"phone\": \"5555555555\"}, \"carrier\": \"Generic\", \"cost\": \"0.00\", \"dimensions\": {\"height\": \"0\", \"length\": \"0\", \"weight\": \"0\", \"width\": \"0\"}, \"label\": {\"paper_pdf_location\": \"https://ws.aramex.net/content/rpt_cache/b2878efbeb6c48bd8c9bdc364cff5882.pdf\"}, \"line_item_ids\": [\"TGluZUl0ZW06NDA5MjA2ODkw\"], \"shipping_method\": \"Generic\", \"shipping_name\": \"Generic\", \"tracking_number\": \"1234434242444444434\"}, \"line_items\": [{\"line_item_id\": \"TGluZUl0ZW06NDA5MjA2ODkw\", \"quantity\": 1}], \"notify_customer_via_shiphero\": true, \"notify_customer_via_store\": true, \"order_id\": \"T3JkZXI6MjAxNTYyNDEz\", \"warehouse_id\": \"V2FyZWhvdXNlOjc0NTUw\"}.\nIn field \"labels\": In element #0: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #1: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #2: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #3: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #4: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #5: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #6: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #7: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #8: Expected \"CreateShipmentShippingLabelInput\", found not an object.",
      "locations": [
        {
          "line": 1,
          "column": 10
        }
      ]
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![Theresa](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/theresa/32/377_2.png) [@Theresa](https://community.shiphero.com/u/Theresa)\
**Post date:** [December 23, 2021, 5:50pm UTC](https://community.shiphero.com/t/shipment-create-mutation-is-not-working/1771/2 "2021-12-23T17:50:56Z")

</div>

Hi @JMMTech ,  
Please try again where the address checks against [ZIP Code™ Lookup | USPS](https://tools.usps.com/zip-code-lookup.htm) as valid. If it is still giving you an error with the valid address, post the request id and we can take a closer look.  
Best,  
Theresa

---

<div class="post-metadata">

**Author:** ![JMMTech](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@JMMTech](https://community.shiphero.com/u/JMMTech)\
**Post date:** [December 23, 2021, 8:35pm UTC](https://community.shiphero.com/t/shipment-create-mutation-is-not-working/1771/3 "2021-12-23T20:35:27Z")

</div>

@Theresa thanks for your kind response.  
Can you please let me know what is the **request id**?? If the request is successful then we get the **request id** but in case of request is failed we don’t have any **request id**.

I have tried the following US address and confirmed from the link you shared in the comment above,

```auto
  "name": "John",
          "address1": "17906 Village Branch Ln",
          "address2": "",
          "city": "HOUSTON",
          "state": "TX",
          "zip": "77407",
          "country": "US",
          "phone": "+12813938447"

```

But still, I have the following error

```auto
message": "Variable \"$data\" got invalid value

```

But, in our case, we will not use US-based addresses. We want to use Saudi Arabia addresses, can you please guide or let us the way how we can use our Saudi Arabia address to create a shipment using **shipment\_create mutation**.

---

<div class="post-metadata">

**Author:** ![JMMTech](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@JMMTech](https://community.shiphero.com/u/JMMTech)\
**Post date:** [December 23, 2021, 8:37pm UTC](https://community.shiphero.com/t/shipment-create-mutation-is-not-working/1771/4 "2021-12-23T20:37:11Z")

</div>

@Theresa below is the screenshot and in the middle column you can see the error object,  
I’m also attaching the whole error object

 ![Screenshot 2021-12-24 at 1.35.56 AM](https://us1.discourse-cdn.com/flex020/uploads/shiphero/original/1X/29059e65a624e899f032905f3b47ba0881cf3825.jpeg)

```auto
{
  "errors": [
    {
      "message": "Variable \"$data\" got invalid value {\"address\": {\"address1\": \"17906 Village Branch Ln\", \"address2\": \"\", \"city\": \"HOUSTON\", \"country\": \"US\", \"name\": \"John\", \"phone\": \"+12813938447\", \"state\": \"TX\", \"zip\": \"77407\"}, \"customer_account_id\": \"QWNjb3VudDo2MjczMQ==\", \"labels\": {\"address\": {\"address1\": \"17906 Village Branch Ln\", \"address2\": \"\", \"city\": \"HOUSTON\", \"country\": \"US\", \"name\": \"John\", \"phone\": \"+12813938447\", \"state\": \"TX\", \"zip\": \"77407\"}, \"carrier\": \"Generic\", \"cost\": \"0.00\", \"dimensions\": {\"height\": \"0\", \"length\": \"0\", \"weight\": \"0\", \"width\": \"0\"}, \"label\": {\"paper_pdf_location\": \"https://ws.aramex.net/content/rpt_cache/b2878efbeb6c48bd8c9bdc364cff5882.pdf\"}, \"line_item_ids\": [\"TGluZUl0ZW06NDA5MjA2ODkw\"], \"shipping_method\": \"Generic\", \"shipping_name\": \"Generic\", \"tracking_number\": \"1234434242444444434\"}, \"line_items\": [{\"line_item_id\": \"TGluZUl0ZW06NDA5MjA2ODkw\", \"quantity\": 1}], \"notify_customer_via_shiphero\": true, \"notify_customer_via_store\": true, \"order_id\": \"T3JkZXI6MjAxNTYyNDEz\", \"warehouse_id\": \"V2FyZWhvdXNlOjc0NTUw\"}.\nIn field \"labels\": In element #0: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #1: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #2: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #3: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #4: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #5: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #6: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #7: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #8: Expected \"CreateShipmentShippingLabelInput\", found not an object.",
      "locations": [
        {
          "line": 1,
          "column": 10
        }
      ]
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![Theresa](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/theresa/32/377_2.png) [@Theresa](https://community.shiphero.com/u/Theresa)\
**Post date:** [December 23, 2021, 9:20pm UTC](https://community.shiphero.com/t/shipment-create-mutation-is-not-working/1771/5 "2021-12-23T21:20:46Z")

</div>

Hi @JMMTech

Can you try it again with the variables in the mutation? It will be a little bit more straight forward to look into. Thanks in advance!

Best,  
Theresa

---

<div class="post-metadata">

**Author:** ![JMMTech](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@JMMTech](https://community.shiphero.com/u/JMMTech)\
**Post date:** [December 23, 2021, 9:43pm UTC](https://community.shiphero.com/t/shipment-create-mutation-is-not-working/1771/6 "2021-12-23T21:43:58Z")

</div>

@Theresa I have picked the **shipment\_create** mutation from the following link  
[https://developer.shiphero.com/order-fulfillment/](https://developer.shiphero.com/order-fulfillment/)

and placed the values using **variables** and even I haven’t removed any attribute from the following code snippet, the code snippet below is also taken from the above link

```auto
mutation {
  shipment_create(
    data: {
      order_id: "T3JkZXI6MTQzNDE2NDY3"
      warehouse_id: "V2FyZWhvdXNlOjExNzkw"
      address: {
        name: "John"
        address1: "2543 Johnson St."
        address2: "Apt. 2"
        city: "Oklahoma"
        state: "Oklahoma"
        zip: "73008"
        country: "US"
        phone: "5555555555"
      }
      line_items: { line_item_id: "TGluZUl0ZW06NDA5MjA2ODkw", quantity: 1 }
      labels: {
        address: {
          name: "John"
          address1: "2543 Johnson St."
          address2: "Apt. 2"
          city: "Oklahoma"
          state: "Oklahoma"
          zip: "73008"
          country: "US"
          phone: "5555555555"
        }
        carrier: "UPS"
        shipping_name: "UPS - Ground"
        shipping_method: "Ground"
        cost: "0.00"
        dimensions: { weight: "12", height: "12", width: "12", length: "12" }
        label: {
          paper_pdf_location: "https://d2kghplsj0vn8x.cloudfront.net/prod/shipping-labels/2020/08/21/6ea5c0ba88f63dbf3eb8d7e6380f1811491d39da902d1d63a4f13af81bd98040/143071030/2fiu8_3c.pdf"
        }
        line_item_ids: "TGluZUl0ZW06NDA5MjA2ODkw"
        tracking_number: "1234434242444444434"
      }
      notify_customer_via_shiphero: true
      notify_customer_via_store: true
    }
  ) {
    request_id
    complexity
  }
}

```

---

<div class="post-metadata">

**Author:** ![JMMTech](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@JMMTech](https://community.shiphero.com/u/JMMTech)\
**Post date:** [December 23, 2021, 9:46pm UTC](https://community.shiphero.com/t/shipment-create-mutation-is-not-working/1771/7 "2021-12-23T21:46:15Z")

</div>

@Theresa as you can see in the right column, we are following the variables information from there and not using any extra variable

 ![Screenshot 2021-12-24 at 2.46.43 AM](https://us1.discourse-cdn.com/flex020/uploads/shiphero/original/1X/f5da558ab24e6ddc760a2c401c09c25a30b0667d.jpeg)

---

<div class="post-metadata">

**Author:** ![tomasfd](https://avatars.discourse-cdn.com/v4/letter/t/5daacb/32.png) [@tomasfd](https://community.shiphero.com/u/tomasfd)\
**Post date:** [December 24, 2021, 5:59pm UTC](https://community.shiphero.com/t/shipment-create-mutation-is-not-working/1771/8 "2021-12-24T17:59:17Z")

</div>

Hello @JMMTech!  
Could you please try using a variable for each field instead of sending the whole query as a variable?  
Have a nice day!  
TomasFD

---

<div class="post-metadata">

**Author:** ![JMMTech](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@JMMTech](https://community.shiphero.com/u/JMMTech)\
**Post date:** [December 24, 2021, 8:13pm UTC](https://community.shiphero.com/t/shipment-create-mutation-is-not-working/1771/9 "2021-12-24T20:13:33Z")

</div>

@tomasfd we are using the **Altair** tool recommended by the official docs of **Ship Hero**. If we will declare a mutation in wrong way then the **Altair** tool will give the error on the spot and will underline that line with red color.

We are not sending the whole query as a variable. Can you please share this code with one of your developer then he will let you know that either we are doing wrong or right.

---

<div class="post-metadata">

**Author:** ![JMMTech](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@JMMTech](https://community.shiphero.com/u/JMMTech)\
**Post date:** [December 27, 2021, 5:24pm UTC](https://community.shiphero.com/t/shipment-create-mutation-is-not-working/1771/10 "2021-12-27T17:24:27Z")

</div>

@tomasfd @Theresa will you please give me a response on above? I’m waiting for your response.

---

<div class="post-metadata">

**Author:** ![tomasfd](https://avatars.discourse-cdn.com/v4/letter/t/5daacb/32.png) [@tomasfd](https://community.shiphero.com/u/tomasfd)\
**Post date:** [December 29, 2021, 7:33pm UTC](https://community.shiphero.com/t/shipment-create-mutation-is-not-working/1771/11 "2021-12-29T19:33:45Z")

</div>

Hello @JMMTech!  
We are still working on this. I will let you know as soon as I have an update.  
Kind regards,  
TomasFD

---

<div class="post-metadata">

**Author:** ![JMMTech](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@JMMTech](https://community.shiphero.com/u/JMMTech)\
**Post date:** [January 3, 2022, 6:22pm UTC](https://community.shiphero.com/t/shipment-create-mutation-is-not-working/1771/12 "2022-01-03T18:22:34Z")

</div>

@tomasfd any update??

---

<div class="post-metadata">

**Author:** ![tomasfd](https://avatars.discourse-cdn.com/v4/letter/t/5daacb/32.png) [@tomasfd](https://community.shiphero.com/u/tomasfd)\
**Post date:** [January 4, 2022, 2:08pm UTC](https://community.shiphero.com/t/shipment-create-mutation-is-not-working/1771/13 "2022-01-04T14:08:10Z")

</div>

Hello @JMMTech!  
Apologies for the late answer.  
Can you try the following for your variable, please?

```auto
  {
  "data": {
    "customer_account_id": "QWNj........",
    "order_id": "T3JkZX.............",
    "warehouse_id": "V2FyZWhvd......",
    "address": {
      "name": "John",
      "address1": "2543 Johnson St.",
      "city": "Oklahoma",
      "country": "US",
      "phone": "5555555555"
    },
    "line_items": [{ "line_item_id": "TGluZUl0ZW06NDA5MjA2ODkw", "quantity": 1 }],
    "labels": [{
      "address": {
        "name": "John",
        "address1": "2545 Johnson St.",
        "address2": "",
        "city": "lo",
        "country": "US",
        "phone": "5555555555"
      },
      "carrier": "Generic",
      "shipping_name": "Generic",
      "shipping_method": "Generic",
      "cost": "0.00",
      "dimensions": { "weight": "0", "height": "0", "width": "0", "length": "0" },
      "label": {
        "paper_pdf_location": "https://ws.aramex.net/content/rpt_cache/b2878efbeb6c48bd8c9bdc364cff5882.pdf"
      },
      "line_item_ids": ["TGluZUl0ZW06NDA5MjA2ODkw"],
      "tracking_number": "1234434242444444434"
    }],
    "notify_customer_via_shiphero": true,
    "notify_customer_via_store": true
  }
}

```

If you didn’t notice, I added the brackets in the `labels` input, just as you had done with `line_items.`  
When working with nested inputs in variables, the value of the input field should be between brackets.  
Please let me know if this doesn’t help.  
Have a nice day!  
TomasFD
