---
title: "Register File Upload"
method: POST
path: "/knowledge/{knowledge_base_id}/register_file"
tags: ["knowledge"]
---

# Register File Upload

`POST /knowledge/{knowledge_base_id}/register_file`

Register a file upload for a knowledge base by its id

Registering a file upload is a three step process:
1. Get upload URL (GET /v2/knowledge/{knowledge_base_id}/upload_url)
2. Upload file to the URL
3. Register file (POST /v2/knowledge/{knowledge_base_id}/register_file)

## Path parameters

- `knowledge_base_id` string, uuid, required — The id of the knowledge base to register the file for

## Request body

- RegisterFileUploadRequest
  - `filename` string, required — The filename of the file to register
  - `file_id` string, uuid, required — The id of the file to register
  - `content_type` string, required — The content type of the file to register
  - `configuration` TextProcessingConfiguration
    - `text_processing.chunk_size` integer — The chunk size to use for the document. This is the number of characters to use for the chunk. The default is 2000 characters.
    - `text_processing.chunk_overlap` integer — The chunk overlap to use for the document. This is the number of characters to overlap between chunks. The default is 200 characters.
  - `metadata` object, nullable — Optional metadata to attach to the file

## Response `201`

Successful Response

- RegisterFileUploadResponse
  - `id` string, uuid, required
  - `key` string, required
  - `original_filename` string, required
  - `document_id` integer, required
  - `metadata` object

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `402` — Payment Required (out of credits)
- `404` — Not Found
- `422` — Request Validation Error

---

[API](https://skmtc.dev/opper/apis/opper-api-v2.md) · [All operations](https://skmtc.dev/opper/apis/opper-api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/opper/opper-api-v2/revisions/d3ccdaa15678/schema)
