PDF access
Retrieve and consume five-minute signed document PDF URLs safely.
Documents with pdf_available: true can produce a temporary download URL:
GET /documents/{id}/pdf
The operation requires the מסמכים (documents:read) permission. It returns metadata, not the PDF bytes:
{
"data": {
"id": "813d0b3f-ab6c-43d4-9173-8f224566ba2f",
"object": "document_pdf",
"url": "https://files.daily.test/documents/invoice-1042.pdf?expires=300",
"expires_at": "2026-07-21T12:05:00.000Z",
"file_name": "invoice-1042.pdf"
},
"request_id": "req_docspdf00001"
}The signed URL expires five minutes after issue. Download immediately and never persist, log, analyze, or share it. If it expires, authenticate to Daily again and request a new URL.
Download safely with TypeScript
import { writeFile } from 'node:fs/promises';
const apiKey = process.env.DAILY_API_KEY;
if (!apiKey) throw new Error('DAILY_API_KEY is required');
const listResponse = await fetch('https://api.godaily.co.il/v1/documents?limit=100', {
headers: { Accept: 'application/json', Authorization: `Bearer ${apiKey}` },
});
const list = await listResponse.json();
if (!listResponse.ok) throw new Error(`Daily API ${listResponse.status} (${list.request_id})`);
const document = list.data.find((item: { pdf_available: boolean }) => item.pdf_available);
if (!document) throw new Error('No document with a PDF is available');
const linkResponse = await fetch(`https://api.godaily.co.il/v1/documents/${encodeURIComponent(document.id)}/pdf`, {
headers: { Accept: 'application/json', Authorization: `Bearer ${apiKey}` },
});
const link = await linkResponse.json();
if (!linkResponse.ok) throw new Error(`Daily API ${linkResponse.status} (${link.request_id})`);
const pdfResponse = await fetch(link.data.url, { redirect: 'error' });
if (!pdfResponse.ok) throw new Error(`PDF download failed with HTTP ${pdfResponse.status}`);
const contentType = pdfResponse.headers.get('content-type')?.toLowerCase();
if (contentType !== 'application/pdf') throw new Error(`Unexpected PDF content type: ${contentType ?? 'missing'}`);
const bytes = new Uint8Array(await pdfResponse.arrayBuffer());
if (bytes.length < 5 || new TextDecoder('ascii').decode(bytes.slice(0, 5)) !== '%PDF-') {
throw new Error('Downloaded content is not a PDF');
}
await writeFile(link.data.file_name, bytes, { mode: 0o600 });Download safely with Python
import os
from pathlib import Path
import requests
api_key = os.environ.get("DAILY_API_KEY")
if not api_key:
raise RuntimeError("DAILY_API_KEY is required")
headers = {"Accept": "application/json", "Authorization": f"Bearer {api_key}"}
documents_response = requests.get(
"https://api.godaily.co.il/v1/documents", params={"limit": 100}, headers=headers, timeout=30
)
documents = documents_response.json()
if not documents_response.ok:
raise RuntimeError(f"Daily API {documents_response.status_code} ({documents.get('request_id')})")
document = next((item for item in documents["data"] if item["pdf_available"]), None)
if not document:
raise RuntimeError("No document with a PDF is available")
link_response = requests.get(
f"https://api.godaily.co.il/v1/documents/{document['id']}/pdf",
headers=headers,
timeout=30,
)
link = link_response.json()
if not link_response.ok:
raise RuntimeError(f"Daily API {link_response.status_code} ({link.get('request_id')})")
pdf = requests.get(link["data"]["url"], timeout=30, allow_redirects=False)
pdf.raise_for_status()
if pdf.headers.get("Content-Type", "").split(";", 1)[0].lower() != "application/pdf":
raise RuntimeError("Unexpected PDF content type")
if not pdf.content.startswith(b"%PDF-"):
raise RuntimeError("Downloaded content is not a PDF")
target = Path(link["data"]["file_name"]).name
Path(target).write_bytes(pdf.content)
os.chmod(target, 0o600)Use a fixed download directory, sanitize the returned filename as shown, cap acceptable file size for your system, and scan untrusted files before further processing.

