Skip to content
On this page

Using the Quality Check route for an image

TIP

This feature is also available during the free trial.

Sometimes you want to know if an image is valid before using Receipt Analyzer. This process allows some filtering before analyzing receipts and its quick answer can be useful for example to interact with the end-user who sent the receipt to be analyzed.

Using this tool before the receipt analysis also helps you to be automatically compliant with our best practices about receipt pictures guide here.

What does this route do?

This feature receives an image as an input, and responds with a quality analysis of the image. This analysis tells you if the image is good enough to pass through our receipt analysis process.

Various properties of an image are checked that could potentially lead to bad analysis results:

  • Is this a receipt?
  • Is the image resolution good enough for the text to be read?
  • Are the sharpness, the brightness and the contrast correct?

And the route answers with a set of data that are similar to classic receipt analysis routes.

How to send an image for quality checking?

We will send this image as a good example:

You need to make a POST request to the following URL https://api.kweeri.io/v2/documents/check with the image you want to test as body.

shell
POST https://api.kweeri.io/v2/documents/check?name={document_identifier_created_by_you}
Authorization: Bearer {your_access_token}

./image.jpeg

You should get an answer like this one if your image is ok:

shell
HTTP/1.1 200 OK
{
    "uid": "16852419-7ad2-4985-bd7c-80c2103215c0",
    "name": "{document_identifier_created_by_you}",
    "status": "EXPLOITABLE",
    "processReport": "NO_ERROR",
    "imageQuality": {
        "blurness": 106,
        "contrast": 29,
        "goodSize": true,
        "luminosity": 172
    }
}

Some sample responses

A good image size, but definitely not a receipt!

Response:

json
{
  "uid": "68a77ee6-813d-4221-b664-9c18a163355c",
  "name": "chicken-test",
  "status": "NOT_EXPLOITABLE",
  "processReport": "NOT_RECEIPT",
  "imageQuality": null
}

This is a receipt but its resolution is insufficient

Response:

json
{
  "uid": "58649e0a-424d-4d3d-b0c8-511d3ba2bbb8",
  "name": "test-doc-2",
  "status": "NOT_EXPLOITABLE",
  "processReport": "BAD_QUALITY_IMAGE",
  "imageQuality": {
    "blurness": 962,
    "contrast": 69,
    "goodSize": false,
    "luminosity": 177
  }
}

Check our API documentation here for more information on this route.