Download an Accreditation File
1 min
Download an Accreditation File
Downloads a single accreditation document as a file.
GET
https://equidefi.io/api/v1/investments/{investmentId}/accreditation-documents/{documentId}
import { writeFile } from "node:fs/promises";
const response = await fetch(
"https://equidefi.io/api/v1/investments/{investmentId}/accreditation-documents/{documentId}",
{
method: "GET",
headers: {
Authorization: `Bearer ${process.env.EQUIDEFI_API_KEY}`,
},
}
);
// Filename comes from the Content-Disposition header
const filename =
response.headers.get("content-disposition")?.match(/filename="(.+)"/)?.[1] ??
"document";
const buffer = Buffer.from(await response.arrayBuffer());
await writeFile(filename, buffer);