> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentset.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# File Uploads

> Upload files to Agentset

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.

| Type | Extensions |
| :- | :- |
| 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.

```typescript TypeScript theme={null}
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}`);

```

```python Python theme={null}
import os
from agentset import Agentset

client = Agentset(
    namespace_id="YOUR_NAMESPACE_ID",
    token=os.environ["AGENTSET_API_KEY"],
)

job = client.ingest_jobs.create(
    payload={
        "type": "FILE",
        "fileUrl": "https://example.com/document.pdf",
    }
)

print(f"Upload started: {job.data.id}")
```

## Direct upload

Upload files directly from your application using presigned URLs. This is useful when files aren't publicly accessible.

```typescript TypeScript theme={null}
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}`);

```

```python Python theme={null}
import os

with open("./document.pdf", "rb") as f:
    file = f.read()

# Get a presigned upload URL
upload = client.uploads.create(
    file_name="document.pdf",
    file_size=len(file),
    content_type="application/pdf",
)

# Upload the file
import requests
requests.put(
    upload.data.url,
    data=file,
    headers={"Content-Type": "application/pdf"},
)

# Create an ingest job for the uploaded file
job = client.ingest_jobs.create(
    payload={
        "type": "MANAGED_FILE",
        "key": upload.data.key,
        "fileName": "document.pdf",
    }
)

print(f"Upload started: {job.data.id}")
```

## With metadata

Attach metadata to your files for [filtering](https://docs.agentset.ai/search-and-retrieval/filtering.md) during search.

```typescript TypeScript theme={null}
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",
    },
  },
});
```

```python Python theme={null}
job = client.ingest_jobs.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 5 MB on the Free plan and 200 MB on paid plans.

> [!NOTE]
>
> File uploads are processed asynchronously. Learn how to [check upload
> status](https://docs.agentset.ai/data-ingestion/upload-status.md).

## Next steps

* [API Reference](https://docs.agentset.ai/api-reference/endpoint/ingest-jobs/create.md) — File upload parameters and options
* [Document Metadata](https://docs.agentset.ai/data-ingestion/document-metadata.md) — Learn more about metadata filtering
* [Chunking Settings](https://docs.agentset.ai/data-ingestion/chunking-settings.md) — Configure how files are split into chunks
* [Multimodal Input](https://docs.agentset.ai/data-ingestion/multimodal-input.md) — Process images and other media
* [Search](https://docs.agentset.ai/search-and-retrieval/search.md) — Query your uploaded content


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.