Skip to main content

How to get transaction images

During a transaction, several images might be created, such as images of identity documents or faces. These images are stored as binary blobs.

To get transaction images, you first need to get the transaction details to find the IDs of the image blobs, and then use those IDs to fetch the image content.

You also need to be properly authenticated; see the Authentication guide. We'll use an ACCESS_TOKEN environment variable to hold the token in this guide:

export ACCESS_TOKEN="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCI..." #cropped for readability
Regions

This article uses us-east to illustrate API calls.

Use the appropriate region for your deployment.

Getting blob IDs

Blob IDs are located in the transaction details. To get them, you first need to retrieve the transaction.

curl --url https://api.us-east.platform.microblink.com/agent/api/v1/transaction/{transactionId} --oauth2-bearer $ACCESS_TOKEN 

The response contains a state property. The state property contains the states of all workflow steps, and some of these states contain references to image blobs.

In the BlinkId and DocVer states, you can find references to the front and back images of a document, under different names:

Document scanning response (truncated)
{
"id": "0268da8495b32d6eb1be6234f1",
"state": {
"BlinkId:3": {
"extraction": {
"firstName": "JOHN",
"lastName": "DOE",
"fullDocumentFrontImage": {
"id": "68da84a08a672d6de360b703",
"contentType": "image/png",
"size": 808854
},
"fullDocumentBackImage": {
"id": "68da84a08a672d6de360b701",
"contentType": "image/png",
"size": 872354
},
"faceImage": {
"id": "68da84a08a672d6de360b6ff",
"contentType": "image/png",
"size": 196882

The id field is the blob ID you need to fetch the image content.

Getting the image content

Once you have the transaction ID and the blob ID, you can get the image content by requesting it from the blob content endpoint:

curl --url https://api.us-east.platform.microblink.com/agent/api/v1/transaction/{transactionId}/blob/{blobId}/content --oauth2-bearer $ACCESS_TOKEN --output image.png

In this example we're saving to a PNG image, but the image could also be a JPEG if it was manually uploaded.