Create a direct upload session for a thread attachment.
Create a direct upload session for a thread attachment. The request enforces thread membership and content visibility for the authenticated caller.
curl --request POST \
--url https://api.revoengine.com/api/v1/chat/threads/{threadId}/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"retention": {
"ttlSeconds": 2,
"expiresAt": "2026-08-01T12:00:00.000Z"
},
"name": "contract.pdf",
"contentTypeHint": "application/pdf",
"sizeHint": 1048576,
"chatMessageId": "<string>",
"clientDraftId": "<string>",
"metadata": {
"source": "chat-composer"
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
retention: {ttlSeconds: 2, expiresAt: '2026-08-01T12:00:00.000Z'},
name: 'contract.pdf',
contentTypeHint: 'application/pdf',
sizeHint: 1048576,
chatMessageId: '<string>',
clientDraftId: '<string>',
metadata: {source: 'chat-composer'}
})
};
fetch('https://api.revoengine.com/api/v1/chat/threads/{threadId}/uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.revoengine.com/api/v1/chat/threads/{threadId}/uploads"
payload = {
"retention": {
"ttlSeconds": 2,
"expiresAt": "2026-08-01T12:00:00.000Z"
},
"name": "contract.pdf",
"contentTypeHint": "application/pdf",
"sizeHint": 1048576,
"chatMessageId": "<string>",
"clientDraftId": "<string>",
"metadata": { "source": "chat-composer" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)Authorizations
Bearer JWT token or API Key (sk-*).
Path Parameters
Body
Attachment file retention. Omit for no expiration, null for explicitly durable, or provide ttlSeconds/expiresAt.
Show child attributes
Show child attributes
File name. Required for create mode.
"contract.pdf"
Expected content type.
"application/pdf"
Expected size in bytes.
x >= 01048576
Optional message id when attaching to an existing chat message.
Optional client draft id used to correlate uploads in the composer. Send the returned attachment.storageUploadSessionId on message creation.
128File metadata. Values may use any JSON type. Maximum 16 KiB and 64 top-level keys. Top-level keys starting with "__" are reserved for backend use.
{ "source": "chat-composer" }
Response
OK.
curl --request POST \
--url https://api.revoengine.com/api/v1/chat/threads/{threadId}/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"retention": {
"ttlSeconds": 2,
"expiresAt": "2026-08-01T12:00:00.000Z"
},
"name": "contract.pdf",
"contentTypeHint": "application/pdf",
"sizeHint": 1048576,
"chatMessageId": "<string>",
"clientDraftId": "<string>",
"metadata": {
"source": "chat-composer"
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
retention: {ttlSeconds: 2, expiresAt: '2026-08-01T12:00:00.000Z'},
name: 'contract.pdf',
contentTypeHint: 'application/pdf',
sizeHint: 1048576,
chatMessageId: '<string>',
clientDraftId: '<string>',
metadata: {source: 'chat-composer'}
})
};
fetch('https://api.revoengine.com/api/v1/chat/threads/{threadId}/uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.revoengine.com/api/v1/chat/threads/{threadId}/uploads"
payload = {
"retention": {
"ttlSeconds": 2,
"expiresAt": "2026-08-01T12:00:00.000Z"
},
"name": "contract.pdf",
"contentTypeHint": "application/pdf",
"sizeHint": 1048576,
"chatMessageId": "<string>",
"clientDraftId": "<string>",
"metadata": { "source": "chat-composer" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
