API Reference

The File Object

File is a document, image or generic file that is stored in your Dotfile workspace and attached to an entity.

Upload a file and use it for checks

For Document or Identity Document checks you need to send File to process. This is pretty simple, here the 2 steps to do it:

First upload your file with our upload API. You will get an upload_ref you can use in any upload_ref input.

{
	"upload_ref": "dG1wL3Rlc3QtMTY3NDE0MjAzMjMxNy5wZGYsYXBwbGljYXRpb24vcGRmLHRlc3QucGRm"
}

Second in the request body that needs an upload_ref for example on create Document check:

{
  "company_id": "a7402197-0314-4c8f-8146-15ec0fa02193",
  "settings": {
    "document_type": "financial_statements"
  },
  "data": {
    "files": [
      {
        "upload_ref": "dG1wL3Rlc3QtMTY3NDE0MjAzMjMxNy5wZGYsYXBwbGljYXRpb24vcGRmLHRlc3QucGRm"
      }
    ]
  }
}

And you’re done ✅

Download a File

You can get and download any file with the *_file_id you can find on another response. It will stream you a binary/octet-stream File.

Here is an example in NodeJs to download and save a file:

import { saveAs } from 'file-saver';
import { axios } from 'axios';

const file = {
  id: '07cc0ad3-99a6-4395-887f-92a2c7cbd129',
  name: 'report.pdf'
}

// Download from API
// @NOTE don't forget to configure X-DOTFILE-API-KEY header with your API key in axios client 
const res = await axios.get(`/v1/files/${file.id}`, {
  responseType: 'blob',
  headers: {
    'X-DOTFILE-API-KEY': 'dotkey....' 
  }
});

// Save file
saveAs(res.data, file.name);

Actions available with the API