Skip to main content

Exporting bookmarks

Using a valid API token for the Queso browser extension can also be used for scripts, automations and even AI using the Queso Bookmarks API. In the example below we go over how to use the Queso API to bulk export bookmarks.

const token = process.env.QUESO_TOKEN;
const base = process.env.QUESO_API ?? "https://quesobookmarks.com/api/v1";

if (!token) {
throw new Error("Missing QUESO_TOKEN");
}

async function fetchAllBookmarks() {
const bookmarks = [];

for (let page = 1; page <= 50; page += 1) {
const res = await fetch(`${base}/bookmarks/?limit=100&page=${page}`, {
headers: { Authorization: `Bearer ${token}` },
});

if (!res.ok) {
throw new Error(`HTTP ${res.status}`);
}

const payload = await res.json();
bookmarks.push(...payload.data);

if (!payload.data.length) break;
}

return bookmarks;
}

fetchAllBookmarks().then((data) => {
console.log(`Exported ${data.length} bookmarks`);
});