DocsFilesUpload

Upload File

Upload a new file to the system.

Endpoint

POST ${baseUrl}/files/upload

Request Body

Multipart form data with the following fields:

FieldTypeRequiredDescription
fileFileConditionalThe file to upload. Required if url is not provided. Cannot be combined with url.
urlstringConditionalThe URL of the file to upload. Required if file is not provided. Cannot be combined with file.
filenamestringNoPreferred filename to save the file as. For URL uploads, used as the base name; the extension is inferred from the URL or content type.
headersstringNoJSON-encoded object of HTTP headers to send when fetching url (e.g. Authorization for private S3/links). Ignored for direct file uploads.
durationstringNoDuration of the audio/video in seconds. Used only with the internal ScribieDotComUpload flow.

Response

interface FileUploadResponse {
  success: boolean
  data: {
    fileId: string
  }
}

Example Request

// Direct file upload
const formData = new FormData()
formData.append('file', file)
 
const response = await fetch('${baseUrl}/files/upload', {
  method: 'POST',
  headers: {
    Authorization: 'Basic YOUR_API_KEY',
  },
  body: formData,
})
 
const data = await response.json()
// URL upload with custom filename and auth headers
const formData = new FormData()
formData.append('url', 'https://example.com/private-file.mp3')
formData.append('filename', 'deposition-2026-04-24')
formData.append(
  'headers',
  JSON.stringify({ Authorization: 'Bearer SOURCE_TOKEN' }),
)
 
const response = await fetch('${baseUrl}/files/upload', {
  method: 'POST',
  headers: {
    Authorization: 'Basic YOUR_API_KEY',
  },
  body: formData,
})
 
const data = await response.json()

Error Codes

Status CodeDescription
201File Uploaded Successfully
400Invalid File or Request
401Unauthorized
413File Too Large
415Unsupported File Type
500Server Error