Skip to main content
Upload a file to the Data Ingestion service. The file is stored under your account and assigned a unique ID that remains valid until expiration.

Request parameters

file
binary
required
The file content to upload (multipart form data).
expires_in_days
integer
default:"30"
Number of days until the file expires and is automatically deleted.

Upload a file

import { DataIngestionClient } from "@trelent/data-ingestion";
import { readFileSync } from "fs";

const client = new DataIngestionClient();

const fileBuffer = readFileSync("document.pdf");
const blob = new Blob([fileBuffer], { type: "application/pdf" });

const upload = await client.uploadFile(blob, "document.pdf", { expiresInDays: 7 });
console.log("File ID:", upload.id);
{
  "id": "e2d4c3d2-41c0-4a6b-a387-580807fb5ad2"
}

Response fields

id
uuid
Unique identifier for the uploaded file. Use this ID when creating jobs with the file connector.

Supported file types

The API accepts a wide range of document, video, and media formats:
CategoryFormats
OfficeDOCX, DOC, DOTX, DOTM, DOCM, PPTX, POTX, PPSX, PPTM, POTM, PPSM, XLSX, XLSM
PDFPDF
MarkupMD, HTML, HTM, XHTML, XML, NXML
DataCSV, TXT, VTT
ImagesJPG, JPEG, PNG, TIF, TIFF, BMP, WEBP
VideoMP4, AVI, MOV, WMV, MKV, FLV, WEBM, M4V
Set a shorter expires_in_days value if you only need the file for a single job. This reduces storage costs and keeps your file list clean.