Skip to content

Download an attachment

GET
/chats/{chat}/messages/{message}/files/{file}/download
curl --request GET \
--url https://chat.work.optidata.cloud/api/chats/36/messages/176/files/4821/download \
--header 'Authorization: Bearer <token>'

The same bytes as the inline endpoint, streamed as an attachment download. Streaming means a large file starts arriving immediately and is never held whole in memory, so this is the endpoint to use for anything sizeable.

chat
required
integer format: int64

Numeric id of the conversation.

message
required
integer format: int64

Numeric id of the message.

file
required
string

The attachment’s numeric id, or its hash. A value made only of digits is read as an id, anything else as a hash.

The file content, as a download.

Media typeapplication/octet-stream
string format: binary

Missing, malformed or expired authentication key.

Media typeapplication/json

Authentication failures — and a few permission denials — use an error key rather than message.

object
error
required
string
Examples
Examplemissing

No bearer token sent

{
"error": "JWT passport exception: Missing bearer token in request"
}

The caller is not a participant of the conversation, or lacks the role the operation requires.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examples
Exampledenied
{
"message": "This action is unauthorized."
}

The resource does not exist, or does not belong to the given conversation.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examples
Examplemissing
{
"message": "No query results for model [App\\Models\\Chat\\Chat] 99999999"
}

Rate limit exceeded. Retry after the window resets.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examples
Examplethrottled
{
"message": "Too Many Attempts."
}