import { v4 as uuidv4 } from "uuid";
// Get markdown
const response = await fetch(
`https://api.agentoffice.dev/v1/documents/${docId}/markdown`,
{
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ readUid: uuidv4() }),
}
);
const { markdown } = await response.json();
// Search for specific content
if (markdown.includes("financial report")) {
console.log("Found financial report content");
}
// Extract headers
const headers = markdown.match(/^#{1,6} .+$/gm);
console.log("Document headers:", headers);