API
Obter Face do Documento
Recupere em base64 a face extraída de um documento
GET
/
docs-gateway
/
api
/
v1
/
documents
/
{id}
/
face
Obter Face do Documento
curl --request GET \
--url https://api.valid.com/docs-gateway/api/v1/documents/{id}/face \
--header 'x-api-key: <api-key>'import requests
url = "https://api.valid.com/docs-gateway/api/v1/documents/{id}/face"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.valid.com/docs-gateway/api/v1/documents/{id}/face', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.valid.com/docs-gateway/api/v1/documents/{id}/face",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.valid.com/docs-gateway/api/v1/documents/{id}/face"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.valid.com/docs-gateway/api/v1/documents/{id}/face")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.valid.com/docs-gateway/api/v1/documents/{id}/face")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"faces": [
{
"docId": 262740,
"fileName": "face_262740.pdf",
"base64Content": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...",
"typeAlias": "cnh",
"typeName": "CNH"
}
]
}
{
"error": "NOT_FOUND",
"message": "Document not found",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"timestamp": "2026-06-01T12:00:00.000Z"
}
{
"error": "FACE_NOT_AVAILABLE",
"message": "Document has no backofficeBatchId yet",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"timestamp": "2026-06-01T12:00:00.000Z"
}
{
"error": "FLEXIMAGE_ERROR",
"message": "Unknown error",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"timestamp": "2026-06-01T12:00:00.000Z"
}
Path Params
Identificador do documento, retornado no envio.Exemplo:
123e4567-e89b-12d3-a456-426614174000A face fica disponível apenas depois que o documento recebe o
backofficeBatchId. Antes disso, a consulta retorna 422.Response
Faces extraídas do documento.
Identificador do arquivo no processamento.Exemplo:
262740Nome do arquivo.Exemplo:
face_262740.pdfConteúdo da face em base64, em data URI.Exemplo:
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...Alias do tipo do documento de origem.Exemplo:
cnhNome do tipo do documento de origem.Exemplo:
CNH{
"faces": [
{
"docId": 262740,
"fileName": "face_262740.pdf",
"base64Content": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...",
"typeAlias": "cnh",
"typeName": "CNH"
}
]
}
{
"error": "NOT_FOUND",
"message": "Document not found",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"timestamp": "2026-06-01T12:00:00.000Z"
}
{
"error": "FACE_NOT_AVAILABLE",
"message": "Document has no backofficeBatchId yet",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"timestamp": "2026-06-01T12:00:00.000Z"
}
{
"error": "FLEXIMAGE_ERROR",
"message": "Unknown error",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"timestamp": "2026-06-01T12:00:00.000Z"
}
⌘I
Obter Face do Documento
curl --request GET \
--url https://api.valid.com/docs-gateway/api/v1/documents/{id}/face \
--header 'x-api-key: <api-key>'import requests
url = "https://api.valid.com/docs-gateway/api/v1/documents/{id}/face"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.valid.com/docs-gateway/api/v1/documents/{id}/face', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.valid.com/docs-gateway/api/v1/documents/{id}/face",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.valid.com/docs-gateway/api/v1/documents/{id}/face"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.valid.com/docs-gateway/api/v1/documents/{id}/face")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.valid.com/docs-gateway/api/v1/documents/{id}/face")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"faces": [
{
"docId": 262740,
"fileName": "face_262740.pdf",
"base64Content": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...",
"typeAlias": "cnh",
"typeName": "CNH"
}
]
}
{
"error": "NOT_FOUND",
"message": "Document not found",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"timestamp": "2026-06-01T12:00:00.000Z"
}
{
"error": "FACE_NOT_AVAILABLE",
"message": "Document has no backofficeBatchId yet",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"timestamp": "2026-06-01T12:00:00.000Z"
}
{
"error": "FLEXIMAGE_ERROR",
"message": "Unknown error",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"timestamp": "2026-06-01T12:00:00.000Z"
}