---
title: "Get a presigned S3 URL for direct file upload"
method: POST
path: "/knowledgebase/get-presigned-url"
tags: ["Knowledge Base"]
---

# Get a presigned S3 URL for direct file upload

`POST /knowledgebase/get-presigned-url`

Two-step file upload flow that bypasses Atoms' API for the file bytes themselves — useful when files exceed the multipart upload limit on `POST /knowledgebase/{id}/items/upload-media` or when you want to upload from the browser without round-tripping through your backend.

**Step 1**: Call this endpoint with file metadata. Atoms returns a presigned URL + a storage `key`.
**Step 2**: `PUT` the file bytes directly to the presigned URL (set `Content-Type` to the same value you sent here).
**Step 3**: Call [`POST /knowledgebase/compelete-file-upload`](#operation/completeKnowledgeBaseFileUpload) with the same `key` to commit the upload and start processing.

Same end result as `POST /knowledgebase/{id}/items/upload-media`, just without the multipart-through-our-API hop.

## Request body

- object
  - `fileName` string, required — Original filename — used for display in the Atoms dashboard. Doesn't have to match the S3 key.
  - `fileSize` integer, required — Size in bytes. Atoms uses this to enforce per-file limits before issuing the URL.
  - `contentType` string, required — MIME type. You must send this EXACT value as `Content-Type` on the subsequent PUT to the presigned URL.
  - `knowledgeBaseId` string, required — 24-char hex ObjectId of the target knowledge base (from `GET /knowledgebase`).

## Response `200`

Presigned URL ready — upload directly to it.

- object
  - `status` boolean
  - `data` object
    - `url` string, uri — Time-limited presigned URL. PUT the file bytes here with `Content-Type` matching what you sent above.
    - `key` string — S3 storage key — pass this back in `POST /knowledgebase/compelete-file-upload`.

## Other responses

- `400` — Invalid input
- `401` — Unauthorized access
- `500` — Internal server error

---

[API](https://skmtc.net/smallest-inc/apis/agent-management-api.md) · [All operations](https://skmtc.net/smallest-inc/apis/agent-management-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/smallest-inc/agent-management-api/versions/6d1036a76fbc/schema)
