Links between API Key Module and Other Modules

This document showcases the module links defined between the API Key Module and other Commerce Modules.

Summary#

The API Key Module has the following links to other modules:

First Data Model

Second Data Model

Type

Description

ApiKey

SalesChannel in Sales Channel Module

Stored - many-to-many

Learn more


Sales Channel Module#

You can create a publishable API key and associate it with a sales channel. Medusa defines a link between the ApiKey and the SalesChannel data models.

A diagram showcasing an example of how data models from the API Key and Sales Channel modules are linked

This is useful to avoid passing the sales channel's ID as a parameter of every request, and instead pass the publishable API key in the header of any request to the Store API route.

Learn more about this in the Sales Channel Module's documentation.

Retrieve with Query#

To retrieve the sales channels of an API key with Query, pass sales_channels.* in fields:

To manage the sales channels of an API key, use Link:

Was this page helpful?
Ask Bloom
For assistance in your development, use Claude Code Plugins or Docs MCP server in Cursor, VSCode, etc...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
⇧↵