Download a file from a question

.md

The bytes of a file somebody attached to a question to the assistant.

Scopesai:read
GET/v1/me/ai/messages/{id}/attachments/{index}

The file itself, back to the person who attached it. Use the url of a file in a message's attachments, which is this path with the message's id and the file's index already in it.

Not JSON: the body is the file, as for a mail attachment.

Request

curl https://api.proppertrading.com/v1/me/ai/messages/aimsg_dkr8n8ctvh9qtmce/attachments/0 \
  -H "Authorization: Bearer ptat_9f2c1a44_3b8e7d2f5c9a1b4e6d8f0a2c4e6b8d1f" \
  -o chart.png

Response

HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Length: 90
Content-Disposition: attachment; filename=chart.png
X-Content-Type-Options: nosniff

The type is always octet-stream

Whatever the file is, as on the website. A file that calls itself a picture can hold anything, so decide what to do with the bytes on your side. The message already says which files are images in content_type.

Errors

StatusCodeMeaning
400workspace_requiredOur own staff, without a firm in Propper-Workspace
403ai_unavailableThe firm has the assistant switched off for this chat
403forbiddenStaff whose role does not include use_ai_chat
403insufficient_scopeThis device does not hold ai:read
404resource_not_foundNo such file, a message of somebody else or of another chat, or the file is no longer stored