The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
docs for the links
Kiran Kc359efc30a6c
diff --git a/apps/docs/sdks/typescript/links/count.mdx b/apps/docs/sdks/typescript/links/count.mdxindex 109230f8ef..08bf35a8cf 100644--- a/apps/docs/sdks/typescript/links/count.mdx+++ b/apps/docs/sdks/typescript/links/count.mdx@@ -4,6 +4,48 @@ title: "Count"description: "Retrieve the number of links for the authenticated workspace. The provided query parameters allow filtering the returned links."---+## Arguments++<ParamField body="domain" type="string">+ The domain to filter the links by. E.g. `ac.me`. If not provided, all links+ for the workspace will be returned.+</ParamField>++<ParamField body="tagId" type="string">+ The tag ID to filter the links by. This field is deprecated – use `tagIds`+ instead.+</ParamField>++<ParamField body="tagIds" type="string">+ The tag IDs to filter the links by.+</ParamField>++<ParamField body="search" type="string">+ The search term to filter the links by. The search term will be matched+ against the short link slug and the destination URL.+</ParamField>++<ParamField body="userId" type="string">+ The user ID to filter the links by.+</ParamField>++<ParamField body="showArchived" type="boolean" default={false}>+ Whether to include archived links in the response. Defaults to `false` if not+ provided.+</ParamField>++<ParamField body="withTags" type="boolean" default={false}>+ Whether to include tags in the response. Defaults to `false` if not provided.+</ParamField>++<ParamField body="groupBy" type="string">+ The field to group the links by. Available options are `domain` and `tagId`.+</ParamField>++## Response++The number of links matching the query.+<RequestExample>```ts@@ -23,7 +65,7 @@ await dub.links.count({<ResponseExample>```ts-2+2;```</ResponseExample>diff --git a/apps/docs/sdks/typescript/links/create-many.mdx b/apps/docs/sdks/typescript/links/create-many.mdxindex d6c3ea8b2b..99af8d6ef5 100644--- a/apps/docs/sdks/typescript/links/create-many.mdx+++ b/apps/docs/sdks/typescript/links/create-many.mdx@@ -4,6 +4,96 @@ title: "CreateMany"description: "Bulk create up to 100 links for the authenticated workspace."---+import LinkResponse from "/snippets/link-response.mdx";++## Arguments++<ParamField body="url" type="string" required>+ The destination URL of the short link.+</ParamField>++<ParamField body="domain" type="string">+ The domain of the short link. If not provided, the primary domain for the+ workspace will be used (or `dub.sh` if the workspace has no domains).+</ParamField>++<ParamField body="key" type="string">+ The short link slug. If not provided, a random 7-character slug will be+ generated.+</ParamField>++<ParamField body="prefix" type="string">+ The prefix of the short link slug for randomly-generated keys (e.g. if prefix+ is `/c/`, generated keys will be in the `/c/:key` format). Will be ignored if+ key is provided.+</ParamField>++<ParamField body="archived" type="boolean" default={false}>+ Whether the short link is archived.+</ParamField>++<ParamField body="publicStats" type="boolean" default={false}>+ Whether the short link's stats are publicly accessible.+</ParamField>++<ParamField body="tagId" type="string | null">+ The unique ID of the tag assigned to the short link. This field is deprecated+ – use `tagIds` instead.+</ParamField>++<ParamField body="tagIds" type="string">+ The unique IDs of the tags assigned to the short link.+</ParamField>++<ParamField body="comments" type="string | null">+ The comments for the short link.+</ParamField>++<ParamField body="expiresAt" type="string | null">+ The date and time when the short link will expire at.+</ParamField>++<ParamField body="expiredUrl" type="string | null">+ The URL to redirect to when the short link has expired.+</ParamField>++<ParamField body="password" type="string | null">+ The password required to access the destination URL of the short link.+</ParamField>++<ParamField body="proxy" type="boolean" default="false">+ Whether the short link uses Custom Social Media Cards feature.+</ParamField>++<ParamField body="title" type="string | null">+ The title of the short link generated via `api.dub.co/metatags`. Will be used+ for Custom Social Media Cards if proxy is true.+</ParamField>++<ParamField body="description" type="string | null">+ The description of the short link generated via `api.dub.co/metatags`. Will be+ used for Custom Social Media Cards if proxy is true.+</ParamField>++<ParamField body="image" type="string | null">+ The image of the short link generated via `api.dub.co/metatags`. Will be used+ for Custom Social Media Cards if proxy is true.+</ParamField>++<ParamField body="rewrite" type="boolean" default={false}>+ Whether the short link uses link cloaking.+</ParamField>++<ParamField body="ios" type="string | null">+ The iOS destination URL for the short link for iOS device targeting.+</ParamField>++<ParamField body="android" type="string | null">+ The Android destination URL for the short link for Android device targeting.+</ParamField>++<LinkResponse />+<RequestExample>```tsdiff --git a/apps/docs/sdks/typescript/links/create.mdx b/apps/docs/sdks/typescript/links/create.mdxindex fe67896806..332174313d 100644--- a/apps/docs/sdks/typescript/links/create.mdx+++ b/apps/docs/sdks/typescript/links/create.mdx@@ -4,6 +4,96 @@ title: "Create"description: "Create a new link for the authenticated workspace."---+import LinkResponse from "/snippets/link-response.mdx";++## Arguments++<ParamField body="url" type="string" required>+ The destination URL of the short link.+</ParamField>++<ParamField body="domain" type="string">+ The domain of the short link. If not provided, the primary domain for the+ workspace will be used (or `dub.sh` if the workspace has no domains).+</ParamField>++<ParamField body="key" type="string">+ The short link slug. If not provided, a random 7-character slug will be+ generated.+</ParamField>++<ParamField body="prefix" type="string">+ The prefix of the short link slug for randomly-generated keys (e.g. if prefix+ is `/c/`, generated keys will be in the `/c/:key` format). Will be ignored if+ key is provided.+</ParamField>++<ParamField body="archived" type="boolean" default={false}>+ Whether the short link is archived.+</ParamField>++<ParamField body="publicStats" type="boolean" default={false}>+ Whether the short link's stats are publicly accessible.+</ParamField>++<ParamField body="tagId" type="string | null">+ The unique ID of the tag assigned to the short link. This field is deprecated+ – use `tagIds` instead.+</ParamField>++<ParamField body="tagIds" type="string">+ The unique IDs of the tags assigned to the short link.+</ParamField>++<ParamField body="comments" type="string | null">+ The comments for the short link.+</ParamField>++<ParamField body="expiresAt" type="string | null">+ The date and time when the short link will expire at.+</ParamField>++<ParamField body="expiredUrl" type="string | null">+ The URL to redirect to when the short link has expired.+</ParamField>++<ParamField body="password" type="string | null">+ The password required to access the destination URL of the short link.+</ParamField>++<ParamField body="proxy" type="boolean" default={false}>+ Whether the short link uses Custom Social Media Cards feature.+</ParamField>++<ParamField body="title" type="string | null">+ The title of the short link generated via `api.dub.co/metatags`. Will be used+ for Custom Social Media Cards if proxy is true.+</ParamField>++<ParamField body="description" type="string | null">+ The description of the short link generated via `api.dub.co/metatags`. Will be+ used for Custom Social Media Cards if proxy is true.+</ParamField>++<ParamField body="image" type="string | null">+ The image of the short link generated via `api.dub.co/metatags`. Will be used+ for Custom Social Media Cards if proxy is true.+</ParamField>++<ParamField body="rewrite" type="boolean" default={false}>+ Whether the short link uses link cloaking.+</ParamField>++<ParamField body="ios" type="string | null">+ The iOS destination URL for the short link for iOS device targeting.+</ParamField>++<ParamField body="android" type="string | null">+ The Android destination URL for the short link for Android device targeting.+</ParamField>++<LinkResponse />+<RequestExample>```tsdiff --git a/apps/docs/sdks/typescript/links/delete.mdx b/apps/docs/sdks/typescript/links/delete.mdxindex 1bd95b6e45..60b815c6d3 100644--- a/apps/docs/sdks/typescript/links/delete.mdx+++ b/apps/docs/sdks/typescript/links/delete.mdx@@ -4,6 +4,18 @@ title: "Delete"description: "Delete a link for the authenticated workspace."---+## Arguments++<ParamField body="linkId" type="string" required>+ The id of the link to delete. You can get this via the `links.get` method.+</ParamField>++## Response++<ResponseField name="id" type="string" required>+ The id of the link that was deleted.+</ResponseField>+<RequestExample>```tsdiff --git a/apps/docs/sdks/typescript/links/get.mdx b/apps/docs/sdks/typescript/links/get.mdxindex 993eb29e6c..d914a607ea 100644--- a/apps/docs/sdks/typescript/links/get.mdx+++ b/apps/docs/sdks/typescript/links/get.mdx@@ -4,6 +4,21 @@ title: "Get"description: "Retrieve the info for a link from their domain and key."---+import LinkResponse from "/snippets/link-response.mdx";++## Arguments++<ParamField body="domain" type="string" required>+ The domain of the link to retrieve. E.g. for `d.to/github`, the domain is+ `d.to`.+</ParamField>++<ParamField body="key" type="string" required>+ The key of the link to retrieve. E.g. for `d.to/github`, the key is `github`.+</ParamField>++<LinkResponse />+<RequestExample>```tsdiff --git a/apps/docs/sdks/typescript/links/list.mdx b/apps/docs/sdks/typescript/links/list.mdxindex e5741cb617..147b188508 100644--- a/apps/docs/sdks/typescript/links/list.mdx+++ b/apps/docs/sdks/typescript/links/list.mdx@@ -4,6 +4,54 @@ title: "List"description: "Retrieve a list of links for the authenticated workspace. The list will be paginated and the provided query parameters allow filtering the returned links."---+import LinkResponse from "/snippets/link-response.mdx";++## Arguments++<ParamField body="domain" type="string">+ The domain to filter the links by. E.g. `ac.me`. If not provided, all links+ for the workspace will be returned.+</ParamField>++<ParamField body="tagId" type="string">+ The tag ID to filter the links by. This field is deprecated – use `tagIds`+ instead.+</ParamField>++<ParamField body="tagIds" type="string">+ The tag IDs to filter the links by.+</ParamField>++<ParamField body="search" type="string">+ The search term to filter the links by. The search term will be matched+ against the short link slug and the destination URL.+</ParamField>++<ParamField body="userId" type="string">+ The user ID to filter the links by.+</ParamField>++<ParamField body="showArchived" type="boolean" default={false}>+ Whether to include archived links in the response. Defaults to `false` if not+ provided.+</ParamField>++<ParamField body="withTags" type="boolean" default={false}>+ Whether to include tags in the response. Defaults to `false` if not provided.+</ParamField>++<ParamField body="sort" type="string" default="createdAt">+ The field to sort the links by. The default is `createdAt`, and sort order is+ always descending. Available options are `createdAt`, `clicks`, and+ `lastClicked`.+</ParamField>++<ParamField body="page" type="number">+ The page number for pagination (each page contains `100` links).+</ParamField>++<LinkResponse />+<RequestExample>```tsdiff --git a/apps/docs/sdks/typescript/links/update.mdx b/apps/docs/sdks/typescript/links/update.mdxindex eea8d35006..3e4b02255e 100644--- a/apps/docs/sdks/typescript/links/update.mdx+++ b/apps/docs/sdks/typescript/links/update.mdx@@ -1,9 +1,97 @@---title: "Update""og:title": Edit a link - TypeScript SDK"-description: "Edit a link for the authenticated workspace."+description: "Edit a link for the authenticated workspace. Support partial updates."---+import LinkResponse from "/snippets/link-response.mdx";++## Arguments++<ParamField body="url" type="string">+ The destination URL of the short link.+</ParamField>++<ParamField body="domain" type="string">+ The domain of the short link.+</ParamField>++<ParamField body="key" type="string">+ The short link slug.+</ParamField>++<ParamField body="prefix" type="string">+ The prefix of the short link slug for randomly-generated keys (e.g. if prefix+ is `/c/`, generated keys will be in the `/c/:key` format). Will be ignored if+ key is provided.+</ParamField>++<ParamField body="archived" type="boolean" default="false">+ Whether the short link is archived.+</ParamField>++<ParamField body="publicStats" type="boolean" default="false">+ Whether the short link's stats are publicly accessible.+</ParamField>++<ParamField body="tagId" type="string | null">+ The unique ID of the tag assigned to the short link. This field is deprecated+ – use `tagIds` instead.+</ParamField>++<ParamField body="tagIds" type="string">+ The unique IDs of the tags assigned to the short link.+</ParamField>++<ParamField body="comments" type="string | null">+ The comments for the short link.+</ParamField>++<ParamField body="expiresAt" type="string | null">+ The date and time when the short link will expire at.+</ParamField>++<ParamField body="expiredUrl" type="string | null">+ The URL to redirect to when the short link has expired.+</ParamField>++<ParamField body="password" type="string | null">+ The password required to access the destination URL of the short link.+</ParamField>++<ParamField body="proxy" type="boolean" default="false">+ Whether the short link uses Custom Social Media Cards feature.+</ParamField>++<ParamField body="title" type="string | null">+ The title of the short link generated via `api.dub.co/metatags`. Will be used+ for Custom Social Media Cards if proxy is true.+</ParamField>++<ParamField body="description" type="string | null">+ The description of the short link generated via `api.dub.co/metatags`. Will be+ used for Custom Social Media Cards if proxy is true.+</ParamField>++<ParamField body="image" type="string | null">+ The image of the short link generated via `api.dub.co/metatags`. Will be used+ for Custom Social Media Cards if proxy is true.+</ParamField>++<ParamField body="rewrite" type="boolean" default="false">+ Whether the short link uses link cloaking.+</ParamField>++<ParamField body="ios" type="string | null">+ The iOS destination URL for the short link for iOS device targeting.+</ParamField>++<ParamField body="android" type="string | null">+ The Android destination URL for the short link for Android device targeting.+</ParamField>++<LinkResponse />+<RequestExample>```tsdiff --git a/apps/docs/snippets/link-response.mdx b/apps/docs/snippets/link-response.mdxnew file mode 100644index 0000000000..3fbe38889d--- /dev/null+++ b/apps/docs/snippets/link-response.mdx@@ -0,0 +1,157 @@+## Response++<ResponseField name="id" type="string" required>+ The unique ID of the short link.+</ResponseField>++<ResponseField name="domain" type="string" required>+ The domain of the short link. If not provided, the primary domain for the+ workspace will be used (or dub.sh if the workspace has no domains).+</ResponseField>++<ResponseField name="key" type="string" required>+ The short link slug. If not provided, a random 7-character slug will be+ generated.+</ResponseField>++<ResponseField name="url" type="string" required>+ The destination URL of the short link.+</ResponseField>++<ResponseField name="archived" type="boolean" required default="false">+ Whether the short link is archived.+</ResponseField>++<ResponseField name="expiresAt" type="string | null" required>+ The date and time when the short link will expire in ISO-8601 format.+</ResponseField>++<ResponseField name="expiredUrl" type="string | null" required>+ The URL to redirect to when the short link has expired.+</ResponseField>++<ResponseField name="password" type="string | null" required>+ The password required to access the destination URL of the short link.+</ResponseField>++<ResponseField name="proxy" type="boolean" required default="false">+ Whether the short link uses Custom Social Media Cards feature.+</ResponseField>++<ResponseField name="title" type="string | null" required>+ The title of the short link generated via api.dub.co/metatags. Will be used+ for Custom Social Media Cards if proxy is true.+</ResponseField>++<ResponseField name="description" type="string | null" required>+ The description of the short link generated via api.dub.co/metatags. Will be+ used for Custom Social Media Cards if proxy is true.+</ResponseField>++<ResponseField name="image" type="string | null" required>+ The image of the short link generated via api.dub.co/metatags. Will be used+ for Custom Social Media Cards if proxy is true.+</ResponseField>++<ResponseField name="rewrite" type="boolean" required default="false">+ Whether the short link uses link cloaking.+</ResponseField>++<ResponseField name="ios" type="string | null" required>+ The iOS destination URL for the short link for iOS device targeting.+</ResponseField>++<ResponseField name="android" type="string | null" required>+ The Android destination URL for the short link for Android device targeting.+</ResponseField>++<ResponseField name="publicStats" type="boolean" required default="false">+ Whether the short link's stats are publicly accessible.+</ResponseField>++<ResponseField name="tagId" type="string | null" required>+ The unique ID of the tag assigned to the short link. This field is deprecated+ – use `tags` instead.+</ResponseField>++<ResponseField name="tags" type="object[] | null" required>+ The tags assigned to the short link.++ <Expandable title="properties">+ <ResponseField name="tags.id" type="string" required>+ The unique ID of the tag.+ </ResponseField>++ <ResponseField name="tags.name" type="string" required>+ The name of the tag.+ </ResponseField>++ <ResponseField name="tags.color" type="string" required>+ The color of the tag.+ </ResponseField>++ </Expandable>+</ResponseField>++<ResponseField name="comments" type="string | null" required>+ The comments for the short link.+</ResponseField>++<ResponseField name="shortLink" type="string" required>+ The full URL of the short link, including the https protocol (e.g.+ `https://dub.sh/try`).+</ResponseField>++<ResponseField name="qrCode" type="string" required>+ The full URL of the QR code for the short link (e.g.+ `https://api.dub.co/qr?url=https://dub.sh/try`).+</ResponseField>++<ResponseField name="utm_source" type="string | null" required>+ The UTM source of the short link.+</ResponseField>++<ResponseField name="utm_medium" type="string | null" required>+ The UTM medium of the short link.+</ResponseField>++<ResponseField name="utm_campaign" type="string | null" required>+ The UTM campaign of the short link.+</ResponseField>++<ResponseField name="utm_term" type="string | null" required>+ The UTM term of the short link.+</ResponseField>++<ResponseField name="utm_content" type="string | null" required>+ The UTM content of the short link.+</ResponseField>++<ResponseField name="userId" type="string" required>+ The user ID of the creator of the short link.+</ResponseField>++<ResponseField name="workspaceId" type="string" required>+ The workspace ID of the short link.+</ResponseField>++<ResponseField name="clicks" type="number" required default="0">+ The number of clicks on the short link.+</ResponseField>++<ResponseField name="lastClicked" type="string | null" required>+ The date and time when the short link was last clicked.+</ResponseField>++<ResponseField name="createdAt" type="string" required>+ The date and time when the short link was created.+</ResponseField>++<ResponseField name="updatedAt" type="string" required>+ The date and time when the short link was last updated.+</ResponseField>++<ResponseField name="projectId" type="string" required>+ The project ID of the short link. This field is deprecated – use `workspaceId`+ instead.+</ResponseField>