Document Detection

Detecting documents in the images and preprocessing them.


Document Detection is one of the intelligence services of Filestack platform. You can detect your document in the image, transform it to fully fit the image, and preprocess it such as de-noising and distortion reduction in order to increase the accuracy of OCR engine in text extraction. You can learn more about the technology behind this feature in Document Detection blog post.

Document Detection API can only accept images with the resolution no more than 2000x2000 pixels.

Task Configuration

Visit Creating Workflows Tutorial to learn how you can use Workflows UI to configure your tasks and logic between them.

Document Detection task is available under Intelligence tasks category.


Task Name string Unique name of the task. It will be included in the webhook response and can be used to build logic below.


Document Detection task returns following response to the workflow:

    "url": "the URL where the image is stored",
    "mimetype": "image/<image_format>",
    "size": "image size"


url string Indicates the result file URL.
mimetype string Indictaes the result file type and its format.
size integer Indictaes result file size in bytes.

Considering the response from the task, you can build logic that tells the workflow how dependent tasks should be executed. For example, if you would like to implement another task if the image size is greater than or equal to a specific value, you can use the following rule:

size gte 300000

In Workflows UI this command looks like the following exaple:

You can visit Creating Workflows Tutorial to learn how to use Workflows UI to configure your tasks and logic between them.


Below you can find an example webhook payload for a Document Detection task on a sample image:

    "id": 67015448,
    "action": "fs.workflow",
    "timestamp": 1551981663,
    "text": {
        "workflow": "0a3c0172-e7d5-4994-a6e0-b02hs7hv3p0q",
        "createdAt": "2019-03-07T16:28:13.520745456Z",
        "updatedAt": "2019-03-07T16:28:15.452548223Z",
        "sources": [
        "results": {
            "doc_detection_1551973696993": {
                "url": "",
                "mimetype": "image/jpeg",
                "size": 351697
    "status": "Finished"

Please visit the webhooks documentation page to learn more.