Skip to main content
Upload documents to Agentset for processing. You can either provide a URL to a publicly accessible file, or upload files directly from your application.

Supported file types

Agentset supports the following file formats for ingestion.
TypeExtensions
PDF.pdf
Spreadsheet.csv, .xls, .xlsx, .ods
Word.doc, .docx, .odt
Presentation.ppt, .pptx, .odp
HTML.html, .htm
EPUB.epub
Image.png, .jpg, .jpeg, .webp, .gif, .tiff
Outlook.msg
Plain text.txt
Markdown.md
JSON.json, .jsonl
XML.xml
RSS.rss, .atom

Upload from URL

Provide a URL to a file and Agentset will fetch and process it.
import { Agentset } from "agentset";

const agentset = new Agentset({
  apiKey: process.env.AGENTSET_API_KEY,
});

const ns = agentset.namespace("YOUR_NAMESPACE_ID");

const job = await ns.ingestion.create({
  payload: {
    type: "FILE",
    fileUrl: "https://example.com/document.pdf",
  },
});

console.log(`Upload started: ${job.id}`);

Direct upload

Upload files directly from your application using presigned URLs. This is useful when files aren’t publicly accessible.
import fs from "fs";

const upload = await ns.uploads.upload({
  file: fs.createReadStream("./document.pdf"),
  contentType: "application/pdf",
});

// Create an ingest job for the uploaded file
const job = await ns.ingestion.create({
  payload: {
    type: "MANAGED_FILE",
    key: upload.key,
    fileName: "document.pdf",
  },
});

console.log(`Upload started: ${job.id}`);

With metadata

Attach metadata to your files for filtering during search.
const job = await ns.ingestion.create({
  name: "Q4 2024 Report",
  payload: {
    type: "FILE",
    fileUrl: "https://example.com/quarterly-report.pdf",
  },
  config: {
    metadata: {
      quarter: "Q4",
      year: "2024",
      type: "financial",
    },
  },
});

File size limit

The maximum file size is 200 MB.
File uploads are processed asynchronously. Learn how to check upload status.

Next steps