Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

API keys docs

Blue Mousedc5d35455027
diff --git a/docs/docs/accountsettings/api-keys.md b/docs/docs/accountsettings/api-keys.md
new file mode 100644
index 000000000..edd48192b
--- /dev/null
+++ b/docs/docs/accountsettings/api-keys.md
@@ -0,0 +1,46 @@
+---
+title: API Keys
+slug: /settings/api-keys
+---
+
+import useBaseUrl from '@docusaurus/useBaseUrl';
+
+API keys allow you to authenticate with the Swetrix API programmatically. You can use them to retrieve statistics, manage your account, and more.
+
+## Creating an API Key
+
+To create a new API key:
+
+1. Go to your **[Account Settings](https://swetrix.com/user-settings)**.
+2. Open the **Account** tab.
+3. Scroll down to the **API Key** section.
+4. Click the **Generate new API key** button.
+
+Your new API key will be displayed.
+
+:::warning
+Treat your API key like a password. Do not share it publicly or commit it to version control systems.
+:::
+
+## Deleting an API Key
+
+If your API key is compromised or you no longer need it, you can delete it:
+
+1. Navigate to the **API Key** section in your [Account Settings](https://swetrix.com/user-settings).
+2. Click the **Delete API key** button.
+3. Confirm the deletion in the modal window.
+
+<img alt="Delete API key" src={useBaseUrl('img/accountsettings/api-key.png')} />
+
+Once deleted, any applications or scripts using this key will no longer be able to access the API.
+
+## Using the API Key
+
+You can use your API key to authenticate requests to the Swetrix API. For more information on available endpoints and how to use them, please refer to the [Statistics API reference](/statistics-api).
+
+Example usage:
+
+```bash
+curl 'https://api.swetrix.com/v1/log?pid=YOUR_PROJECT_ID&timeBucket=day&period=7d' \
+ -H "X-Api-Key: YOUR_API_KEY"
+```
diff --git a/docs/docs/accountsettings/teams-and-integrations.md b/docs/docs/accountsettings/teams-and-integrations.md
index ad0a6971d..8c2050688 100644
--- a/docs/docs/accountsettings/teams-and-integrations.md
+++ b/docs/docs/accountsettings/teams-and-integrations.md
@@ -1,5 +1,5 @@
---
-title: Teams, API & Integrations
+title: Teams & Integrations
slug: /teams-api-integrations
---
@@ -31,19 +31,6 @@ To manage your team, go to the Organisations page and click the **Settings** (ge
You can assign a project to an organisation in the **Project Settings -> Access** tab. Once assigned, all members of the organisation will have access to the project according to their organisation role.
-## API Keys
-
-Swetrix provides a personal API key that allows you to interact with the Swetrix API programmatically.
-
-1. Go to your **[Account Settings](https://swetrix.com/user-settings)**.
-2. Open the **Account** tab.
-3. Scroll down to the **API Key** section.
-4. Click **Generate new API key**.
-
-:::warning
-Treat your API key like a password. Do not share it or commit it to public repositories.
-:::
-
## Integrations
Swetrix can send you reports and alerts directly to your favourite communication tools.
diff --git a/docs/sidebars.js b/docs/sidebars.js
index ad6b3ea63..3a4ed8082 100644
--- a/docs/sidebars.js
+++ b/docs/sidebars.js
@@ -53,6 +53,7 @@ module.exports = {
'Account settings': [
'accountsettings/two-factor-authentication',
'accountsettings/teams-api-integrations',
+ 'accountsettings/api-keys',
'accountsettings/change-email',
'accountsettings/change-password',
'accountsettings/delete-account',
diff --git a/docs/static/img/accountsettings/api-key.png b/docs/static/img/accountsettings/api-key.png
new file mode 100644
index 000000000..25c8b28bd
Binary files /dev/null and b/docs/static/img/accountsettings/api-key.png differ