Returns the media file associated with the specific media Id = {id}
To get the media Id of a specific media file, request a list of media from GET attempts/{attemptId}/media or GET sessions/{sessionId}/media endpoint. The specific media file's id is in images.id
or videos.id
parameter.
Note about the size of images captured with the end-user flow
- All images with one edge larger that 1920px are proportionally reduced, so the longer edge is max 1920px
- There should be no size limits to the images when downloading
- There should be no resolution limits when downloading, except the fact that images >1920px were reduced
Note: always ensure that you use the correct API URL to send requests. See the API URL section for more info.
Your integration's API key (occasionally referred to the "Token", "API public key" or "Publishable key")
Media id signed with the shared secret key
Media id
Media file
Bad request
Unauthorized
Media not found
Internal server error
Sample how to store response data to file (image or video)
Below is a simple example how to download media with Node.js and save the data to file.
This is applicable for both video and image files. Just make sure to use correct file extension which you can find in the response of GET sessions/{id}/media call, as images.mimetype
or video.mimetype
.
media_url = '/v1/media/05cfc122-15d8-4838-bbf1-7b26a736b2d2'
headers = {
'X-AUTH-CLIENT': 'API-PUBLIC-KEY',
'X-HMAC-SIGNATURE': '452bfca0e02f8ee0f56d97373cc6971067e43149f1b7e58b681d4e57353a2f6b',
'Content-Type': 'application/json',
}
response = requests.get(media_url, headers=headers)
with open('media_filename.webm', 'wb') as media_file:
for chunk in response.iter_content():
media_file.write(chunk)
Image files
Sample how to download image files to file.
media_url = '/v1/media/2b3b3a9f-d73d-445a-aabe-9b41c1c1a2ac'
headers = {
'X-AUTH-CLIENT': 'API-PUBLIC-KEY',
'X-HMAC-SIGNATURE': '452bfca0e02f8ee0f56d97373cc6971067e43149f1b7e58b681d4e57353a2f6b',
'Content-Type': 'application/json',
}
response = requests.get(media_url, headers=headers)
with open('image_file_name.jpg', 'wb') as write_file:
write_file.write(response.content)
Video files
Sample how to download video files to file.
media_url = '/v1/media/05cfc122-15d8-4838-bbf1-7b26a736b2d2'
headers = {
'X-AUTH-CLIENT': 'API-PUBLIC-KEY',
'X-HMAC-SIGNATURE': '452bfca0e02f8ee0f56d97373cc6971067e43149f1b7e58b681d4e57353a2f6b',
'Content-Type': 'application/json',
}
response = requests.get(media_url, headers=headers)
with open('media_filename.webm', 'wb') as media_file:
for chunk in response.iter_content():
media_file.write(chunk)