Upload file to folder
Uploads a file to a document folder. Max 50 MB. 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. Document folders, people and organisations each have a storage limit; an upload that would exceed one returns 413 with a code naming the limit.
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
{
"file_id": "string"
}{
"file_id": "string"
}File uploaded
file_idstringResponse codes
File uploaded
objectInvalid file type or size
Unauthorized
Insufficient credits or spending limit exceeded
ErrorRequires enterprise workspace
Folder not found or access denied
Storage limit reached: the document folder, the uploading person or the organisation would exceed its storage limit. Nothing was stored.
object