Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

add more docs

Steven Tey938eb2dee3d8
diff --git a/apps/docs/api-reference/introduction.mdx b/apps/docs/api-reference/introduction.mdx
index 2ef3322ddd..aeded51c03 100644
--- a/apps/docs/api-reference/introduction.mdx
+++ b/apps/docs/api-reference/introduction.mdx
@@ -16,7 +16,7 @@ Dub.co's API is built on REST principles and is served over HTTPS. To ensure dat
The Base URL for all API endpoints is:
-```
+```bash Terminal
https://api.dub.co
```
@@ -24,11 +24,29 @@ https://api.dub.co
Authentication to Dub.co's API is performed via the Authorization header with a Bearer token. To authenticate, you need to include the Authorization header with the word `Bearer` followed by your token in your API requests like so:
-```
+```bash Terminal
Authorization: Bearer <Your-Token>
```
-You can get your token under your [Dub.co Account Settings](https://app.dub.co/settings/tokens).
+You can create a new token/API key under your [Dub.co Account Settings](https://app.dub.co/settings/tokens).
+
+<Frame>
+ <img src="/images/dub-api-key.png" alt="Dub API Key" />
+</Frame>
+
+## Workspace ID
+
+Dub.co's API is organized around workspaces. Each workspace has its own set of resources and permissions. To access a workspace's resources, you need to include the `workspaceId` query parameter in your API requests like so:
+
+```bash Terminal
+https://api.dub.co/links?workspaceId=<Your-Workspace-ID>
+```
+
+You can get your workspace ID under your Dub.co Workspace Settings.
+
+<Frame>
+ <img src="/images/dub-workspace-id.png" alt="Workspace ID" />
+</Frame>
## Response Codes
diff --git a/apps/docs/images/dub-api-key.png b/apps/docs/images/dub-api-key.png
new file mode 100644
index 0000000000..e78bd5b85d
Binary files /dev/null and b/apps/docs/images/dub-api-key.png differ
diff --git a/apps/docs/images/dub-workspace-id.png b/apps/docs/images/dub-workspace-id.png
new file mode 100644
index 0000000000..931d6d5f5f
Binary files /dev/null and b/apps/docs/images/dub-workspace-id.png differ
diff --git a/apps/docs/mint.json b/apps/docs/mint.json
index c5a27d31d9..70e3e40e98 100644
--- a/apps/docs/mint.json
+++ b/apps/docs/mint.json
@@ -37,16 +37,6 @@
}
],
"anchors": [
- {
- "name": "Documentation",
- "icon": "book-open-cover",
- "url": "introduction"
- },
- {
- "name": "API Reference",
- "icon": "rectangle-terminal",
- "url": "api-reference"
- },
{
"name": "Help Center",
"icon": "question",
diff --git a/apps/web/lib/auth/index.ts b/apps/web/lib/auth/index.ts
index f643ed92a5..ca3ff0b535 100644
--- a/apps/web/lib/auth/index.ts
+++ b/apps/web/lib/auth/index.ts
@@ -142,7 +142,7 @@ export const withAuth = (
throw new DubApiError({
code: "not_found",
message:
- "Workspace id not found. Did you forget to include a `workspaceId` query parameter?",
+ "Workspace id not found. Did you forget to include a `workspaceId` query parameter? Learn more: https://d.to/id",
});
}
}
@@ -468,7 +468,7 @@ export const withSession =
throw new DubApiError({
code: "bad_request",
message:
- "Misconfigured authorization header. Did you forget to add 'Bearer '? Learn more: https://d.to/auth ",
+ "Misconfigured authorization header. Did you forget to add 'Bearer '? Learn more: https://d.to/auth",
});
}
const apiKey = authorizationHeader.replace("Bearer ", "");
diff --git a/apps/web/scripts/download-top-links.ts b/apps/web/scripts/download-top-links.ts
index 6539a4088e..8bfd68409e 100644
--- a/apps/web/scripts/download-top-links.ts
+++ b/apps/web/scripts/download-top-links.ts
@@ -7,7 +7,7 @@ import * as Papa from "papaparse";
async function main() {
const topLinks = await getAnalytics({
- projectId: "xxx",
+ workspaceId: "xxx",
endpoint: "top_links",
interval: "30d",
excludeRoot: true,