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
The file content to upload (multipart form data).
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);
from pathlib import Path
from trelent_data_ingestion_sdk import DataIngestionClient
client = DataIngestionClient()
file_data = Path("document.pdf").read_bytes()
upload = client.upload_file(
file_data,
"document.pdf",
content_type="application/pdf",
expires_in_days=7,
)
print("File ID:", upload.id)
curl -X PUT "${API_URL}/v1/files/" \
-H "Authorization: Bearer ${API_TOKEN}" \
-F "[email protected]" \
-F "expires_in_days=7"
{
"id": "e2d4c3d2-41c0-4a6b-a387-580807fb5ad2"
}
Response fields
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:
| Category | Formats |
|---|
| Office | DOCX, DOC, DOTX, DOTM, DOCM, PPTX, POTX, PPSX, PPTM, POTM, PPSM, XLSX, XLSM |
| PDF | PDF |
| Markup | MD, HTML, HTM, XHTML, XML, NXML |
| Data | CSV, TXT, VTT |
| Images | JPG, JPEG, PNG, TIF, TIFF, BMP, WEBP |
| Video | MP4, 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.