Medusa Core Workflows Reference

This section of the documentation provides a reference to the core workflows created by Medusa. Medusa uses these workflows in the Store and Admin API routes.

You can use these workflows and steps in your customizations. For example, you can execute these workflows:

  • In an API route when a request is received;
  • In a subscriber when an event is emitted;
  • In a scheduled jobs at a specified interval during the application's runtime;
  • In a custom CLI scripts that you can execute from the terminal;
  • Or in a custom workflow that wraps the existing workflows and steps in a custom flow. You can then execute your custom workflow in the same way as the core workflows.

Through this reference, you'll learn about the available workflows and steps in Medusa out-of-the-box. For each workflow, you'll explore its steps, expected input and output, an example of executing that workflow, and how to inject custom functionalities into the workflow, if applicable.

All workflows and steps in this reference are exported by the @medusajs/medusa/core-flows package.

escClear Search

Api Key#

createApiKeysWorkflow
Create secret or publishable API keys.
deleteApiKeysWorkflow
Delete secret or publishable API keys.
linkSalesChannelsToApiKeyWorkflow
Manage the sales channels of a publishable API key.
revokeApiKeysWorkflow
Revoke secret or publishable API keys.
updateApiKeysWorkflow
Update secret or publishable API keys.

Auth#

generateResetPasswordTokenWorkflow
Generate a reset password token for a user or customer.

Cart#

addShippingMethodToCartWorkflow
Add a shipping method to a cart.
addToCartWorkflow
Add a line item to a cart.
completeCartWorkflow
Complete a cart and place an order.
confirmVariantInventoryWorkflow
Validate that a variant is in-stock before adding to the cart.
createCartWorkflow
Create a cart specifying region, items, and more.
createPaymentCollectionForCartWorkflow
Create payment collection for cart.
listShippingOptionsForCartWithPricingWorkflow
List a cart's shipping options with prices.
listShippingOptionsForCartWorkflow
List a cart's shipping options.
refreshCartItemsWorkflow
Refresh a cart's details after an update.
refreshCartShippingMethodsWorkflow
Refresh a cart's shipping methods after an update.
refreshPaymentCollectionForCartWorkflow
Refresh a cart's payment collection details.
transferCartCustomerWorkflow
Refresh a cart's payment collection details.
updateCartPromotionsWorkflow
Update a cart's applied promotions to add, replace, or remove them.
updateCartWorkflow
Update a cart's details, such as region, address, and more.
updateLineItemInCartWorkflow
Update a cart's line item.
updateTaxLinesWorkflow
Update a cart's tax lines.

Common#

batchLinksWorkflow
Manage links between two records of linked data models.
createLinksWorkflow
Create links between two records of linked data models.
dismissLinksWorkflow
Dismiss links between two records of linked data models.
updateLinksWorkflow
Update links between two records of linked data models.

Customer#

createCustomerAccountWorkflow
Create or register a customer account.
createCustomerAddressesWorkflow
Create one or more customer addresses.
createCustomersWorkflow
Create one or more customers.
deleteCustomerAddressesWorkflow
Delete one or more customer addresses.
deleteCustomersWorkflow
Delete one or more customers.
removeCustomerAccountWorkflow
Delete a customer account and its auth identity association.
updateCustomerAddressesWorkflow
Update one or more customer addresses.
updateCustomersWorkflow
Update one or more customers.

Customer Group#

createCustomerGroupsWorkflow
Create one or more customer groups.
deleteCustomerGroupsWorkflow
Delete one or more customer groups.
linkCustomerGroupsToCustomerWorkflow
Manage groups of a customer.
linkCustomersToCustomerGroupWorkflow
Manage the customers of a customer group.
updateCustomerGroupsWorkflow
Update one or more customer groups.

Defaults#

createDefaultsWorkflow
Create default data for a Medusa application.

File#

deleteFilesWorkflow
Delete files from the database and storage.
uploadFilesWorkflow
Upload files using the installed File Module Provider.

Fulfillment#

batchShippingOptionRulesWorkflow
Manage shipping option rules.
calculateShippingOptionsPricesWorkflow
Calculate shipping option prices in a cart.
cancelFulfillmentWorkflow
Cancel a fulfillment.
createFulfillmentWorkflow
Create a fulfillment.
createReturnFulfillmentWorkflow
Create a fulfillment for a return.
createServiceZonesWorkflow
Create one or more service zones.
createShipmentWorkflow
Create a shipment for a fulfillment.
createShippingOptionsWorkflow
Create shipping options.
createShippingProfilesWorkflow
Create one or more shipping profiles.
deleteFulfillmentSetsWorkflow
Delete one or more fulfillment sets.
deleteServiceZonesWorkflow
Delete one or more service zones.
deleteShippingOptionsWorkflow
Delete one or more shipping options.
markFulfillmentAsDeliveredWorkflow
Mark a fulfillment as delivered.
updateFulfillmentWorkflow
Update a fulfillment.
updateServiceZonesWorkflow
Update one or more service zones.
updateShippingOptionsWorkflow
Update one or more shipping options.
updateShippingProfilesWorkflow
Update one or more shipping profiles.

Inventory#

batchInventoryItemLevelsWorkflow
Manage inventory levels in bulk.
bulkCreateDeleteLevelsWorkflow
createInventoryItemsWorkflow
Create one or more inventory items.
createInventoryLevelsWorkflow
Create one or more inventory levels.
deleteInventoryItemWorkflow
Delete one or more inventory items.
deleteInventoryLevelsWorkflow
Delete one or more inventory levels.
updateInventoryItemsWorkflow
Update one or more inventory items.
updateInventoryLevelsWorkflow
Update one or more inventory levels.

Invite#

acceptInviteWorkflow
Accept invite and create user.
createInvitesWorkflow
Create one or more user invites.
deleteInvitesWorkflow
Delete one or more user invites.
refreshInviteTokensWorkflow
Refresh user invite tokens.

Line Item#

deleteLineItemsWorkflow
Delete line items from a cart.

Order#

acceptOrderTransferWorkflow
Accept an order transfer request.
addOrderLineItemsWorkflow
Add line items to an order.
archiveOrderWorkflow
Archive one or more orders.
beginClaimOrderWorkflow
Create an order claim in requested state.
beginExchangeOrderWorkflow
Request an order exchange.
beginOrderEditOrderWorkflow
Create an order edit request.
beginReceiveReturnWorkflow
Request a return receival.
beginReturnOrderWorkflow
Create a return for an order.
cancelBeginOrderClaimWorkflow
Cancel a requested order claim.
cancelBeginOrderEditWorkflow
Cancel a requested order edit.
cancelBeginOrderExchangeWorkflow
Cancel a requested order exchange.
cancelOrderChangeWorkflow
Cancel an order change.
cancelOrderClaimWorkflow
Cancel a confirmed order claim.
cancelOrderExchangeWorkflow
Cancel an exchange for an order.
cancelOrderFulfillmentWorkflow
Cancel an order's fulfillment.
cancelOrderTransferRequestWorkflow
Cancel an order transfer request.
cancelOrderWorkflow
Cancel an order.
cancelReturnReceiveWorkflow
Cancel a return receival.
cancelReturnRequestWorkflow
Cancel a requested return.
cancelReturnWorkflow
Cancel a return.
completeOrderWorkflow
Complete one or more orders.
confirmClaimRequestWorkflow
Confirm a requested claim.
confirmExchangeRequestWorkflow
Confirm an exchange request.
confirmOrderEditRequestWorkflow
Confirm an order edit request.
confirmReturnReceiveWorkflow
Confirm a return receival request.
confirmReturnRequestWorkflow
Confirm a return request.
createAndCompleteReturnOrderWorkflow
Create and complete a return for an order.
createClaimShippingMethodWorkflow
Create an inbound or outbound shipping method for a claim.
createExchangeShippingMethodWorkflow
Create an inbound or outbound shipping method for an exchange.
createOrUpdateOrderPaymentCollectionWorkflow
Create or update payment collection for an order.
createOrderChangeActionsWorkflow
Create an order change action.
createOrderChangeWorkflow
Create an order change.
createOrderEditShippingMethodWorkflow
Create a shipping method for an order edit.
createOrderFulfillmentWorkflow
Creates a fulfillment for an order.
createOrderPaymentCollectionWorkflow
Create a payment collection for an order.
createOrderShipmentWorkflow
Creates a shipment for an order.
createOrderWorkflow
Create an order.
createOrdersWorkflow
createReturnShippingMethodWorkflow
Create a shipping method for a return.
declineOrderChangeWorkflow
Decline an order change.
declineOrderTransferRequestWorkflow
Decline a requested order transfer.
deleteOrderChangeActionsWorkflow
Delete one or more order change actions.
deleteOrderChangeWorkflow
Delete one or more order changes.
dismissItemReturnRequestWorkflow
Dismiss items from a return request.
getOrderDetailWorkflow
Retrieve an order's details.
getOrdersListWorkflow
Retrieve a list of orders.
markOrderFulfillmentAsDeliveredWorkflow
Mark a fulfillment in an order as delivered.
orderClaimAddNewItemWorkflow
Add outbound or new items to a claim.
orderClaimItemWorkflow
Add order items to a claim as claim items.
orderClaimRequestItemReturnWorkflow
Request one or more items to be returned as part of a claim.
orderEditAddNewItemWorkflow
Add new items to an order edit.
orderEditUpdateItemQuantityWorkflow
Update the quantity of an existing order item in the order's edit.
orderExchangeAddNewItemWorkflow
Add new or outbound items to an exchange.
orderExchangeRequestItemReturnWorkflow
Add inbound items to be returned as part of the exchange.
receiveAndCompleteReturnOrderWorkflow
Receive and complete a return.
receiveItemReturnRequestWorkflow
Mark return items as received.
removeAddItemClaimActionWorkflow
Remove outbound (new) items from a claim.
removeClaimShippingMethodWorkflow
Remove an inbound or outbound shipping method from a claim.
removeExchangeShippingMethodWorkflow
Remove an inbound or outbound shipping method from an exchange.
removeItemClaimActionWorkflow
Remove order items from a claim.
removeItemExchangeActionWorkflow
Remove an outbound or new item from an exchange.
removeItemOrderEditActionWorkflow
Remove an item that was added to an order edit.
removeItemReceiveReturnActionWorkflow
Remove an item from a return receival.
removeItemReturnActionWorkflow
Remove an item from a return.
removeOrderEditShippingMethodWorkflow
Remove a shipping method from an order edit.
removeReturnShippingMethodWorkflow
Remove a shipping method from a return.
requestItemReturnWorkflow
Add items to a return.
requestOrderEditRequestWorkflow
Request an order edit.
requestOrderTransferWorkflow
Request a transfer of an order to a customer.
updateClaimAddItemWorkflow
Update a claim's new or outbound item.
updateClaimItemWorkflow
Update a claim item, added to the claim from an order item.
updateClaimShippingMethodWorkflow
Update an inbound or outbound shipping method of a claim.
updateExchangeAddItemWorkflow
Update an outbound or new item in an exchange.
updateExchangeShippingMethodWorkflow
Update an exchange's inbound or outbound shipping method.
updateOrderChangeActionsWorkflow
Update one or more order change actions.
updateOrderChangesWorkflow
Update one or more order changes.
updateOrderEditAddItemWorkflow
Update a new item in an order edit.
updateOrderEditItemQuantityWorkflow
Update an existing order item previously added to an order edit.
updateOrderEditShippingMethodWorkflow
Update a shipping method of an order edit.
updateOrderTaxLinesWorkflow
Update the tax lines of items and shipping methods in an order.
updateOrderWorkflow
Update an order's details.
updateReceiveItemReturnRequestWorkflow
Update an item in a return receival request.
updateRequestItemReturnWorkflow
Update a requested item in a return.
updateReturnShippingMethodWorkflow
Update the shipping method of a return.
updateReturnWorkflow
Update a return's details.

Payment#

capturePaymentWorkflow
Capture a payment.
processPaymentWorkflow
Process a payment based on a webhook event.
refundPaymentWorkflow
Refund a payment.
refundPaymentsWorkflow
Refund one or more payments.

Payment Collection#

createPaymentSessionsWorkflow
Create payment sessions.
createRefundReasonsWorkflow
Create refund reasons.
deletePaymentSessionsWorkflow
Delete payment sessions.
deleteRefundReasonsWorkflow
Delete refund reasons.
updateRefundReasonsWorkflow
Update refund reasons.

Price List#

batchPriceListPricesWorkflow
Manage a price list's prices.
createPriceListPricesWorkflow
Create prices in price lists.
createPriceListsWorkflow
Create one or more price lists.
deletePriceListsWorkflow
Delete one or more price lists.
removePriceListPricesWorkflow
Remove prices in price lists.
updatePriceListPricesWorkflow
Update price lists' prices.
updatePriceListsWorkflow
Update one or more price lists.

Pricing#

createPricePreferencesWorkflow
Create one or more price preferences.
deletePricePreferencesWorkflow
Delete one or more price preferences.
updatePricePreferencesWorkflow
Update one or more price preferences.

Product#

batchLinkProductsToCategoryWorkflow
Manage the links between a collection and products.
batchLinkProductsToCollectionWorkflow
Manage the links between a collection and products.
batchProductVariantsWorkflow
Create, update, and delete product variants.
batchProductsWorkflow
Manage products in bulk.
createCollectionsWorkflow
Create one or more product collections.
createProductOptionsWorkflow
Create one or more product options.
createProductTagsWorkflow
Create one or more product tags.
createProductTypesWorkflow
Create one or more product types.
createProductVariantsWorkflow
Create one or more product variants.
createProductsWorkflow
Create one or more products with options and variants.
deleteCollectionsWorkflow
Delete one or more product collection.
deleteProductOptionsWorkflow
Delete one or more product option.
deleteProductTagsWorkflow
Delete one or more product tags.
deleteProductTypesWorkflow
Delete one or more product types.
deleteProductVariantsWorkflow
Delete one or more product variants.
deleteProductsWorkflow
Delete one or more products.
exportProductsWorkflow
Export products with filtering capabilities.
importProductsWorkflow
Import products from a CSV file.
updateCollectionsWorkflow
Update one or more product collections.
updateProductOptionsWorkflow
Update one or more product options.
updateProductTagsWorkflow
Update one or more product tags.
updateProductTypesWorkflow
Update one or more product types.
updateProductVariantsWorkflow
Update one or more product variants.
updateProductsWorkflow
Update one or more products with options and variants.
upsertVariantPricesWorkflow
Create, update, or remove variants' prices.

Product Category#

createProductCategoriesWorkflow
Create product categories.
deleteProductCategoriesWorkflow
Delete product categories.
updateProductCategoriesWorkflow
Update product categories.

Promotion#

addOrRemoveCampaignPromotionsWorkflow
Manage the promotions of a campaign.
batchPromotionRulesWorkflow
Manage the rules of a promotion.
createCampaignsWorkflow
Create one or more campaigns.
createPromotionRulesWorkflow
Create one or more promotion rules.
createPromotionsWorkflow
Create one or more promotions.
deleteCampaignsWorkflow
Delete one or more campaigns.
deletePromotionRulesWorkflow
Delete one or more promotion rules.
deletePromotionsWorkflow
Delete one or more promotions.
updateCampaignsWorkflow
Update one or more campaigns.
updatePromotionRulesWorkflow
Update one or more promotion rules.
updatePromotionsStatusWorkflow
Update the status of one or more promotions.
updatePromotionsWorkflow
Update one or more promotions.

Region#

createRegionsWorkflow
Create one or more regions.
deleteRegionsWorkflow
Delete one or more regions.
updateRegionsWorkflow
Update regions.

Reservation#

createReservationsWorkflow
Create one or more reservations.
deleteReservationsByLineItemsWorkflow
Delete reservations by their associated line items.
deleteReservationsWorkflow
Delete one or more reservations.
updateReservationsWorkflow
Update one or more reservations.

Return Reason#

createReturnReasonsWorkflow
Create return reasons.
deleteReturnReasonsWorkflow
Delete return reasons.
updateReturnReasonsWorkflow
Update return reasons.

Sales Channel#

createSalesChannelsWorkflow
Create sales channels.
deleteSalesChannelsWorkflow
Delete sales channels.
linkProductsToSalesChannelWorkflow
Manage the products available in a sales channel.
updateSalesChannelsWorkflow
Update sales channels.

Shipping Profile#

deleteShippingProfileWorkflow
Delete shipping profiles.

Stock Location#

createLocationFulfillmentSetWorkflow
Add fulfillment set to a stock location.
createStockLocationsWorkflow
Create one or more stock locations.
deleteStockLocationsWorkflow
Delete one or more stock locations.
linkSalesChannelsToStockLocationWorkflow
Manage the sales channels of a stock location.
updateStockLocationsWorkflow
Update stock locations.

Store#

createStoresWorkflow
Create one or more stores.
deleteStoresWorkflow
Delete one or more stores.
updateStoresWorkflow
Update stores.

Tax#

createTaxRateRulesWorkflow
Create one or more tax rules for rates.
createTaxRatesWorkflow
Create one or more tax rates.
createTaxRegionsWorkflow
Create one or more tax regions.
deleteTaxRateRulesWorkflow
Delete one or more tax rate rules.
deleteTaxRatesWorkflow
Delete one or more tax rates.
deleteTaxRegionsWorkflow
Delete one or more tax regions.
setTaxRateRulesWorkflow
Set the rules of tax rates.
updateTaxRatesWorkflow
Update tax rates.
updateTaxRegionsWorkflow
Update one or more tax regions.

User#

createUserAccountWorkflow
Create a user account and attach an auth identity.
createUsersWorkflow
Create one or more users.
deleteUsersWorkflow
Delete one or more users.
removeUserAccountWorkflow
Delete a user and remove the association to its auth identity.
updateUsersWorkflow
Update one or more users.
Was this page 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