SDK
SDK Javascript v7.x
2

deleteApiKey #

Available since 7.1.0
Available since Kuzzle 2.1.0

Deletes an API key for the currently logged user.


Copied to clipboard!
deleteApiKey(id, [options]);

Property Type Description
id
string
API key unique ID
options
object
Additional options

options #

Additional query options

Property Type
(default)
Description
refresh
boolean

(false)
If set to wait_for, Kuzzle will not respond until the API key is indexed
timeout
number

(-1)
Time (in ms) during which a request will still be waited to be resolved. Set it -1 if you want to wait indefinitely

Resolves #

Resolves if the API key is successfully deleted.

Usage #

Copied to clipboard!
try {
  await kuzzle.auth.login('local', {
    username: 'jane.doe',
    password: 'password',
  });
  const apiKey = await kuzzle.auth.createApiKey('Sigfox API key', {
    refresh: 'wait_for'
  });
  await kuzzle.auth.deleteApiKey(apiKey._id);
  console.log('API key successfully deleted');
} catch (e) {
  console.error(e);
}