Image/File · Standard API · eKYC Core

Download image

GET/v1/images/{image_id}

Retrieves an original uploaded image by its image_id, as raw binary or as base64.

Request

MethodGET
Path/v1/images/{image_id}
Content-Typeapplication/json
Auth requiredYes — HMAC signing

{image_id} is the id returned by Upload image. To get the image as base64 instead of binary, send this header:

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

Sample request

curl -X GET \
https://tv-staging.trustingsocial.com/api/v1/images/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 image 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.
400request_time_too_skewedThe X-TV-Timestamp header is expired, need a newer one.
400invalid_parameter_exceptionInput parameter violates a constraint.
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 on the Overview lists the codes for the eKYC Core surface as a whole — the two lists do not match on every endpoint.