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.

NoteThis guide is mainly useful for developers and technical teams building customizations for a Medusa application.

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.

Publishable API keys list


Create Publishable API Key#

To create a new publishable API key:

  1. Go to Settings -> Publishable API Keys.
  2. Click the Create button at the top right.
  3. In the form that opens, enter the publishable API key's title.
  4. Once you're done, click the Save button.

Create publishable API key form


View Publishable API Key Details#

To view the details of a publishable API key:

  1. Go to Settings -> Publishable API Keys.
  2. 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 details page

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:

StatusDescription
ActiveThe API key is active and can be used in requests.
RevokedThe API key has been revoked and can't be used in requests.

Copy Publishable API Key#

To copy a publishable API key:

  1. Go to the publishable API key's details page.
  2. In the first section, click on the truncated key to copy it to your clipboard.

Copy publishable API key


Edit Publishable API Key#

To edit a publishable API key:

  1. Go to the publishable API key's details page.
  2. Click the at the top right of the first section.
  3. Choose "Edit" from the dropdown.
  4. In the side window that opens, you can edit the publishable API key's title.
  5. Once you're done, click the Save button.

Edit publishable API key form


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:

  1. Go to the publishable API key's details page.
  2. Click the "Add" button at the top right of the "Sales Channels" section.
  3. In the list that opens, check the sales channels you want to add the API key to.
  4. Once you're done, click the Save button.

Add sales channels form

Remove Sales Channels#

To remove a sales channel from a publishable API key:

  1. Go to the publishable API key's details page.
  2. Check the checkbox next to the sales channel you want to remove in the "Sales Channels" section.
  3. Press R or click the Remove button at the bottom center of the page.
  4. Confirm removing the sales channels by clicking the Continue button.

Remove sales channels from publishable API key


Revoke Publishable API Key#

WarningRevoking a publishable API key is irreversible. You can't use the key in requests after revoking it or reactivate it.

To revoke a publishable API key:

  1. Go to the publishable API key's details page.
  2. Click the at the top right of the first section.
  3. Choose "Revoke API key" from the dropdown.
  4. Confirm revoking the API key by clicking the "Revoke API key" button in the pop-up.

Delete Publishable API Key#

WarningDeleting a publishable API key is irreversible.

You can only delete a publishable API key after revoking it. To delete a publishable API key:

  1. Go to the publishable API key's details page.
  2. Click the at the top right of the first section.
  3. Choose "Delete" from the dropdown.
  4. Confirm deleting the API key by clicking the Delete button in the pop-up.
Was this guide helpful?
Edit this page
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break