# How can I set the Sales Channel on a Product through the API

**URL:** <https://forum.shopware.com/t/how-can-i-set-the-sales-channel-on-a-product-through-the-api/64213>\
**Category:** Programming (EN)\
**Created:** [23. Januar 2020 um 14:24 UTC](https://forum.shopware.com/t/how-can-i-set-the-sales-channel-on-a-product-through-the-api/64213 "2020-01-23T14:24:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![WBKNL](https://avatars.discourse-cdn.com/v4/letter/w/e36b37/32.png) [@WBKNL](https://forum.shopware.com/u/WBKNL)\
**Post date:** [23. Januar 2020 um 14:24 UTC](https://forum.shopware.com/t/how-can-i-set-the-sales-channel-on-a-product-through-the-api/64213/1 "2020-01-23T14:24:35Z")

</div>

I’ve added all my products through the API. I can set the categories and manufacturers just fine but I can’t seem to find out how to set the Sales Channel and without that, my products don’t show up. Neither the documentation nor the Swagger contains anything on setting a Sales Channel on a product.

When I manually set a Sales Channel on a product through the admin panel and fetch that&nbsp;product through the api, the response&nbsp;contains no Sales Channel information.

I’ve also looked at the Sales Channel API product endpoint documentation, in case you have to add products to Sales Channels instead of the other way around, but it only contains information about GET requests.

---

<div class="post-metadata">

**Author:** ![WBKNL](https://avatars.discourse-cdn.com/v4/letter/w/e36b37/32.png) [@WBKNL](https://forum.shopware.com/u/WBKNL)\
**Post date:** [23. Januar 2020 um 14:47 UTC](https://forum.shopware.com/t/how-can-i-set-the-sales-channel-on-a-product-through-the-api/64213/2 "2020-01-23T14:47:28Z")

</div>

Appearantly you use the **_visibility_** property for that:

```
$payload['visibilities'] = [
            [
                'salesChannelId' => $salesChannelId,
                'visibility' => $visibility
            ]
        ];

```

At the moment there are 3 different visibility modes: Invisible, search only and all. The number 30 stands for all, 20 for search only and 10 for invisible.

---

<div class="post-metadata">

**Author:** ![btxtiger](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@btxtiger](https://forum.shopware.com/u/btxtiger)\
**Post date:** [13. Oktober 2020 um 08:36 UTC](https://forum.shopware.com/t/how-can-i-set-the-sales-channel-on-a-product-through-the-api/64213/3 "2020-10-13T08:36:14Z")

</div>

I don’t understand, how I can get the salesChannelId.

I am expecting the route /api/v3/salesChannel to get all available sales channels. But this route does not exist, I am getting 404.

---

<div class="post-metadata">

**Author:** ![JROBFN](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@JROBFN](https://forum.shopware.com/u/JROBFN)\
**Post date:** [13. Oktober 2020 um 19:28 UTC](https://forum.shopware.com/t/how-can-i-set-the-sales-channel-on-a-product-through-the-api/64213/4 "2020-10-13T19:28:56Z")

</div>

i think it’s&nbsp;/api/v3/sales-channel
