API
Files
Upload to obtain file_id, then use with send*.
Auth: Authorization: Bearer sbot_…
POST
Bot Token/api/v1/bots/files/upload-credentialsupload-credentialsApply for S3 Upload Credentials
Issue S3 pre-signed upload credentials—the first step for media. Supports content-reuse skip-upload.
- Required:
fileName,fileSize(bytes),checksum(full-file 64-char SHA-256 hex) - Optional:
fileType(MIME),metadata,reuseRequestId(recommended stable idempotency key),reuseExisting(legacy compat, optional),isPublic,writeOnce - Reuse: with a valid
checksum+ stablereuseRequestIdand a trusted content hit, response isuploadRequired: falseplus a new logicalfile/file_id(physical blob reused)—skip PUT and complete - Miss:
uploadRequired: true,uploadUrl,key,headers,expiresAt; keep the samereuseRequestIdacross credentials, retries, and complete - Possession: if a blob exists but this bot has not proven possession, response may include
possessionRequired: trueandpossessionChallenge
POST
Bot Token/api/v1/bots/files/completecompleteS3 Upload Completion Registration
After the client PUT finishes, register the object and obtain `file_id` for `sendPhoto` / `sendDocument`. Skip this call when credentials already returned `uploadRequired: false`.
- Required:
key,fileName,fileSize,checksum(64-char SHA-256 hex) - Optional:
fileType,category(defaultbot),isPublic,writeOnce,reuseRequestId(must match credentials) - Returns:
file_id,url,thumbnail_url?, … (new logical File each registration)
GET
Bot Token/api/v1/bots/getFilegetFile
Get platform file metadata (including temp download URL) by `file_id`.
- Required query:
file_id - Returns:
{ file_id, file_name, mime_type, file_size, url, thumbnail_url? }
