# Error deleting product through API

**URL:** <https://community.shiphero.com/t/error-deleting-product-through-api/2377>\
**Category:** GraphQL API\
**Created:** [February 27, 2023, 8:39pm UTC](https://community.shiphero.com/t/error-deleting-product-through-api/2377 "2023-02-27T20:39:21Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![marioreinike](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@marioreinike](https://community.shiphero.com/u/marioreinike)\
**Post date:** [February 27, 2023, 8:39pm UTC](https://community.shiphero.com/t/error-deleting-product-through-api/2377/1 "2023-02-27T20:39:21Z")

</div>

Hi Team!

I don’t know what’s happening to the mutation `product_delete`, but it is not working for me. I tried to make the request and it is returning “Unexpected Error”. Can I get some help to understand what is the problem here?

Thanks!

```json
{
  "errors": [
    {
      "message": "Unexpected Error",
      "operation": "product_delete",
      "field": "product_delete",
      "request_id": "63fd1263843e0698a55c81ec",
      "code": 22
    }
  ],
  "data": {
    "product_delete": null
  },
  "extensions": {
    "throttling": {
      "estimated_complexity": 10,
      "cost": 10,
      "cost_detail": {
        "product_delete": {
          "items_count": 0,
          "cost": 10,
          "total_cost": 10,
          "fields": {}
        }
      },
      "user_quota": {
        "credits_remaining": 2002,
        "max_available": 2002,
        "increment_rate": 30
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![sh-agent](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@sh-agent](https://community.shiphero.com/u/sh-agent)\
**Post date:** [February 27, 2023, 9:05pm UTC](https://community.shiphero.com/t/error-deleting-product-through-api/2377/2 "2023-02-27T21:05:43Z")

</div>

Hey @marioreinike,

Thanks for reaching out!  
Looking into this issue now, I’ll update you shortly.

Best,  
RayanP

---

<div class="post-metadata">

**Author:** ![sh-agent](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@sh-agent](https://community.shiphero.com/u/sh-agent)\
**Post date:** [March 1, 2023, 12:29pm UTC](https://community.shiphero.com/t/error-deleting-product-through-api/2377/3 "2023-03-01T12:29:18Z")

</div>

Hey @marioreinike,

Thanks for hanging in there!

Are you using the 3PL token when making that call?

For an action like product delete, the change must be made with the child accounts token. This is because the ownership of the product lies in the child account.

Please let me know if you have any questions or concerns.

Best,  
RayanP

---

<div class="post-metadata">

**Author:** ![marioreinike](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@marioreinike](https://community.shiphero.com/u/marioreinike)\
**Post date:** [March 1, 2023, 1:33pm UTC](https://community.shiphero.com/t/error-deleting-product-through-api/2377/4 "2023-03-01T13:33:52Z")

</div>

Yes, I’m always using the child accounts for all requests!

---

<div class="post-metadata">

**Author:** ![marioreinike](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@marioreinike](https://community.shiphero.com/u/marioreinike)\
**Post date:** [March 1, 2023, 1:51pm UTC](https://community.shiphero.com/t/error-deleting-product-through-api/2377/5 "2023-03-01T13:51:38Z")

</div>

@sh-agent

I don’t know what is the problem here but we need to delete it! Here you can see the request that I’m doing (It is the same as every other product and only this one is not working):

```json
{
  "query": "\nmutation product_delete($data: DeleteProductInput!) {\n product_delete(data: $data) {\n request_id\n complexity\n }\n}",
  "variables": {
    "data": {
      "customer_account_id": "70271",
      "sku": "MAD-MCO208"
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![marioreinike](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@marioreinike](https://community.shiphero.com/u/marioreinike)\
**Post date:** [March 1, 2023, 1:52pm UTC](https://community.shiphero.com/t/error-deleting-product-through-api/2377/6 "2023-03-01T13:52:33Z")

</div>

The thing is that I don’t want to delete it from Shiphero UI because that is a **soft delete** and it won’t let me create another product with the same SKU.

---

<div class="post-metadata">

**Author:** ![sh-agent](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@sh-agent](https://community.shiphero.com/u/sh-agent)\
**Post date:** [March 1, 2023, 2:38pm UTC](https://community.shiphero.com/t/error-deleting-product-through-api/2377/7 "2023-03-01T14:38:04Z")

</div>

Hey @marioreinike,

Thanks for the additional information.

I’ll have to go ahead and escalate this one to our Engineering Team. I’ll keep you updated with our findings going forward.

Please let me know if you have any questions or concerns.

Best,  
RayanP

---

<div class="post-metadata">

**Author:** ![marioreinike](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@marioreinike](https://community.shiphero.com/u/marioreinike)\
**Post date:** [March 1, 2023, 2:58pm UTC](https://community.shiphero.com/t/error-deleting-product-through-api/2377/9 "2023-03-01T14:58:24Z")

</div>

is there a fast way to just delete this product in the database? it would be very helpful for us!

---

<div class="post-metadata">

**Author:** ![sh-agent](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@sh-agent](https://community.shiphero.com/u/sh-agent)\
**Post date:** [March 2, 2023, 3:25pm UTC](https://community.shiphero.com/t/error-deleting-product-through-api/2377/10 "2023-03-02T15:25:16Z")

</div>

Hey @marioreinike,

Thanks for hanging in there.

I believe that product was successfully deleted from your primary warehouse. This was done by deleting the bin connection. I think going forward removing all bins from the 3PL side then deleting from the child account, should help with this issue.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/shiphero/original/1X/4b48be3e72adc2f4a9c2cf70731d000649cdccc2.png)

Do note that they are still bins for this product in WH’s: 85985, 85986, and 85987.

Please let me know if you have any questions or concerns.

Best,  
RayanP

---

<div class="post-metadata">

**Author:** ![marioreinike](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@marioreinike](https://community.shiphero.com/u/marioreinike)\
**Post date:** [March 2, 2023, 4:26pm UTC](https://community.shiphero.com/t/error-deleting-product-through-api/2377/11 "2023-03-02T16:26:02Z")

</div>

OK I understand. I proceeded to delete all the locations for this product and it was deleted correctly, and it makes sense, because it shouldn’t be possible to delete a product if you have inventory associated. Thanks!

Just to keep in mind, it would be helpful that the API responded with some more descriptive error messages than just an “Unexpected Error”.
