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.

final fixes

Steven Tey30614fe438b0
diff --git a/docs/api-reference/errors.mdx b/docs/api-reference/errors.mdx
deleted file mode 100644
index 530eb543cb..0000000000
--- a/docs/api-reference/errors.mdx
+++ /dev/null
@@ -1,22 +0,0 @@
----
-title: "Errors"
-description: "Example overview page before API endpoints"
----
-
-Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas et eros iaculis tortor dapibus cursus. Curabitur quis sapien nec tortor dictum gravida.
-
-```bash
-'Authorization': 'Token <team_token>'
-```
-
-## API Tokens
-
-Nullam convallis mauris at nunc consectetur, ac imperdiet leo rutrum. Maecenas cursus purus a pellentesque blandit. Pellentesque vitae lacinia libero, non mollis metus.
-
-Nam id ullamcorper urna, at rutrum enim. [Maecenas vulputate](/introduction) vehicula libero, vitae sodales augue pretium nec. Quisque a magna tempor, semper risus vel, fermentum nunc. Pellentesque fermentum interdum ex, eu convallis massa blandit sed. Aliquam bibendum ipsum vel laoreet auctor.
-
-### Permissions
-
-Etiam lobortis ut odio ut fermentum. Nunc odio velit, sollicitudin at consectetur id, tristique eget turpis. Aliquam at risus vitae dolor sodales venenatis. In hac habitasse platea dictumst.
-
-Aenean consequat diam eget mollis fermentum. [Quisque eu malesuada](/introduction) felis, non dignissim libero.
diff --git a/docs/api-reference/introduction.mdx b/docs/api-reference/introduction.mdx
index b258b7410e..89022d320a 100644
--- a/docs/api-reference/introduction.mdx
+++ b/docs/api-reference/introduction.mdx
@@ -1,22 +1,55 @@
---
title: "Introduction"
-description: "Example overview page before API endpoints"
+description: "Fundamental concepts of the Dub API."
---
-Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas et eros iaculis tortor dapibus cursus. Curabitur quis sapien nec tortor dictum gravida.
+## Base URL
-```bash
-'Authorization': 'Token <team_token>'
+Dub's API is built on REST principles and is served over HTTPS. To ensure data privacy, unencrypted HTTP is not supported.
+
+The Base URL for all API endpoints is:
+
+```
+https://api.dub.co
+```
+
+## Authentication
+
+Authentication to the Dub 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:
+
+```
+Authorization: Bearer <Your-Token>
```
-## API Tokens
+You can get your token under your [Dub Account Settings](https://app.dub.co/settings/tokens).
+
+## Response Codes
+
+The API returns standard HTTP response codes to indicate the success or failure of an API request. Here are a few examples:
+
+| Code | Description |
+| ----- | ---------------------------------------------------------------------------------------------- |
+| `200` | The request was successful. |
+| `400` | The request was invalid or cannot be served. |
+| `401` | The request requires user authentication. |
+| `403` | The server understood the request, but refuses to authorize it. |
+| `404` | The requested resource could not be found. |
+| `429` | Too many requests. |
+| `500` | The server encountered an unexpected condition which prevented it from fulfilling the request. |
+
+## Rate Limit
-Nullam convallis mauris at nunc consectetur, ac imperdiet leo rutrum. Maecenas cursus purus a pellentesque blandit. Pellentesque vitae lacinia libero, non mollis metus.
+Dub's API rate limiting is in conformance with the [IETF standard](https://datatracker.ietf.org/doc/html/draft-ietf-httpapi-ratelimit-headers):
-Nam id ullamcorper urna, at rutrum enim. [Maecenas vulputate](/introduction) vehicula libero, vitae sodales augue pretium nec. Quisque a magna tempor, semper risus vel, fermentum nunc. Pellentesque fermentum interdum ex, eu convallis massa blandit sed. Aliquam bibendum ipsum vel laoreet auctor.
+| Header Name | Description |
+| ----------------------- | ------------------------------------------------------------------------------- |
+| `X-RateLimit-Limit` | The maximum number of requests that the consumer is permitted to make per hour. |
+| `X-RateLimit-Remaining` | The number of requests remaining in the current rate limit window. |
+| `X-RateLimit-Reset` | The time at which the current rate limit window resets in UTC epoch seconds. |
+| `Retry-After` | The number of seconds to wait before retrying the request again. |
-### Permissions
+Dub's API is capped at **10 requests per second** per user.
-Etiam lobortis ut odio ut fermentum. Nunc odio velit, sollicitudin at consectetur id, tristique eget turpis. Aliquam at risus vitae dolor sodales venenatis. In hac habitasse platea dictumst.
+This is implemented to ensure a fair usage policy so that excessive use by a single user does not adversely affect the performance and usage of the API by others.
-Aenean consequat diam eget mollis fermentum. [Quisque eu malesuada](/introduction) felis, non dignissim libero.
+You'll receive a `429 Too Many Requests` response code if the rate limit is exceeded.
diff --git a/docs/api-reference/rate-limits.mdx b/docs/api-reference/rate-limits.mdx
deleted file mode 100644
index 7a082a8547..0000000000
--- a/docs/api-reference/rate-limits.mdx
+++ /dev/null
@@ -1,22 +0,0 @@
----
-title: "Rate Limits"
-description: "Example overview page before API endpoints"
----
-
-Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas et eros iaculis tortor dapibus cursus. Curabitur quis sapien nec tortor dictum gravida.
-
-```bash
-'Authorization': 'Token <team_token>'
-```
-
-## API Tokens
-
-Nullam convallis mauris at nunc consectetur, ac imperdiet leo rutrum. Maecenas cursus purus a pellentesque blandit. Pellentesque vitae lacinia libero, non mollis metus.
-
-Nam id ullamcorper urna, at rutrum enim. [Maecenas vulputate](/introduction) vehicula libero, vitae sodales augue pretium nec. Quisque a magna tempor, semper risus vel, fermentum nunc. Pellentesque fermentum interdum ex, eu convallis massa blandit sed. Aliquam bibendum ipsum vel laoreet auctor.
-
-### Permissions
-
-Etiam lobortis ut odio ut fermentum. Nunc odio velit, sollicitudin at consectetur id, tristique eget turpis. Aliquam at risus vitae dolor sodales venenatis. In hac habitasse platea dictumst.
-
-Aenean consequat diam eget mollis fermentum. [Quisque eu malesuada](/introduction) felis, non dignissim libero.
diff --git a/docs/mint.json b/docs/mint.json
index feec4209d9..46a19980b4 100644
--- a/docs/mint.json
+++ b/docs/mint.json
@@ -49,11 +49,7 @@
"navigation": [
{
"group": "API Reference",
- "pages": [
- "api-reference/introduction",
- "api-reference/rate-limits",
- "api-reference/errors"
- ]
+ "pages": ["api-reference/introduction"]
},
{
"group": "Links",
@@ -65,6 +61,9 @@
]
}
],
+ "feedback": {
+ "thumbsRating": true
+ },
"footerSocials": {
"twitter": "https://twitter.com/dubdotco",
"github": "https://github.com/steven-tey/dub",
diff --git a/pages/api/index.ts b/pages/api/index.ts
index b775cc71ab..c1260bf576 100644
--- a/pages/api/index.ts
+++ b/pages/api/index.ts
@@ -24,10 +24,6 @@ export default async function handler(): Promise<
url: "https://api.dub.co",
description: "Production API",
},
- {
- url: "https://api.dub.sh",
- description: "Staging API",
- },
],
paths: {
"/links": {
@@ -331,12 +327,6 @@ export default async function handler(): Promise<
Link: {
type: "object",
properties: {
- id: {
- type: "string",
- format: "cuid",
- description: "The unique ID of the short link.",
- readOnly: true,
- },
domain: {
type: "string",
description: "The domain of the short link.",