Image/File · eKYC Core

Download file

GET/v1/files/{file_id}

Retrieves an original uploaded file — video, audio or PDF — by its file_id, as raw binary or as base64.

Request

MethodGET
Path/v1/files/{file_id}
Content-Typeapplication/json
Auth requiredYes — HMAC signing

{file_id} is the id returned by Upload video/audio/frames. To get the file as base64 instead of binary, send this header:

HeaderTypeRequiredDescription
X-DOWNLOAD-BASE64boolOptionalspecify flag true if need base64 content like data:video/mp4;base64,iVBORw0KGgoAAAANSU...

Sample request

curl -X GET \
https://tv-staging.trustingsocial.com/api/v1/files/7db00808-0416-45cf-a5cb-3b6dfbd7bb74 \
-H 'Authorization: TV <YOUR ACCESS KEY>:<CREATED SIGNATURE>' \
-H 'X-TV-Timestamp: 2019-04-21T18:00:15+07:00' \
-H 'Content-Type: application/json'

Response

On success the HTTP status code is 200 and the body is the file as binary content. Only an error answers in JSON:

JavaScript
{
    "data": {},
    "errors": [
        {
            "code": string,
            "message": string,
            "detail": {
                "field": string, // optional, which parameter is invalid.
                ... // any other information that can be useful for client
            },
        },
        ... // other errors
    ]
}

Failure codes

In case of error, the data will be empty, and server sends following HTTP status code and error information:

HTTP codeError codeDescription
401access_denied_exceptionYou are not authorized to perform the action.
400invalid_parameter_exceptionInput parameter violates a constraint.
400request_time_too_skewedThe X-TV-Timestamp header is expired, need a newer one.
404image_not_found_exceptionThe image ID is not found in DB.
408request_timeout_exceptionRequest takes too long to process
429rate_limit_exceptionThe number of requests exceeded your throughput limit.
500internal_server_errorSome unexpected error occurs while processing the request

The codes above are the ones documented for this endpoint. Response errors lists the codes for the eKYC Core surface as a whole — the two lists do not match on every endpoint.