Skip to main content
POST
Create a direct upload session for a thread attachment.

Authorizations

Authorization
string
header
required

Bearer JWT token or API Key (sk-*).

Path Parameters

threadId
string
required

Body

application/json
retention
object | null

Attachment file retention. Omit for no expiration, null for explicitly durable, or provide ttlSeconds/expiresAt.

name
string

File name. Required for create mode.

Example:

"contract.pdf"

contentTypeHint
string

Expected content type.

Example:

"application/pdf"

sizeHint
number

Expected size in bytes.

Required range: x >= 0
Example:

1048576

chatMessageId
string

Optional message id when attaching to an existing chat message.

clientDraftId
string

Optional client draft id used to correlate uploads in the composer. Send the returned attachment.storageUploadSessionId on message creation.

Maximum string length: 128
metadata
object

File 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.

Example:

Response

200

OK.

Last modified on September 5, 2026