Create Store Cannel AccessKey Over API


Im creating a store-channel through Shopware API (/api/sales-channel) and Accesskey is required
„accessKey“: „******************************“,
I can put a random value as accessKey and the sales channel is created but the Accesskey isn’t valid for use.
How to generate a valid Accesskey through the API?

Thanx for the answer but how should the API request look?
And witch Url to POST to?

this function generates you a valid AccessKey, It must be a base65 encoded 16 chars long alphanumeric string.

Then you should be able to use it in your example.

But i need to create the AccessKey outside of Shopware, Using Laravel to set up a sales channel,
And a random base65 encoded 16 chars long alphanumeric string generates error: ‚Access key is invalid and could not be identified‘

Found the solution

Url: /api/_action/access-key/sales-channel

$response = $client->get($url, [
    'headers' => [
        'Authorization' => 'Bearer ' . $accessToken,