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.revoke("apk_123")
.then(({ api_key }) => {
console.log(api_key)
}){
"api_key": {
"id": "<string>",
"token": "<string>",
"redacted": "sk_...123",
"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",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
}Revokes an API key. If the API key is a secret, it can’t be used for authentication anymore. If it’s publishable, it can’t be used by client applications.
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.revoke("apk_123")
.then(({ api_key }) => {
console.log(api_key)
}){
"api_key": {
"id": "<string>",
"token": "<string>",
"redacted": "sk_...123",
"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",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The API key's ID.
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 details of revoking the API key.
The time in seconds to revoke the API key after. If not set, the API key is revoked immediately.
OK
The API key's details.
The API key's details.
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.
"sk_...123"
The api key's title.
The api key's type. secret is used for a user's API key, whereas publishable is used for Publishable API keys.
secret, publishable The date and time the API key was last used.
The ID of the user that created the API key, if available.
The date and time the API key was created.
The ID of the user that revoked the API key, if available.
The date and time the API key was revoked. The API key is considered revoked when this property is set.
The date the API key was updated.
The date the API key was deleted.