Fetch Images
An introduction to fetching onboarding images
About onboarding images
Any image added to an onboarding session can be retrieved later. You can freely extract these images to store them in your own system
How are onboarding images fetched?
You have mainly 2 options to retrieve images: obtaining the images as base64 encoded images, or get temporary links (1 hour expiration) where you can fetch these images.
Fetching images as base64
To fetch the latest images (base64 encoded) for a given session, use the fetch images API endpoint; you will need to pass the session's unique interview ID, if you do not pass the interview ID, we will attempt to extract the interview ID from the Session Token.
For the payload, you only need to pass in an array with the images you wish to fetch: "images": [""]
. You can see what values are allowed inside the images
array payload in the provided link above.
You can test the endpoint yourself (and look at the available images you can request) by visiting our API documentation.
If the user has multiple images for the same type (eg: front id); the endpoint will only return the latest added one.
Sample
// 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 the 10mb you will receive a 502 error (bad gateway). See api limitations
Fetching images as links
You can also fetch the images url's to fetch them yourself. This is done via the fetch image links endpoint, just like the previous case, you need to pass the session's unique interview ID and if you do not pass the interview ID, we will attempt to extract the interview ID from the Session Token.
The payload you need to send as the body of the request is the same as the previous endpoint (the one which provides the images as base64).
Contrary to previous endpoint, this endpoint won't only fetch the latest images, but also all previous attemps for a given image type(eg: front-id will have all the attemps registered for the user of the front-id capture).
Previous attemps will be under a <type>_prevAttemps
field, which is a dictionary where the keys are numeric values representing the timestamp of when the capture was made ( unix time, in milliseconds ).
Cropped version 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 images extraction endpoints
Above samples represent some of the most common requirements to gather onboarding images. There are other endpoints related to image extraction (although 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 Id.
- Fetch concatenated images which will get all the latest images in combined in a single image.
Updated 5 months ago