API

Files

Upload to obtain file_id, then use with send*.

Auth: Authorization: Bearer sbot_…

POST/api/v1/bots/files/upload-credentials
Bot Token

upload-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 + stable reuseRequestId and a trusted content hit, response is uploadRequired: false plus a new logical file/file_id (physical blob reused)—skip PUT and complete
  • Miss: uploadRequired: true, uploadUrl, key, headers, expiresAt; keep the same reuseRequestId across credentials, retries, and complete
  • Possession: if a blob exists but this bot has not proven possession, response may include possessionRequired: true and possessionChallenge
POST/api/v1/bots/files/complete
Bot Token

completeS3 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 (default bot), isPublic, writeOnce, reuseRequestId (must match credentials)
  • Returns: file_id, url, thumbnail_url?, … (new logical File each registration)
GET/api/v1/bots/getFile
Bot Token

getFile

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? }