Integrate with Dub using Python

Integrate Dub's link management infrastructure in your Python application with just a few lines of code.

Dub has helped us gain valuable insights into the link-sharing use case of Ray.so. And all of it with just a few lines of code – thanks to their native SDKs.

Thomas Paul MannThomas Paul MannCEO & Co-Founder, Raycast

Quick Start

Integrate advanced link management capabilities into your projects by checking out the documentation and installing with your preferred package manager.

pip install dub

Integrate your project seamlessly

With the Dub Python SDK, you can programmatically generate short links in just a few lines of code.

from dub import Dub

d = Dub(
    token="DUB_API_KEY"
)

d.links.create(request={
    "url": "https://google.com"
})

Explore API Endpoints

Links
Domains
Tags
More
+ 4 methods
Request
d.links.create(request={
  "url": "https://google.com",
)}
Response
{
  id: "clv3o9p9q000au1h0mc7r6l63",
  domain: "dub.sh",
  key: "e7qzMuI",
  url: "https://www.google.com",
  ...
}

Dub's API allowed us to programmatically shorten URLs with a single API call, making it easier for our community to share insights into open source.

Brandon RobertsBrandon RobertsEngineering Lead, Opensauced

All you need to get started

Check out our resources to harness the full potential of the Dub Python SDK.

Quickstart Guide

Learn how to create a short link with the Dub Python SDK.

Examples

See example apps that you can build with the Dub Python SDK.

API Reference

Learn about Dub's REST API and its features.

Supercharge your marketing efforts

See why Dub is the link management infrastructure of choice for modern marketing teams.