Upload file to Custom GPT
Uploads and links a file to a Custom GPT. Max 50 MB. Only common document, image, audio, video, text, and archive types are accepted and validated against their declared type (magic bytes); disallowed or mismatched files return 400. A Custom GPT holds at most 10 images; uploading another image returns 409.
POST
https://api.deutschlandgpt.de/v2/custom-gpts/{id}/filesExample request
curl https://api.deutschlandgpt.de/v2/custom-gpts/{id}/files \
-X POST \
-H "Authorization: Bearer $DGPT_API_KEY"curl https://api.deutschlandgpt.de/v2/custom-gpts/{id}/files \
-X POST \
-H "Authorization: Bearer $DGPT_API_KEY"import os, requests
response = requests.post(
"https://api.deutschlandgpt.de/v2/custom-gpts/{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/custom-gpts/{id}/files",
headers={"Authorization": f"Bearer {os.environ['DGPT_API_KEY']}"},
)
print(response.json())const response = await fetch('https://api.deutschlandgpt.de/v2/custom-gpts/{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/custom-gpts/{id}/files', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DGPT_API_KEY}`,
},
});
console.log(await response.json());Parameters
idstring<uuid>requiredCustom GPT ID
Response
201application/json
{
"file_id": "string"
}{
"file_id": "string"
}File uploaded and linked
file_idstringResponse codes
201
File uploaded and linked
object400
Invalid file type or size
401
Unauthorized
402
Insufficient credits or spending limit exceeded
Error404
Custom GPT not found or access denied
409
The Custom GPT already holds the maximum of 10 images
ErrorWas this page helpful?