This lightweight toolkit enables you to seed your Unkey API with expired keys and showcases how to effortlessly clean them up in one swift command. Enhanced with a visually appealing terminal progress bar, it offers real-time feedback during the cleanup process, ensuring you can manage expired API keys efficiently.
- Navigate to Unkey Root Keys and click "Create New Root Key".
- Name your root key.
- Select the following workspace permissions:
create_key
read_key
encrypt_key
decrypt_key
- Click "Create" and save your root key securely.
- Go to Unkey APIs and click "Create New API".
- Enter a name for the API.
- Click "Create".
-
Clone the repository to your local machine:
git clone git@github.com:unrenamed/unkey-expired-keys-cleanup cd unkey-expired-keys-cleanup
-
Create a
.env
file in the root directory and populate it with the following environment variables:UNKEY_ROOT_KEY=your-unkey-root-key UNKEY_API_ID=your-unkey-api-id
Ensure you replace
your-unkey-*
with your actual Unkey credentials. -
Seed your API with 500 expired API keys in batches:
pnpm dev:seed
Open seed.ts to refine the batch size and total keys number.
-
Delete all expired keys from your API in batches:
pnpm dev:cleanup
Open cleanup.ts to refine the batch size.