Use the upload method to upload a file.

try {
  const file = /* your file data */; // Your file input or Blob.
  const directoryId = 'directory_id_here'; // The ID of the target directory.
  const labels = ['label1', 'label2']; // An array of labels (optional).

  const response = await sdk.file.upload(file, directoryId, labels);
  console.log(response.data); // Uploaded file details
} catch (error) {
  console.error(error.message);
}

Params

  • file (formData): The file data to be uploaded.
  • directoryId (string): The ID of the target directory.
  • labels (string[], optional): An array of labels. (Used for organizing and filtering files.)

Required API Key Permission

  • Upload File