Skip to main content
POST
Create a file upload session for a message attachment.

Authorizations

Authorization
string
header
required

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

Path Parameters

threadId
string
required
messageId
string
required

Body

application/json
retention
object | null

Retention for the finalized file. Duration starts at finalization; null means no expiration.

parentStorageEntryId
string

Parent folder id. Required for create mode when uploading into a folder.

Example:

"00000000-0000-4000-8000-000000000000"

storageProviderConfigId
string

Optional configured storage id for root-level uploads. Omit for managed default storage. Ignored when parentStorageEntryId is provided or when replacing an existing file.

Example:

"00000000-0000-4000-8000-000000000001"

replaceStorageEntryId
string

Existing storage entry id to replace instead of creating a new file.

Example:

"00000000-0000-4000-8000-000000000002"

replaceExpectedVersion
number

Expected current version of the file being replaced. The upload is rejected if the file changed after overwrite confirmation.

Required range: x >= 0
Example:

3

name
string

File name. Required for create mode.

Example:

"contracts.csv"

contentTypeHint
string

Expected content type.

Example:

"text/csv"

sizeHint
number

Expected size in bytes.

Required range: x >= 0
Example:

1048576

tier
enum<string>

Logical storage lifecycle tier. Select only when creating a new file or upload session; existing files keep their tier. HOT: Active files used in live workflows, previews, and frequent downloads. WARM: Completed or less-active business files that are still occasionally accessed. COLD: Compliance snapshots, historic imports, and retained evidence that is rarely opened. FROZEN: Deep archive or legal-hold data kept mainly for audit or recovery obligations.

Available options:
HOT,
WARM,
COLD,
FROZEN
Example:

"HOT"

uploadMode
enum<string>

Upload mode. Use "direct" for provider resumable uploads, "chunked" for explicit numbered parts, and "incremental" for server-assigned part numbering by default. Incremental sessions can still re-upload a specific part number when repairing an upload.

Available options:
direct,
chunked,
incremental
Example:

"incremental"

computeStats
enum<string>

Default post-finalize compute mode for this upload session.

Available options:
none,
sync,
async
Example:

"async"

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:
refId
string

Optional external reference id.

refType
string

Optional external reference type.

refVer
number

Optional external reference version.

restricted
boolean

Whether the finalized entry should be restricted.

groups
string[]

Explicit allowed group ids for the finalized entry.

users
string[]

Explicit allowed user ids for the finalized entry.

Response

200

OK.

Last modified on September 5, 2026