Create a link
create_linkCreate a short link for the authenticated workspace with optional custom slug, domain, tags, and geo or device targeting. Use it to generate trackable URLs for sharing and campaigns.
Instructions
Create a link for the authenticated workspace.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| geo | No | Geo targeting information for the short link in JSON format `{[COUNTRY]: https://example.com }`. See https://d.to/geo for more information. | |
| ios | No | The iOS destination URL for the short link for iOS device targeting. | |
| key | No | The short link slug. If not provided, a random 7-character slug will be generated. | |
| ref | No | The referral tag of the short link. If set, this will populate or override the `ref` query parameter in the destination URL. | |
| url | No | The destination URL of the short link. | |
| image | No | The custom link preview image (og:image). Will be used for Custom Link Previews if `proxy` is true. Learn more: https://d.to/og | |
| proxy | No | Whether the short link uses Custom Link Previews feature. Defaults to `false` if not provided. | |
| tagId | No | Deprecated: Use `tagIds` instead. The unique ID of the tag assigned to the short link. | |
| title | No | The custom link preview title (og:title). Will be used for Custom Link Previews if `proxy` is true. Learn more: https://d.to/og | |
| video | No | The custom link preview video (og:video). Will be used for Custom Link Previews if `proxy` is true. Learn more: https://d.to/og | |
| domain | No | The domain of the short link (without protocol). If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains). | |
| prefix | No | 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. | |
| tagIds | No | The unique IDs of the tags assigned to the short link. | |
| account | No | Exact configured private workspace profile label; not a tenant or provider account ID. | |
| android | No | The Android destination URL for the short link for Android device targeting. | |
| confirm | No | Must be true for the requested mutation or exclusive private output file. | |
| doIndex | No | Allow search engines to index your short link. Defaults to `false` if not provided. Learn more: https://d.to/noindex | |
| payload | No | Complete native JSON body; do not mix with body flags or payload_file. Arrays use repeated JSON object flags or a whole native array in a private file. | |
| rewrite | No | Whether the short link uses link cloaking. Defaults to `false` if not provided. | |
| archived | No | Whether the short link is archived. Defaults to `false` if not provided. | |
| comments | No | The comments for the short link. | |
| folderId | No | The unique ID existing folder to assign the short link to. | |
| password | No | The password required to access the destination URL of the short link. | |
| tagNames | No | The unique name of the tags assigned to the short link (case insensitive). | |
| tenantId | No | The ID of the tenant that created the link inside your system. If set, it can be used to fetch all links for a tenant. Pass `null` or an empty string to remove it. | |
| utm_term | No | The UTM term of the short link. If set, this will populate or override the UTM term in the destination URL. | |
| expiresAt | No | The date and time when the short link will expire at. | |
| keyLength | No | The length of the short link slug. Defaults to 7 if not provided. When used with `prefix`, the total length of the key will be `prefix.length + keyLength`. | |
| partnerId | No | The ID of the partner the short link is associated with. | |
| programId | No | The ID of the program the short link is associated with. | |
| expiredUrl | No | The URL to redirect to when the short link has expired. | |
| externalId | No | The ID of the link in your database. If set, it can be used to identify the link in future API requests (must be prefixed with 'ext_' when passed as a query parameter). This key is unique across your workspace. Pass `null` or an empty string to remove it. | |
| utm_medium | No | The UTM medium of the short link. If set, this will populate or override the UTM medium in the destination URL. | |
| utm_source | No | The UTM source of the short link. If set, this will populate or override the UTM source in the destination URL. | |
| webhookIds | No | Deprecated: You can now enable link.clicked webhooks for all links in a workspace or folder without passing this field manually. An array of webhook IDs to trigger when the link is clicked. These webhooks will receive click event data. | |
| description | No | The custom link preview description (og:description). Will be used for Custom Link Previews if `proxy` is true. Learn more: https://d.to/og | |
| publicStats | No | Deprecated: Use `dashboard` instead. Whether the short link's stats are publicly accessible. Defaults to `false` if not provided. | |
| utm_content | No | The UTM content of the short link. If set, this will populate or override the UTM content in the destination URL. | |
| payload_file | No | Absolute regular non-symlink JSON body file, at most 1 MiB. Cannot mix with payload/body flags. | |
| testVariants | No | An array of A/B test URLs and the percentage of traffic to send to each URL. | |
| utm_campaign | No | The UTM campaign of the short link. If set, this will populate or override the UTM campaign in the destination URL. | |
| testStartedAt | No | The date and time when the tests started. | |
| testCompletedAt | No | The date and time when the tests were or will be completed. | |
| trackConversion | No | Whether to track conversions for the short link. Defaults to `false` if not provided. |