Dub

Learn how to use Dub with Composio

Overview

SLUG: DUB

Description

Short link management platform with analytics and API for creating, managing, and tracking branded short links

Authentication Details

client_id
stringRequired
client_secret
stringRequired
oauth_redirect_uri
stringDefaults to https://backend.composio.dev/api/v1/auth-apps/add
scopes
stringDefaults to user.read,links.read,links.write
generic_api_key
stringRequired

Connecting to Dub

Create an auth config

Use the dashboard to create an auth config for the Dub toolkit. This allows you to connect multiple Dub accounts to Composio for agents to use.

1

Select App

Navigate to Dub.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Dub Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using OAuth2

1from composio import Composio
2
3# Replace these with your actual values
4dub_auth_config_id = "ac_YOUR_DUB_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/application
6
7composio = Composio()
8
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 connection_request = composio.connected_accounts.initiate(
12 user_id=user_id,
13 auth_config_id=auth_config_id,
14 )
15
16 print(
17 f"Visit this URL to authenticate Dub: {connection_request.redirect_url}"
18 )
19
20 # This will wait for the auth flow to be completed
21 connection_request.wait_for_connection(timeout=15)
22 return connection_request.id
23
24
25connection_id = authenticate_toolkit(user_id, dub_auth_config_id)
26
27# You can also verify the connection status using:
28connected_account = composio.connected_accounts.get(connection_id)
29print(f"Connected account: {connected_account}")

Using API Key

1from composio import Composio
2
3# Replace these with your actual values
4dub_auth_config_id = "ac_YOUR_DUB_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/app
6
7composio = Composio()
8
9def authenticate_toolkit(user_id: str, auth_config_id: str):
10 # Replace this with a method to retrieve an API key from the user.
11 # Or supply your own.
12 user_api_key = input("[!] Enter API key")
13
14 connection_request = composio.connected_accounts.initiate(
15 user_id=user_id,
16 auth_config_id=auth_config_id,
17 config={"auth_scheme": "API_KEY", "val": {"generic_api_key": user_api_key}}
18 )
19
20 # API Key authentication is immediate - no redirect needed
21 print(f"Successfully connected Dub for user {user_id}")
22 print(f"Connection status: {connection_request.status}")
23
24 return connection_request.id
25
26
27connection_id = authenticate_toolkit(user_id, dub_auth_config_id)
28
29# You can verify the connection using:
30connected_account = composio.connected_accounts.get(connection_id)
31print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Dub toolkit’s playground

For code examples, see the Tool calling guide and Provider examples.

Tool List

Tool Name: Create Domain

Description

Tool to add a domain to a Dub workspace. Use when you need to create a new domain for shortening links. The domain must be verified before it can be used for link shortening.

Action Parameters

appleAppSiteAssociation
archived
assetLinks
expiredUrl
logo
notFoundUrl
placeholder
slug
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Create Tag

Description

Tool to create a new tag in Dub. Use when you need to organize links by creating custom tags. Tags help categorize and filter links for better organization.

Action Parameters

color
name
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Delete Domain

Description

Tool to delete a domain from your Dub workspace. Use when you need to permanently remove a domain. The domain must exist and be owned by your workspace.

Action Parameters

slug
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Delete Tag

Description

Tool to delete a tag from Dub. Use when you need to remove a tag that is no longer needed.

Action Parameters

id
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Retrieve List of Tags

Description

Tool to retrieve a list of tags from Dub. Use when you need to fetch all tags or search for specific tags by name or IDs. Supports pagination and sorting by name or creation date.

Action Parameters

ids
page
Defaults to 1
page_size
Defaults to 100
search
sort_by
Defaults to name
sort_order
Defaults to asc

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Workspace

Description

Tool to retrieve detailed information for a specific workspace. Use when you need to get workspace details including plan, usage limits, domains, users, and configuration settings.

Action Parameters

id_or_slug
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: List Domains

Description

Tool to retrieve a list of domains for the authenticated workspace. Use when you need to view all domains, search for specific domains, or filter domains by archived status. Supports pagination for large result sets.

Action Parameters

archived
page
page_size
search

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Track Deep Link Open Event

Description

Tool to track a deep link open event in Dub. Use when you need to record when a user opens your app via a deep link. Supports both direct tracking via deepLink parameter or probabilistic tracking via dubDomain parameter.

Action Parameters

deep_link
dub_domain

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Update Domain

Description

Tool to update a domain configuration in Dub. Use when you need to modify domain settings like redirect URLs, placeholder text, archive status, or deep linking configurations.

Action Parameters

apple_app_site_association
archived
asset_links
expired_url
logo
new_slug
not_found_url
placeholder
slug
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Update Tag

Description

Tool to update an existing tag by ID. Use when you need to change the name or color of a tag.

Action Parameters

color
id
stringRequired
name

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Update Workspace

Description

Tool to update workspace settings in Dub. Use when you need to modify workspace name, slug, logo, or conversion tracking settings.

Action Parameters

conversion_enabled
id_or_slug
stringRequired
logo
name
slug

Action Response

data
objectRequired
error
successful
booleanRequired