import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.apiKey.list()
.then(({ api_keys, count, limit, offset }) => {
console.log(api_keys)
}){
"limit": 123,
"offset": 123,
"count": 123,
"api_keys": [
{
"id": "<string>",
"token": "<string>",
"redacted": "<string>",
"title": "<string>",
"type": "secret",
"last_used_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"revoked_by": "<string>",
"revoked_at": "2023-11-07T05:31:56Z"
}
]
}Retrieve a list of API keys. The API keys can be filtered by fields such as id. The API keys can also be sorted or paginated.
import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.apiKey.list()
.then(({ api_keys, count, limit, offset }) => {
console.log(api_keys)
}){
"limit": 123,
"offset": 123,
"count": 123,
"api_keys": [
{
"id": "<string>",
"token": "<string>",
"redacted": "<string>",
"title": "<string>",
"type": "secret",
"last_used_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"revoked_by": "<string>",
"revoked_at": "2023-11-07T05:31:56Z"
}
]
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.
The number of items to skip when retrieving a list.
Limit the number of items returned in the list.
The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.
A search term to search the API keys' searchable properties. The search term.
Filter by an API key's ID.
Filter by an API key's title.
Filter by an API key's token.
Filter by the API key's type.
secret, publishable Filter by the API key's creation date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
The value to match.
Filter by values not in this array.
The value not to match.
Filter by values not matching this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
The values to match.
Filter arrays that contain some of the values of this parameter.
The values to match.
Filter arrays that contain all values of this parameter.
The values to match.
Filter by whether a value for this parameter exists (not null).
Filter by the API key's update date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
The value to match.
Filter by values not in this array.
The value not to match.
Filter by values not matching this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
The values to match.
Filter arrays that contain some of the values of this parameter.
The values to match.
Filter arrays that contain all values of this parameter.
The values to match.
Filter by whether a value for this parameter exists (not null).
Filter by the API key's deletion date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
The value to match.
Filter by values not in this array.
The value not to match.
Filter by values not matching this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
The values to match.
Filter arrays that contain some of the values of this parameter.
The values to match.
Filter arrays that contain all values of this parameter.
The values to match.
Filter by whether a value for this parameter exists (not null).
Filter by the API key's revoke date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
The value to match.
Filter by values not in this array.
The value not to match.
Filter by values not matching this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
The values to match.
Filter arrays that contain some of the values of this parameter.
The values to match.
Filter arrays that contain all values of this parameter.
The values to match.
Filter by whether a value for this parameter exists (not null).
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Whether to include deleted records in the result.
OK
The maximum number of items returned in the list.
The number of items skipped before retrieving the returned items.
The total count of items.
The list of API keys.
Show child attributes
The API key's ID.
The API key's token.
The redacted form of the API key's token. This is useful when showing portion of the token. For example sk_...123.
The API key's title.
The API key's type. secret API keys are used for authenticating admin users, and publishable API key are used for storefronts and similar clients to scope requests to sales channels.
secret, publishable The date the API key was last used.
The ID of the user that created the API key.
The date the API key was created.
The ID of the user that revoked the API key.
The date the API key was revoked.