KYC Download a KYC document
Download a KYC document
Returns one side of a stored document as a data URI. Get the `document_id` from the documents list. A two-sided card is two documents. Read the back image of the `BACK_SIDE` document with `side=back`.
Api-Key
Returns one side of a stored document as a data URI. Get the document_id from the documents list. A two-sided card is two documents. Read the back image of the BACK_SIDE document with side=back.
Responses can be large, up to about 13 MB. A scoped API key needs the customer:update permission.
Path parameters
NameDescription
customer_idUUID of the customer
document_idUUID of the KYC document, from the documents list
Query parameters
NameDescription
sideWhich image to return
Possible values: front, back
Response
Returns 200 OK. The document image
NameDescription
dataShow 6 child attributesobject
contentThe image as a data URI,
data:<content_type>;base64,.... Upload takes plain base64, and download returns a data URI.content_typeFile type of the stored image
Possible values: image/jpeg, image/png, application/pdf
filenameStored object name. This is not the file name you uploaded.
sideWhich side was returned
Possible values: front, back
document_idID of the document
size_bytesSize of the decoded file in bytes
errorErrors
| Status | Meaning |
|---|---|
| 200 | The document image |
| 400 | Invalid parameters |
| 404 | Customer, document or image not found |
| 500 | The image could not be read |
| 503 | Storage is not configured. Retry later. |
Was this page helpful? Yes No
Previous
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl --request GET \
--url 'https://api.gravv.xyz/v1/customers/42ad0adb-e134-4345-b4be-98e5021b0da8/kyc/documents/550e8400-e29b-41d4-a716-446655440000/download?side=front' \
--header 'Api-Key: <api-key>'
const response = await fetch('https://api.gravv.xyz/v1/customers/42ad0adb-e134-4345-b4be-98e5021b0da8/kyc/documents/550e8400-e29b-41d4-a716-446655440000/download?side=front', {
method: 'GET',
headers: {
'Api-Key': '<api-key>',
},
});
const data = await response.json();
console.log(response.status, data);
import requests
url = "https://api.gravv.xyz/v1/customers/42ad0adb-e134-4345-b4be-98e5021b0da8/kyc/documents/550e8400-e29b-41d4-a716-446655440000/download?side=front"
headers = {
"Api-Key": "<api-key>",
}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://api.gravv.xyz/v1/customers/42ad0adb-e134-4345-b4be-98e5021b0da8/kyc/documents/550e8400-e29b-41d4-a716-446655440000/download?side=front", nil)
if err != nil {
panic(err)
}
req.Header.Set("Api-Key", "<api-key>")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status)
fmt.Println(string(body))
}
require "net/http"
require "uri"
uri = URI("https://api.gravv.xyz/v1/customers/42ad0adb-e134-4345-b4be-98e5021b0da8/kyc/documents/550e8400-e29b-41d4-a716-446655440000/download?side=front")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
request = Net::HTTP::Get.new(uri)
request["Api-Key"] = "<api-key>"
response = http.request(request)
puts response.code
puts response.body
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.gravv.xyz/v1/customers/42ad0adb-e134-4345-b4be-98e5021b0da8/kyc/documents/550e8400-e29b-41d4-a716-446655440000/download?side=front',
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Api-Key: <api-key>',
],
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
echo $status, PHP_EOL, $response, PHP_EOL;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.gravv.xyz/v1/customers/42ad0adb-e134-4345-b4be-98e5021b0da8/kyc/documents/550e8400-e29b-41d4-a716-446655440000/download?side=front"))
.header("Api-Key", "<api-key>")
.GET()
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
using System.Net.Http;
using System.Text;
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.gravv.xyz/v1/customers/42ad0adb-e134-4345-b4be-98e5021b0da8/kyc/documents/550e8400-e29b-41d4-a716-446655440000/download?side=front");
request.Headers.TryAddWithoutValidation("Api-Key", "<api-key>");
using var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
Responseapplication/json
200400404500503OK
{
"data": {
"content": "data:image/png;base64,iVBORw0KGgo...",
"content_type": "image/png",
"filename": "3f9a6b2c1d.png",
"side": "front",
"document_id": "550e8400-e29b-41d4-a716-446655440000",
"size_bytes": 45230
},
"error": null
}
{
"data": null,
"error": "side is required (front or back)"
}
{
"data": null,
"error": "document not found"
}
{
"data": null,
"error": "failed to download document image"
}
{
"data": null,
"error": "storage service not configured"
}