File Hosting Service

Simple REST API for File Hosting

Documentation

Below showing sample code to interact with the file hosting API.

Sign in to pre-fill samples with your folder ID and client ID.

UPLOADa file to a folder
const form = new FormData();
form.append('file', fileBlob, 'report.pdf');

const ret = await axios.post('https://files.8765432.top/v1/upload', form, {
  headers: {
    'folder-id': 'your-folder-id-here',
    'client-id': 'your-client-id-here'
  }
});
LISTfiles in a folder
const ret = await axios.post('https://files.8765432.top/v1', {
  type: 'list',
  limit: 100,
  skip: 0,
}, {
  headers: {
    'folder-id': 'your-folder-id-here',
    'client-id': 'your-client-id-here'
  }
});
GET INFOmetadata for one file
// by file_id
const ret = await axios.post('https://files.8765432.top/v1', {
  type: 'info',
  file_id: 'your-file-id-here',
}, {
  headers: {
    'folder-id': 'your-folder-id-here',
    'client-id': 'your-client-id-here'
  }
});

// or by filename
// { type: 'info', filename: 'report.pdf' }
DOWNLOADa file's bytes
const ret = await axios.post('https://files.8765432.top/v1', {
  type: 'download',
  file_id: 'your-file-id-here',
}, {
  headers: {
    'folder-id': 'your-folder-id-here',
    'client-id': 'your-client-id-here'
  },
  responseType: 'arraybuffer'
});
// ret.data is a Buffer/ArrayBuffer of the file bytes
// Real content type is in the X-File-Content-Type response header
RENAMEa file
const ret = await axios.post('https://files.8765432.top/v1', {
  type: 'rename',
  file_id: 'your-file-id-here',
  new_filename: 'new-name.pdf',
}, {
  headers: {
    'folder-id': 'your-folder-id-here',
    'client-id': 'your-client-id-here'
  }
});
DELETEa file
const ret = await axios.post('https://files.8765432.top/v1', {
  type: 'delete',
  file_id: 'your-file-id-here',
}, {
  headers: {
    'folder-id': 'your-folder-id-here',
    'client-id': 'your-client-id-here'
  }
});