Upload file to folder
Uploads a file to a document folder. Max 50 MB (25 MB for audio). Only common document, image, audio, video, text, and archive types are accepted and validated against their declared type (magic bytes); disallowed files return 400. Indexing for semantic search runs asynchronously, so a newly uploaded file may take a moment to become searchable.
POST
https://api.deutschlandgpt.de/v2/document-folders/{id}/filesExample request
curl https://api.deutschlandgpt.de/v2/document-folders/{id}/files \
-X POST \
-H "Authorization: Bearer $DGPT_API_KEY"curl https://api.deutschlandgpt.de/v2/document-folders/{id}/files \
-X POST \
-H "Authorization: Bearer $DGPT_API_KEY"import os, requests
response = requests.post(
"https://api.deutschlandgpt.de/v2/document-folders/{id}/files",
headers={"Authorization": f"Bearer {os.environ['DGPT_API_KEY']}"},
)
print(response.json())import os, requests
response = requests.post(
"https://api.deutschlandgpt.de/v2/document-folders/{id}/files",
headers={"Authorization": f"Bearer {os.environ['DGPT_API_KEY']}"},
)
print(response.json())const response = await fetch('https://api.deutschlandgpt.de/v2/document-folders/{id}/files', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DGPT_API_KEY}`,
},
});
console.log(await response.json());const response = await fetch('https://api.deutschlandgpt.de/v2/document-folders/{id}/files', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DGPT_API_KEY}`,
},
});
console.log(await response.json());Parameters
idstring<uuid>requiredDocument folder ID
Response
201application/json
{
"file_id": "string"
}{
"file_id": "string"
}File uploaded
file_idstringResponse codes
201
File uploaded
object400
Invalid file type or size
401
Unauthorized
402
Insufficient credits or spending limit exceeded
Error403
Requires enterprise workspace
404
Folder not found or access denied
Was this page helpful?