Fetch Images
An introduction to fetching images from an Incode onboarding session
What are onboarding images
Any image added to an onboarding session can be retrieved later. Depending the configured flow, images could include selfies, document images, and so on. You can extract these images to store them in your own system.
How can I fetch onboarding images?
Incode offers two main options:
- Obtaining images as base64 encoded images
- Get temporary links to a URL where you can fetch these images. The links last for only one hour.
Fetching images as base64
Use the fetch images API endpoint. You should always pass the session's unique interview ID, also called the Session ID. If you do not pass the interview ID, Incode attempts to extract it from the Session Token.
For the payload, pass an array with the images you wish to fetch: "images": [""]. You can see what values are allowed inside the images array payload in fetch images API endpoint documentation. You can also test the endpoint yourself at this link.
If the user has multiple images of the same type, such as front id, the endpoint will only return the most recently added image.
This sample JSON file shows a formatted request body and response body.
// request body
{
"images": [
"selfie",
"fullFrameFrontID"
]
}
// response body
{
"selfie": "<base64_image>",
"fullFrameFrontID": "<base64_image>"
}
Fetch as few images as possible per request.If the response exceeds 10 MB, you will receive a 502 error (bad gateway). See api limitations for more information.
Fetching images as links
Use the fetch image links endpoint. You should always pass the session's unique interview ID, also called the Session ID. If you do not pass the interview ID, Incode attempts to extract it from the Session Token.
For the payload, pass an array with the images you wish to fetch: "images": [""].
When you choose to fetch image links, the response includes all previous attempts for a given image type, For example, front-id will have all the attempts registered for the user of the front-id capture.
Previous attempts are listed under a <type>_prevAttemps field. This is a dictionary where the keys are numeric values representing the timestamp of when the capture was made, shown in unix time, in milliseconds.
Cropped versions of images are not available for this endpoint.
Sample
// request body
{
"images": [
"selfie",
"fullFrameFrontID"
]
}
// response body
{
"fullFrameFrontID": "<url_latest>",
"fullFrameFrontID_prevAttempts": {
"1713571344335": "<url_latest>", // latest timestamp, same link as above (fullFrameFrontID)
"1713571314141": "<url>"
},
"selfie": "<url_latest>",
"selfie_prevAttempts": {
"1713571323431": "<url_latest>" // succeeded on first try, same link as above (selfie)
}
}Other image extraction endpoints
The preceding endpoints can meet the most common requirements to gather onboarding images. Incode offers two additional endpoints related to image extraction, although these are less likely to be needed:
- Second Id's images is required if your flow is configured to have two ID documents attached to the same session. This will provide you with images related to the second IId.
- Fetch concatenated images fetches all the latest images combined in a single image.
Updated 3 days ago
