post https://api.voicecreator.ai/api/v1/knowledge-files
Create a new knowledge file from an uploaded file.
This endpoint allows uploading a file to be used as a knowledge source,
storing both the file metadata and content in the database.
Parameters:
request (Request): The FastAPI request object
name (str): The descriptive name of the document
file (UploadFile): The file to upload
db (AsyncSession): The database session
organization_id (Optional[int]): The organization ID from the API key
Returns:
KnowledgeFile: The created knowledge file
Raises:
HTTPException:
- 400: If organization ID is missing or file reading fails
- 422: If there's a validation error in the file data
- 500: If an unexpected error occurs during file creation