DocsFilesUpload

Upload File

Upload a new file to the system.

Endpoint

POST ${baseUrl}/files/upload

Request Body

Multipart form data with the following fields:

FieldTypeDescription
fileFileThe file to upload (required if url not provided)
urlstringThe URL of the file to upload (required if file not provided)

Response

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

Example Request

const formData = new FormData()
formData.append('file', file)
formData.append('url', 'https://example.com/file.mp3')
 
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