Important
In order to display your statistics you need to host this API yourself, for this I recommend using Cloudflare Workers
- Clone this repository
git clone https://github.com/IgorKowalczyk/wakatime-hours
- Install dependencies
pnpm install
- Edit
wrangler.jsonc
file and set yourname
,routes
or other settings if needed - Run
wrangler dev
to start the project in development mode orwrangler deploy
to deploy the project to Cloudflare Workers - Run
pnpm wrangler secret put WAKATIME_API_KEY
and paste your Wakatime API Key, you can get it here - Visit
https://YOUR-DEPLOY/api/badge
in your browser
Note
If you wish to host this API on a different platform, refer to the Hono documentation for deployment instructions. You may need to modify the code to work with your hosting provider.
- Clone this repository
git clone https://github.com/IgorKowalczyk/wakatime-hours
- Install dependencies
pnpm install
- Create new file named
.dev.vars
. Remember - the file is super secret, better to not share it! - In
.dev.vars
file set this values (.env
file syntax):WAKATIME_API_KEY
- Your Wakatime API Key, you can get it here
- Run
pnpm dev
to start the project in development mode - Visit
http://localhost:8787/api/badge
in your browser
- Go to Wakatime and login to your account
- Go to API Keys page and copy your API Key. This key is super secret, better to not share it.
- Paste your API Key to
.dev.vars
file or add it as environment variable on your hosting
GET https://YOUR-DEPLOY/api/badge?style=${style}&color=${color}&label=${label}
Parameter | Type | Description | Available values | Default value |
---|---|---|---|---|
style |
string |
Optional. The style of the badge | Available styles | flat |
color |
string |
Optional. The color of the badge | Available colors | blue |
label |
string |
Optional. The label of the badge | Any string | Wakatime |
Note
The default style is flat
Style | Example | Usage |
---|---|---|
flat |
style=flat |
|
flat-square |
style=flat-square |
|
for-the-badge |
style=for-the-badge |
|
plastic |
style=plastic |
|
social |
style=social |
Note
To apply the style, add to the URL ?style=YOUR-STYLE
, if you use other parameters you can use &style=YOUR-STYLE
Note
The default color is blue
Note
To apply the style, add to the URL ?color=YOUR-COLOR
, if you use other parameters you can use &color=YOUR-COLOR
Warning
HEX colors should be used without #
symbol prefix.
You can overwrite default Wakatime
text with your own label.
Note
Replace whitespace with +
character in multi-word labels.

- Go to Wakatime and login to your account
- Go to API Keys page and copy your API Key
- Paste your API Key to
.env
file or add it as environment variable on your hosting - Restart your API if needed
Important
Wakatime API Key is super secret, better to not share it. If you share it, anyone can use your API Key to get or modify your statistics.
If you come across any errors or have suggestions for improvements, please create a new issue here and describe it clearly.
When submitting a pull request, please follow these steps:
- Clone this repository
https://github.com/IgorKowalczyk/wakatime-hours.git
- Create a branch from
main
and give it a meaningful name (e.g.my-awesome-new-feature
). - Open a pull request on GitHub and clearly describe the feature or fix you are proposing.
This project is licensed under the MIT. See the LICENSE file for details