Skip to main content

Personal API-token management

Personal API tokens begin with analog-wakatime_live_ and are the recommended credential for scripts and integrations. They can be rotated or revoked independently of your session.

List tokens

import * as AnalogWakaTime from '@analog-code-monitor/analog-wakatime-ts-sdk';

const configuration = new AnalogWakaTime.Configuration({
accessToken: process.env.ANALOG_WAKATIME_API_TOKEN,
});

const authApi = new AnalogWakaTime.AuthApi(configuration);

const { data } = await authApi.getApiTokens();
console.log(data);

Create a token

const { data } = await authApi.createApiToken(createApiTokenRequest);
console.log(data);

Store the returned token immediately — depending on the endpoint contract it may not be retrievable in full later.

Update a token

await authApi.updateApiToken(tokenUUID, updateApiTokenRequest);

Delete a token

await authApi.deleteApiToken(tokenUUID);

Rotation pattern

  1. create a new token
  2. deploy it to your integration
  3. verify authenticated calls succeed
  4. delete the old token

This avoids any window where your integration runs without valid credentials.