revoke - API Key Module Reference

This documentation provides a reference to the revoke method. This belongs to the API Key Module.

NoteYou should only use this methods when implementing complex customizations. For common cases, check out available workflows instead.

revoke(selector, data, sharedContext?): Promise<ApiKeyDTO[]>#

This method revokes API keys based on the filters provided.

Example#

Code
1const apiKey = await apiKeyModuleService.revoke(2  {3    id: "apk_123",4  },5  {6    revoked_by: "user_123",7    // 1 minute8    revoke_in: 60,9  }10)

Parameters#

The filters to specify which API keys should be revoked.
The details of revoking the API keys.
sharedContextContextOptional
A context used to share resources, such as transaction manager, between the application and the module.

Returns#

PromisePromise<ApiKeyDTO[]>
The revoked API keys.

revoke(id, data, sharedContext?): Promise<ApiKeyDTO>#

This method revokes an API key based on the ID provided.

Example#

Code
1const apiKey = await apiKeyModuleService.revoke("apk_123", {2  revoked_by: "user_123",3  // 1 minute4  revoke_in: 60,5})

Parameters#

idstring
The ID of the API key to revoke.
The details of revoking the API key.
sharedContextContextOptional
A context used to share resources, such as transaction manager, between the application and the module.

Returns#

PromisePromise<ApiKeyDTO>
The revoked API key.
Was this page helpful?
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