apps/web/guides/rest-api.md
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:
https://api.dub.co
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:
Authorization: Bearer dub_xxxxxx
Here are examples of how to make a request to Dub's API using Node.js:
const response = await fetch("https://api.dub.co/links", {
method: "GET",
headers: {
Authorization: "Bearer dub_xxxxxx",
},
});
const data = await response.json();