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

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 product through the api, the response 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.

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.

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.

i think it’s /api/v3/sales-channel