Introduction
Fundamental concepts of Dub’s API.
Dub’s API is now generally available. Read the announcement.
Base URL
Dub’s API is built on REST principles and is served over HTTPS. To ensure data privacy, unencrypted HTTP is not supported.
The Base URL for all API endpoints is:
Authentication
Authentication to Dub’s API is performed via the Authorization header with a Bearer token. To authenticate, you need to include the Authorization header with the word Bearer
followed by your API key in your requests like so:
Here are examples of how to authenticate with Dub’s API in different programming languages:
Learn more about how to get your API key.
Native SDKs
Dub offers native SDKs in some of the most popular programming languages:
You can find the full list of SDKs here.
Error Handling
Dub API returns machine readable error codes, human readable error messages and a link to the docs for more information.
Here is how an error response looks like:
Here is a list of all error codes Dub API returns:
Pagination
Dub’s API supports pagination. This is useful when you have a large number of resources and you want to retrieve them in smaller chunks.
These list API methods share a common set of parameters that allow you to control the number of items returned and the page number. For example, you can:
Parameters
The page number to retrieve. By default, the first page is returned.
The number of items to retrieve per page. The default value varies by endpoint. Maximum value is 100.
The field to sort the results by.
The order to sort the results by. Can be asc
or desc
.
Example
The following example demonstrates how to retrieve the first page of 10 links:
Was this page helpful?