Skip to main content
POST
/
v1
/
namespace
/
{namespaceId}
/
documents
/
{documentId}
/
file-download-url
TypeScript
import { Agentset } from "agentset";
import fs from 'fs';

const agentset = new Agentset({ apiKey: 'agentset_xxx' });
const ns = agentset.namespace('ns_xxx');

const { url } = await ns.documents.getFileDownloadUrl("doc_123");
const file = await fetch(url);
fs.writeFileSync("file.pdf", Buffer.from(await file.arrayBuffer()));
{
  "success": true,
  "data": {
    "url": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Default authentication mechanism

Path Parameters

namespaceId
string
required

The id of the namespace (prefixed with ns_)

Example:

"ns_123"

documentId
string
required

The id of the document (prefixed with doc_)

Example:

"doc_123"

Response

The presigned download URL for the file

success
boolean
required
data
object
required