The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update openAPI spec
Kiran K3e6bd539025e
diff --git a/apps/web/lib/openapi/analytics/browser.ts b/apps/web/lib/openapi/analytics/browser.tsindex ec7fc2f3e8..b7d406d31a 100644--- a/apps/web/lib/openapi/analytics/browser.ts+++ b/apps/web/lib/openapi/analytics/browser.ts@@ -7,7 +7,7 @@ export const getBrowserAnalytics: ZodOpenApiOperationObject = {operationId: "getBrowserAnalytics",summary: "Retrieve browser analytics",description:- "Retrieve the top browsers by number of clicks for a link, a domain, or the authenticated project.",+ "Retrieve the top browsers by number of clicks for a link, a domain, or the authenticated workspace.",requestParams: {query: getAnalyticsQuerySchema,},diff --git a/apps/web/lib/openapi/analytics/city.ts b/apps/web/lib/openapi/analytics/city.tsindex 6d17db4734..c356574afc 100644--- a/apps/web/lib/openapi/analytics/city.ts+++ b/apps/web/lib/openapi/analytics/city.ts@@ -8,7 +8,7 @@ export const getCityAnalytics: ZodOpenApiOperationObject = {operationId: "getCityAnalytics",summary: "Retrieve city analytics",description:- "Retrieve the top countries by number of clicks for a link, a domain, or the authenticated project.",+ "Retrieve the top countries by number of clicks for a link, a domain, or the authenticated workspace.",requestParams: {query: getAnalyticsQuerySchema,},diff --git a/apps/web/lib/openapi/analytics/clicks.ts b/apps/web/lib/openapi/analytics/clicks.tsindex 45146175a1..5d823570d7 100644--- a/apps/web/lib/openapi/analytics/clicks.ts+++ b/apps/web/lib/openapi/analytics/clicks.ts@@ -6,7 +6,7 @@ export const getClicksAnalytics: ZodOpenApiOperationObject = {operationId: "getClicksAnalytics",summary: "Retrieve clicks analytics",description:- "Retrieve the number of clicks for a link, a domain, or the authenticated project.",+ "Retrieve the number of clicks for a link, a domain, or the authenticated workspace.",requestParams: {query: getAnalyticsQuerySchema,},diff --git a/apps/web/lib/openapi/analytics/country.ts b/apps/web/lib/openapi/analytics/country.tsindex 9f6a09a718..0a293f4140 100644--- a/apps/web/lib/openapi/analytics/country.ts+++ b/apps/web/lib/openapi/analytics/country.ts@@ -8,7 +8,7 @@ export const getCountryAnalytics: ZodOpenApiOperationObject = {operationId: "getCountryAnalytics",summary: "Retrieve country analytics",description:- "Retrieve the top countries by number of clicks for a link, a domain, or the authenticated project.",+ "Retrieve the top countries by number of clicks for a link, a domain, or the authenticated workspace.",requestParams: {query: getAnalyticsQuerySchema,},diff --git a/apps/web/lib/openapi/analytics/device.ts b/apps/web/lib/openapi/analytics/device.tsindex 65dc0835a9..b3e422d5ad 100644--- a/apps/web/lib/openapi/analytics/device.ts+++ b/apps/web/lib/openapi/analytics/device.ts@@ -7,7 +7,7 @@ export const getDeviceAnalytics: ZodOpenApiOperationObject = {operationId: "getDeviceAnalytics",summary: "Retrieve device analytics",description:- "Retrieve the top devices by number of clicks for a link, a domain, or the authenticated project.",+ "Retrieve the top devices by number of clicks for a link, a domain, or the authenticated workspace.",requestParams: {query: getAnalyticsQuerySchema,},diff --git a/apps/web/lib/openapi/analytics/os.ts b/apps/web/lib/openapi/analytics/os.tsindex fcc381fd66..5b52e81c2f 100644--- a/apps/web/lib/openapi/analytics/os.ts+++ b/apps/web/lib/openapi/analytics/os.ts@@ -7,7 +7,7 @@ export const getOSAnalytics: ZodOpenApiOperationObject = {operationId: "getOSAnalytics",summary: "Retrieve OS analytics",description:- "Retrieve the top OS by number of clicks for a link, a domain, or the authenticated project.",+ "Retrieve the top OS by number of clicks for a link, a domain, or the authenticated workspace.",requestParams: {query: getAnalyticsQuerySchema,},diff --git a/apps/web/lib/openapi/analytics/referer.ts b/apps/web/lib/openapi/analytics/referer.tsindex df288f38a3..2e1e400d8f 100644--- a/apps/web/lib/openapi/analytics/referer.ts+++ b/apps/web/lib/openapi/analytics/referer.ts@@ -7,7 +7,7 @@ export const getRefererAnalytics: ZodOpenApiOperationObject = {operationId: "getRefererAnalytics",summary: "Retrieve referer analytics",description:- "Retrieve the top referers by number of clicks for a link, a domain, or the authenticated project.",+ "Retrieve the top referers by number of clicks for a link, a domain, or the authenticated workspace.",requestParams: {query: getAnalyticsQuerySchema,},diff --git a/apps/web/lib/openapi/analytics/timeseries.ts b/apps/web/lib/openapi/analytics/timeseries.tsindex e3de4917fd..50a9ca6797 100644--- a/apps/web/lib/openapi/analytics/timeseries.ts+++ b/apps/web/lib/openapi/analytics/timeseries.ts@@ -7,7 +7,7 @@ export const getTimeseriesAnalytics: ZodOpenApiOperationObject = {operationId: "getTimeseriesAnalytics",summary: "Retrieve timeseries analytics",description:- "Retrieve the number of clicks for a link, a domain, or the authenticated project over a period of time.",+ "Retrieve the number of clicks for a link, a domain, or the authenticated workspace over a period of time.",requestParams: {query: getAnalyticsQuerySchema,},diff --git a/apps/web/lib/openapi/analytics/top-links.ts b/apps/web/lib/openapi/analytics/top-links.tsindex dc3559969c..cbffa97b9e 100644--- a/apps/web/lib/openapi/analytics/top-links.ts+++ b/apps/web/lib/openapi/analytics/top-links.ts@@ -7,7 +7,7 @@ export const getTopLinks: ZodOpenApiOperationObject = {operationId: "getTopLinks",summary: "Retrieve top links",description:- "Retrieve the top links by number of clicks for a domain or the authenticated project.",+ "Retrieve the top links by number of clicks for a domain or the authenticated workspace.",requestParams: {query: getAnalyticsQuerySchema,},diff --git a/apps/web/lib/openapi/links/create-bulk-link.ts b/apps/web/lib/openapi/links/create-bulk-link.tsindex ffa3ba99e0..cde72cc58a 100644--- a/apps/web/lib/openapi/links/create-bulk-link.ts+++ b/apps/web/lib/openapi/links/create-bulk-link.ts@@ -2,18 +2,18 @@ import { ZodOpenApiOperationObject } from "zod-openapi";import { openApiErrorResponses } from "@/lib/openapi/responses";import z from "@/lib/zod";-import {- LinkSchema,- createLinkBodySchema,- getLinkInfoQuerySchema,-} from "@/lib/zod/schemas/links";+import { LinkSchema, createLinkBodySchema } from "@/lib/zod/schemas/links";export const createBulkLink: ZodOpenApiOperationObject = {operationId: "bulkCreateLinks",summary: "Bulk create links",- description: "Bulk create up to 100 links for the authenticated project.",+ description: "Bulk create up to 100 links for the authenticated workspace.",requestParams: {- query: getLinkInfoQuerySchema.pick({ projectSlug: true }),+ query: z.object({+ workspaceId: z+ .string()+ .describe("The ID of the workspace to create the link for."),+ }),},requestBody: {content: {diff --git a/apps/web/lib/openapi/links/create-link.ts b/apps/web/lib/openapi/links/create-link.tsindex 5ae6827d5b..d343012aab 100644--- a/apps/web/lib/openapi/links/create-link.ts+++ b/apps/web/lib/openapi/links/create-link.ts@@ -1,18 +1,19 @@import { ZodOpenApiOperationObject } from "zod-openapi";import { openApiErrorResponses } from "@/lib/openapi/responses";-import {- LinkSchema,- createLinkBodySchema,- getLinkInfoQuerySchema,-} from "@/lib/zod/schemas/links";+import z from "@/lib/zod";+import { LinkSchema, createLinkBodySchema } from "@/lib/zod/schemas/links";export const createLink: ZodOpenApiOperationObject = {operationId: "createLink",summary: "Create a new link",- description: "Create a new link for the authenticated project.",+ description: "Create a new link for the authenticated workspace.",requestParams: {- query: getLinkInfoQuerySchema.pick({ projectSlug: true }),+ query: z.object({+ workspaceId: z+ .string()+ .describe("The ID of the workspace to create the link for."),+ }),},requestBody: {content: {diff --git a/apps/web/lib/openapi/links/delete-link.ts b/apps/web/lib/openapi/links/delete-link.tsindex f2c34fef93..2520035b54 100644--- a/apps/web/lib/openapi/links/delete-link.ts+++ b/apps/web/lib/openapi/links/delete-link.ts@@ -2,14 +2,18 @@ import { ZodOpenApiOperationObject } from "zod-openapi";import { openApiErrorResponses } from "@/lib/openapi/responses";import z from "@/lib/zod";-import { getLinksQuerySchema, LinkSchema } from "@/lib/zod/schemas/links";+import { LinkSchema } from "@/lib/zod/schemas/links";export const deleteLink: ZodOpenApiOperationObject = {operationId: "deleteLink",summary: "Delete a link",- description: "Delete a link for the authenticated project.",+ description: "Delete a link for the authenticated workspace.",requestParams: {- query: getLinksQuerySchema.pick({ projectSlug: true }),+ query: z.object({+ workspaceId: z+ .string()+ .describe("The ID of the workspace to create the link for."),+ }),path: z.object({linkId: z.string().openapi({description:diff --git a/apps/web/lib/openapi/links/edit-link.ts b/apps/web/lib/openapi/links/edit-link.tsindex 46fb26e2b7..6e72f49688 100644--- a/apps/web/lib/openapi/links/edit-link.ts+++ b/apps/web/lib/openapi/links/edit-link.ts@@ -2,18 +2,18 @@ import { ZodOpenApiOperationObject } from "zod-openapi";import { openApiErrorResponses } from "@/lib/openapi/responses";import z from "@/lib/zod";-import {- LinkSchema,- createLinkBodySchema,- getLinkInfoQuerySchema,-} from "@/lib/zod/schemas/links";+import { LinkSchema, createLinkBodySchema } from "@/lib/zod/schemas/links";export const editLink: ZodOpenApiOperationObject = {operationId: "editLink",summary: "Edit a link",- description: "Edit a link for the authenticated project.",+ description: "Edit a link for the authenticated workspace.",requestParams: {- query: getLinkInfoQuerySchema.pick({ projectSlug: true }),+ query: z.object({+ workspaceId: z+ .string()+ .describe("The ID of the workspace to create the link for."),+ }),path: z.object({linkId: z.string().openapi({description:diff --git a/apps/web/lib/openapi/links/get-links-count.ts b/apps/web/lib/openapi/links/get-links-count.tsindex e2fd10696a..7f2ccc5df3 100644--- a/apps/web/lib/openapi/links/get-links-count.ts+++ b/apps/web/lib/openapi/links/get-links-count.ts@@ -7,7 +7,7 @@ export const getLinksCount: ZodOpenApiOperationObject = {operationId: "getLinksCount",summary: "Retrieve the number of links",description:- "Retrieve the number of links for the authenticated project. The provided query parameters allow filtering the returned links.",+ "Retrieve the number of links for the authenticated workspace. The provided query parameters allow filtering the returned links.",requestParams: {query: getLinksCountQuerySchema,},diff --git a/apps/web/lib/openapi/links/get-links.ts b/apps/web/lib/openapi/links/get-links.tsindex 451516ee6a..e80847fa03 100644--- a/apps/web/lib/openapi/links/get-links.ts+++ b/apps/web/lib/openapi/links/get-links.ts@@ -7,7 +7,7 @@ export const getLinks: ZodOpenApiOperationObject = {operationId: "getLinks",summary: "Retrieve a list of links",description:- "Retrieve a list of links for the authenticated project. The list will be paginated and the provided query parameters allow filtering the returned links.",+ "Retrieve a list of links for the authenticated workspace. The list will be paginated and the provided query parameters allow filtering the returned links.",requestParams: {query: getLinksQuerySchema,},diff --git a/apps/web/lib/openapi/projects/get-project-info.ts b/apps/web/lib/openapi/projects/get-project-info.tsindex 4b3b3cfb17..5220fa05a6 100644--- a/apps/web/lib/openapi/projects/get-project-info.ts+++ b/apps/web/lib/openapi/projects/get-project-info.ts@@ -5,21 +5,17 @@ import z from "@/lib/zod";import { ProjectSchema } from "@/lib/zod/schemas/projects";export const getProjectInfo: ZodOpenApiOperationObject = {- operationId: "getProject",- summary: "Retrieve a project",- description: "Retrieve a project for the authenticated user.",+ operationId: "getWorkspace",+ summary: "Retrieve a workspace",+ description: "Retrieve a workspace for the authenticated user.",requestParams: {path: z.object({- projectSlug: z- .string()- .describe(- "The slug for the project to retrieve. E.g. for `app.dub.co/acme`, the projectSlug is `acme`.",- ),+ workspaceId: z.string().describe("The ID of the workspace to retrieve."),}),},responses: {"200": {- description: "The retrieved project",+ description: "The retrieved workspace",content: {"application/json": {schema: ProjectSchema,@@ -28,6 +24,6 @@ export const getProjectInfo: ZodOpenApiOperationObject = {},...openApiErrorResponses,},- tags: ["Projects"],+ tags: ["Workspaces"],security: [{ bearerToken: [] }],};diff --git a/apps/web/lib/openapi/projects/get-projects.ts b/apps/web/lib/openapi/projects/get-projects.tsindex 9eeeaa7ccc..1b11caa6bc 100644--- a/apps/web/lib/openapi/projects/get-projects.ts+++ b/apps/web/lib/openapi/projects/get-projects.ts@@ -5,12 +5,12 @@ import z from "@/lib/zod";import { ProjectSchema } from "@/lib/zod/schemas/projects";export const getProjects: ZodOpenApiOperationObject = {- operationId: "getProjects",- summary: "Retrieve a list of projects",- description: "Retrieve a list of projects for the authenticated user.",+ operationId: "getWorkspaces",+ summary: "Retrieve a list of workspaces",+ description: "Retrieve a list of workspaces for the authenticated user.",responses: {"200": {- description: "A list of projects",+ description: "A list of workspaces",content: {"application/json": {schema: z.array(ProjectSchema),@@ -19,6 +19,6 @@ export const getProjects: ZodOpenApiOperationObject = {},...openApiErrorResponses,},- tags: ["Projects"],+ tags: ["Workspaces"],security: [{ bearerToken: [] }],};diff --git a/apps/web/lib/openapi/projects/index.ts b/apps/web/lib/openapi/projects/index.tsindex be13e1f007..03078678e0 100644--- a/apps/web/lib/openapi/projects/index.ts+++ b/apps/web/lib/openapi/projects/index.ts@@ -4,10 +4,10 @@ import { getProjectInfo } from "./get-project-info";import { getProjects } from "./get-projects";export const projectsPaths: ZodOpenApiPathsObject = {- "/projects": {+ "/workspaces": {get: getProjects,},- "/projects/{projectSlug}": {+ "/workspaces/{workspaceId}": {get: getProjectInfo,},};diff --git a/apps/web/lib/openapi/tags/create-tag.ts b/apps/web/lib/openapi/tags/create-tag.tsindex ff4b2bcfd1..513e4a0189 100644--- a/apps/web/lib/openapi/tags/create-tag.ts+++ b/apps/web/lib/openapi/tags/create-tag.ts@@ -1,15 +1,19 @@import { ZodOpenApiOperationObject } from "zod-openapi";import { openApiErrorResponses } from "@/lib/openapi/responses";-import { projectOrWorkspaceSchema } from "@/lib/zod/schemas/projects";+import z from "@/lib/zod";import { createTagBodySchema, TagSchema } from "@/lib/zod/schemas/tags";export const createTag: ZodOpenApiOperationObject = {operationId: "createTag",summary: "Create a new tag",- description: "Create a new tag for the authenticated project.",+ description: "Create a new tag for the authenticated workspace.",requestParams: {- query: projectOrWorkspaceSchema,+ query: z.object({+ workspaceId: z+ .string()+ .describe("The ID of the workspace to create the tag for."),+ }),},requestBody: {content: {diff --git a/apps/web/lib/openapi/tags/get-tags.ts b/apps/web/lib/openapi/tags/get-tags.tsindex 89bf742b87..106cea1e45 100644--- a/apps/web/lib/openapi/tags/get-tags.ts+++ b/apps/web/lib/openapi/tags/get-tags.ts@@ -2,15 +2,18 @@ import { ZodOpenApiOperationObject } from "zod-openapi";import { openApiErrorResponses } from "@/lib/openapi/responses";import z from "@/lib/zod";-import { projectOrWorkspaceSchema } from "@/lib/zod/schemas/projects";import { TagSchema } from "@/lib/zod/schemas/tags";export const getTags: ZodOpenApiOperationObject = {operationId: "getTags",summary: "Retrieve a list of tags",- description: "Retrieve a list of tags for the authenticated project.",+ description: "Retrieve a list of tags for the authenticated workspace.",requestParams: {- query: projectOrWorkspaceSchema,+ query: z.object({+ workspaceId: z+ .string()+ .describe("The ID of the workspace to retrieve the tags for."),+ }),},responses: {"200": {diff --git a/apps/web/lib/zod/schemas/analytics.ts b/apps/web/lib/zod/schemas/analytics.tsindex be5ed3b1ce..7c86d79303 100644--- a/apps/web/lib/zod/schemas/analytics.ts+++ b/apps/web/lib/zod/schemas/analytics.ts@@ -4,12 +4,10 @@ import { COUNTRY_CODES } from "@dub/utils";import { booleanQuerySchema } from ".";export const getAnalyticsQuerySchema = z.object({- projectSlug: z+ workspaceId: z.string()- .optional()- .describe(- "The slug for the project that the link belongs to. E.g. for `app.dub.co/acme`, the projectSlug is `acme`.",- ),+ .optional() // TODO: This should be required+ .describe("The ID of the workspace that the link belongs to."),domain: z.string().optional().describe("The domain of the short link."),key: z.string().optional().describe("The short link slug."),interval: zdiff --git a/apps/web/lib/zod/schemas/index.ts b/apps/web/lib/zod/schemas/index.tsindex df4c77bd46..c203f53c71 100644--- a/apps/web/lib/zod/schemas/index.ts+++ b/apps/web/lib/zod/schemas/index.ts@@ -1,11 +1,11 @@import { plans, roles } from "@/lib/types";import z from "@/lib/zod";-export const planSchema = z.enum(plans).describe("The plan of the project.");+export const planSchema = z.enum(plans).describe("The plan of the workspace.");export const roleSchema = z.enum(roles)- .describe("The role of the authenticated user in the project.");+ .describe("The role of the authenticated user in the workspace.");// A boolean query schema that coerces the value to a booleanexport const booleanQuerySchema = zdiff --git a/apps/web/lib/zod/schemas/links.ts b/apps/web/lib/zod/schemas/links.tsindex 8726758a7f..ecbe4926f1 100644--- a/apps/web/lib/zod/schemas/links.ts+++ b/apps/web/lib/zod/schemas/links.ts@@ -3,16 +3,14 @@ import { booleanQuerySchema } from ".";import { TagSchema } from "./tags";const LinksQuerySchema = {- projectSlug: z+ workspaceId: z.string()- .describe(- "The slug for the project that the link belongs to. E.g. for `app.dub.co/acme`, the projectSlug is `acme`.",- ),+ .describe("The ID of the workspace that the link belongs to."),domain: z.string().optional().describe(- "The domain to filter the links by. E.g. `ac.me`. If not provided, all links for the project will be returned.",+ "The domain to filter the links by. E.g. `ac.me`. If not provided, all links for the workspace will be returned.",),tagId: z.string()@@ -68,12 +66,10 @@ export const getLinksCountQuerySchema = z.object({});export const getLinkInfoQuerySchema = z.object({- projectSlug: z+ workspaceId: z.string()- .min(1, "Project slug is required.")- .describe(- "The slug for the project that the link belongs to. E.g. for `app.dub.co/acme`, the projectSlug is `acme`.",- ),+ .min(1, "Workspace id is required.")+ .describe("The ID of the workspace to retrieve the links for."),domain: z.string().min(1, "Domain is required.")@@ -93,7 +89,7 @@ export const createLinkBodySchema = z.object({.string().optional().describe(- "The domain of the short link. If not provided, the primary domain for the project will be used (or `dub.sh` if the project has no domains).",+ "The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the project has no domains).",),key: z.string()@@ -212,7 +208,7 @@ export const LinkSchema = zdomain: z.string().describe(- "The domain of the short link. If not provided, the primary domain for the project will be used (or `dub.sh` if the project has no domains).",+ "The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the project has no domains).",),key: z.string()@@ -325,7 +321,7 @@ export const LinkSchema = zuserId: z.string().describe("The user ID of the creator of the short link."),- projectId: z.string().describe("The project ID of the short link."),+ projectId: z.string().describe("The workspace ID of the short link."),clicks: z.number().default(0)diff --git a/apps/web/lib/zod/schemas/projects.ts b/apps/web/lib/zod/schemas/projects.tsindex e37665669d..eb0ec8fbc1 100644--- a/apps/web/lib/zod/schemas/projects.ts+++ b/apps/web/lib/zod/schemas/projects.ts@@ -3,62 +3,46 @@ import { planSchema, roleSchema } from ".";export const ProjectSchema = z.object({- id: z.string().describe("The unique ID of the project."),- name: z.string().describe("The name of the project."),- slug: z.string().describe("The slug of the project."),+ id: z.string().describe("The unique ID of the workspace."),+ name: z.string().describe("The name of the workspace."),+ slug: z.string().describe("The slug of the workspace."),logo: z.string().nullable().default(null)- .describe("The logo of the project."),- usage: z.number().describe("The usage of the project."),- usageLimit: z.number().describe("The usage limit of the project."),- linksUsage: z.number().describe("The links usage of the project."),- linksLimit: z.number().describe("The links limit of the project."),- domainsLimit: z.number().describe("The domains limit of the project."),- tagsLimit: z.number().describe("The tags limit of the project."),- usersLimit: z.number().describe("The users limit of the project."),+ .describe("The logo of the workspace."),+ usage: z.number().describe("The usage of the workspace."),+ usageLimit: z.number().describe("The usage limit of the workspace."),+ linksUsage: z.number().describe("The links usage of the workspace."),+ linksLimit: z.number().describe("The links limit of the workspace."),+ domainsLimit: z.number().describe("The domains limit of the workspace."),+ tagsLimit: z.number().describe("The tags limit of the workspace."),+ usersLimit: z.number().describe("The users limit of the workspace."),plan: planSchema,- stripeId: z.string().nullable().describe("The Stripe ID of the project."),+ stripeId: z.string().nullable().describe("The Stripe ID of the workspace."),billingCycleStart: z.number().describe(- "The date and time when the billing cycle starts for the project.",+ "The date and time when the billing cycle starts for the workspace.",),createdAt: z.date()- .describe("The date and time when the project was created."),+ .describe("The date and time when the workspace was created."),users: z.array(z.object({role: roleSchema,}),)- .describe("The role of the authenticated user in the project."),+ .describe("The role of the authenticated user in the workspace."),domains: z.array(z.object({- slug: z.string().describe("The domain of the project."),+ slug: z.string().describe("The domain of the workspace."),}),)- .describe("The domains of the project."),+ .describe("The domains of the workspace."),}).openapi({- title: "Project",+ title: "Workspace",});--// TODO:-// Update the `workspaceId` description with where to copy the ID from--export const projectOrWorkspaceSchema = z.object({- projectSlug: z- .string()- .describe(- "[DEPRECATED (use workspaceId instead)]: The slug for the project to create tags for.",- )- .optional()- .openapi({ deprecated: true }),- workspaceId: z- .string()- .describe("The ID for the workspace to create tags for."),-});