- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- User Guide
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- User Guide
Manage Publishable API Keys in Medusa Admin
In this guide, you'll learn how to create and manage publishable API keys in the Medusa Admin.
What is a Publishable API Key?#
A publishable API key is a client key scoped to one or more sales channels. When you build a storefront, you must pass a publishable API key in the request headers indicating the sales channel to scope the request to. This impacts the products retrieved, available stock quantities, and other data.
To learn how to pass the publishable API key in request headers, refer to the API Reference.
View Publishable API Keys#
To view the publishable API keys in the Medusa Admin, go to Settings -> Publishable API Keys.
Here, you can see a list of all the publishable API keys you have set up in your store. You can also search, filter, and sort the API keys to find the one you are looking for.
Create Publishable API Key#
To create a new publishable API key:
- Go to Settings -> Publishable API Keys.
- Click the Create button at the top right.
- In the form that opens, enter the publishable API key's title.
- Once you're done, click the Save button.
View Publishable API Key Details#
To view the details of a publishable API key:
- Go to Settings -> Publishable API Keys.
- Click on a publishable API key from the list.
This opens the publishable API key's details page where you can also manage the API key.
Publishable API Key Status#
You can see the status of the publishable API key at the top right of the first section in the details page. A publishable API key's status can be:
Status | Description |
---|---|
Active | The API key is active and can be used in requests. |
Revoked | The API key has been revoked and can't be used in requests. |
Copy Publishable API Key#
To copy a publishable API key:
- Go to the publishable API key's details page.
- In the first section, click on the truncated key to copy it to your clipboard.
Edit Publishable API Key#
To edit a publishable API key:
- Go to the publishable API key's details page.
- Click the at the top right of the first section.
- Choose "Edit" from the dropdown.
- In the side window that opens, you can edit the publishable API key's title.
- Once you're done, click the Save button.
Manage Publishable API Key's Sales Channels#
You can manage the sales channels of a publishable API key in its details page. By adding sales channels to the publishable API key, it becomes part of the scope in requests made with the key.
Add Sales Channels#
To add a sales channel to a publishable API key:
- Go to the publishable API key's details page.
- Click the "Add" button at the top right of the "Sales Channels" section.
- In the list that opens, check the sales channels you want to add the API key to.
- Once you're done, click the Save button.
Remove Sales Channels#
To remove a sales channel from a publishable API key:
- Go to the publishable API key's details page.
- Check the checkbox next to the sales channel you want to remove in the "Sales Channels" section.
- Press R or click the Remove button at the bottom center of the page.
- Confirm removing the sales channels by clicking the Continue button.
Revoke Publishable API Key#
To revoke a publishable API key:
- Go to the publishable API key's details page.
- Click the at the top right of the first section.
- Choose "Revoke API key" from the dropdown.
- Confirm revoking the API key by clicking the "Revoke API key" button in the pop-up.
Delete Publishable API Key#
You can only delete a publishable API key after revoking it. To delete a publishable API key:
- Go to the publishable API key's details page.
- Click the at the top right of the first section.
- Choose "Delete" from the dropdown.
- Confirm deleting the API key by clicking the Delete button in the pop-up.