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.update("apk_123", {
title: "Development"
})
.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"
}
}Update an API key’s details.
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.update("apk_123", {
title: "Development"
})
.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 to update in an API key.
The API key's title.
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.