Examples for files upload into conversations in GPTs API
Starting a Conversation
1.
2.
3.
data: {"message": {"id": "b63eacbc-a225-4dee-9498-eb62a5950786", "author": {"role": "assistant", "name": null, "metadata": {}}, "create_time": 1727273868.262348, "update_time": null, "content": {"content_type": "text", "parts": ["Hello! How can I assist you today?"]}, "status": "in_progress", "end_turn": null, "weight": 1.0, "metadata": {"citations": [], "content_references": [], "gizmo_id": null, "message_type": "next", "model_slug": "gpt-4o", "default_model_slug": "gpt-4o", "pad": "AAAAAAAAAAAAAAAAAAAAAAAAAA", "parent_id": "8cc00bc8-c9d3-4362-841e-ffbed24aca60", "model_switcher_deny": []}, "recipient": "all", "channel": null}, "conversation_id": "66f41b8c-0d58-800b-8dfb-da993cc5fbfb", "error": null}
4.
{
"code": 200,
"data": {
"file_name": "DINSTXPN8D]HG280Y(BCX`2.png",
"file_id": "file-gEHVo1KU9irGjZCbdARYUFy2",
"file_size": 121851
},
"message": "success"
}
Creating a conversation with file
Conversation with image files
{
"content": {
"content_type": "multimodal_text",
"parts": [
{
"content_type": "image_asset_pointer",
"asset_pointer": "file-service://file-gEHVo1KU9irGjZCbdARYUFy2",
"size_bytes": 121851,
"width": 128,
"height": 128
},
"describe this image"
]
},
"metadata": {
"attachments": [
{
"name": "DINSTXPN8D]HG280Y(BCX`2.png",
"id": "file-gEHVo1KU9irGjZCbdARYUFy2",
"size": 121851,
"mimeType": "image/png",
"width": 128,
"height": 128
}
]
}
}
1.
2.
3.
"content": {
"content_type": "multimodal_text",
"parts": [
{
"content_type": "image_asset_pointer",
"asset_pointer": "file-service://file-otNCSKxKA5LwzE839wbJZbTc",
"size_bytes": 57766,
"width": 271,
"height": 325
},
{
"content_type": "image_asset_pointer",
"asset_pointer": "file-service://file-HO3i69pHaQZEiWdKzUAxAr9M",
"size_bytes": 8205,
"width": 128,
"height": 128
},
"Test_test_test"
]
},
"metadata": {
"attachments": [
{
"id": "file-otNCSKxKA5LwzE839wbJZbTc",
"size": 57766,
"name": ")JUM75}DS$IG`OESMUGD3Q8.png",
"mime_type": "image/png",
"width": 271,
"height": 325
},
{
"id": "file-HO3i69pHaQZEiWdKzUAxAr9M",
"size": 8205,
"name": "mai.png",
"mime_type": "image/png",
"width": 128,
"height": 128
}
]
}
Conversation with txt files
{
"content": {
"content_type": "text",
"parts": [
"describe this file"
]
},
"metadata": {
"attachments": [
{
"name": "hello.txt",
"id": "file-WHgV7URVkoI7iJnpgg0dVU2D",
"size": 12,
//"file_size_tokens": 4,
"mime_type": "text/plain"
}
]
}
}
Conversation with PDF files
{
"content": {
"content_type": "text",
"parts": [
"describe this file"
]
},
"metadata": {
"attachments": [
{
"name": "hello.pdf",
"id": "file-WHgV7URVkoI7iJnpgg0dVU2D",
"size": 12,
"mime_type": "application/pdf"
}
]
}
}
Conversation with word files
{
"content": {
"content_type": "text",
"parts": [
"describe this file"
]
},
"metadata": {
"attachments": [
{
"name": "hello.docx",
"id": "file-WHgV7URVkoI7iJnpgg0dVU2D",
"size": 12,
"mime_type": "application/pdf"
}
]
}
}
Conversation with excel files
{
"content": {
"content_type": "text",
"parts": [
"describe this file"
]
},
"metadata": {
"attachments": [
{
"name": "work.xlsx",
"id": "file-WHgV7URVkoI7iJnpgg0dVU2D",
"size": 121,
"mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
}
]
}
}
Subsequent Conversations
{
"parent_message_id": "",
"content": {
"content_type": "text",
"parts": [
"What is the picture I just sent"
]
}
}
Modified at 6 months ago