https://txtfetch.com/sources/dropbox/
Extract text from Dropbox
A four-hour link, minted by a token that never leaves your side. Here's how a document actually gets from Dropbox to a txtfetch response.
The problem
A file inside Dropbox sits behind your own account, the same as any private store. get_temporary_link trades that private access for a plain, unauthenticated URL, good for a few hours. That trade is what lets ?url= reach it at all.
?url=, and why
| Pre-authenticated URL? | Yes — the returned temporary link |
|---|---|
| txtfetch path | ?url= |
| Link lifetime | About four hours, then 410 Gone |
| The trap | Refreshing the access token that generated the link can cut a live link short. |
get_temporary_link returns a direct link that needs no login. Generating it needs your own access token, but only the returned URL goes to txtfetch.
How it works
Call /2/files/get_temporary_link with your own access token and the file's path. The response carries a link field with a direct URL. Pass that URL to txtfetch's ?url= parameter right away, since it stops working after about four hours and then returns 410 Gone.
the script
A plain HTTP call against Dropbox's own REST API, then a plain call to txtfetch. No vendor SDK either side.
import os
import requests
headers = {"Authorization": f"Bearer {os.environ['DROPBOX_ACCESS_TOKEN']}"}
link = requests.post(
"https://api.dropboxapi.com/2/files/get_temporary_link",
headers={**headers, "Content-Type": "application/json"},
json={"path": "/reports/q3.pdf"},
)
link.raise_for_status()
temporary_url = link.json()["link"]
r = requests.post(
"https://api.txtfetch.com/v1/extract",
headers={"Authorization": f"Bearer {os.environ['TXTFETCH_KEY']}"},
params={"url": temporary_url},
)
print(r.json()["extracted_text"])const dbxRes = await fetch("https://api.dropboxapi.com/2/files/get_temporary_link", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.DROPBOX_ACCESS_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ path: "/reports/q3.pdf" }),
});
const { link: temporaryUrl } = await dbxRes.json();
const endpoint = new URL("https://api.txtfetch.com/v1/extract");
endpoint.searchParams.set("url", temporaryUrl);
const res = await fetch(endpoint, {
method: "POST",
headers: { Authorization: `Bearer ${process.env.TXTFETCH_KEY}` },
});
const { extracted_text } = await res.json();
console.log(extracted_text);txtfetch ships no connector, plugin, or client for Dropbox. The script above is the whole integration. Fetch the document with Dropbox's own API, then hand it to txtfetch, the same as any other source of text.
frequently asked questions
- Does txtfetch have a Dropbox connector?
- No. txtfetch ships no Dropbox connector. get_temporary_link already returns a plain URL, so ?url= reaches it with no extra step.
- Does txtfetch ever see my Dropbox access token?
- No. Your own code calls get_temporary_link and keeps the access token. Only the returned, unauthenticated link goes to txtfetch.
- Why did a link that worked an hour ago suddenly fail?
- It likely passed the four-hour mark and now returns 410 Gone. Generate a fresh link right before each txtfetch call instead of reusing an old one.
Related
- Integrations, for wiring this into a no-code automation platform instead of a script.
- Ingest into a vector store, for where the extracted text goes next.
- Async jobs & webhooks, for a source that's large or slow to fetch.
- Error reference, for what a failed
?url=fetch returns.
Point it at your Dropbox files.
Pass a signed URL and the text comes back. There is no connector to install.
Get an API key →