API
Consultar Documento OCR
Consulte um documento OCR e os dados extraídos dele
GET
/
docs-gateway
/
api
/
v1
/
ocr
/
{id}
Consultar Documento OCR
curl --request GET \
--url https://api.valid.com/docs-gateway/api/v1/ocr/{id} \
--header 'x-api-key: <api-key>'import requests
url = "https://api.valid.com/docs-gateway/api/v1/ocr/{id}"
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/ocr/{id}', 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/ocr/{id}",
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/ocr/{id}"
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/ocr/{id}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.valid.com/docs-gateway/api/v1/ocr/{id}")
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{
"id": "123e4567-e89b-12d3-a456-426614174000",
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"projectId": "123e4567-e89b-12d3-a456-426614174002",
"productId": "123e4567-e89b-12d3-a456-426614174003",
"cpf": "12345678909",
"status": "COMPLETED",
"type": "ocr",
"createdAt": "2026-06-01T12:00:00.000Z",
"updatedAt": "2026-06-01T12:02:00.000Z",
"sentAt": "2026-06-01T12:00:01.000Z",
"sentToBackofficeAt": "2026-06-01T12:00:02.000Z",
"finishedAt": "2026-06-01T12:02:00.000Z",
"errorMessage": null,
"errorCode": null,
"backofficeBatchId": "229462",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"name": "JOAO DA SILVA",
"workflowPresetAlias": "ocr_auto_2min",
"result": null,
"docs": [
{
"docName": "CNH",
"docId": 262740,
"docType": "cnh",
"type": "identificacao",
"keys": [
{
"keyAlias": "nome",
"keyName": "Nome",
"value": "JOAO DA SILVA"
},
{
"keyAlias": "cpf",
"keyName": "CPF",
"value": "12345678909"
}
]
}
]
}
{
"error": "NOT_FOUND",
"message": "Document not found",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"timestamp": "2026-06-01T12:00:00.000Z"
}
{
"error": "INTERNAL_ERROR",
"message": "Failed to retrieve document",
"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-426614174000Response
Além dos campos descritos em Consultar Documento, a resposta traz os documentos extraídos pelo OCR.Documentos identificados na extração. Permanece vazio enquanto a extração não é concluída.
Nome do documento extraído.Exemplo:
CNHIdentificador do documento no processamento.Exemplo:
262740Tipo do documento identificado.Exemplo:
cnhClassificação atribuída ao documento na extração.Exemplo:
identificacaoCampos extraídos do documento.
Identificador do campo extraído.Exemplo:
nomeNome do campo extraído.Exemplo:
NomeValor lido no documento.Exemplo:
JOAO DA SILVA{
"id": "123e4567-e89b-12d3-a456-426614174000",
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"projectId": "123e4567-e89b-12d3-a456-426614174002",
"productId": "123e4567-e89b-12d3-a456-426614174003",
"cpf": "12345678909",
"status": "COMPLETED",
"type": "ocr",
"createdAt": "2026-06-01T12:00:00.000Z",
"updatedAt": "2026-06-01T12:02:00.000Z",
"sentAt": "2026-06-01T12:00:01.000Z",
"sentToBackofficeAt": "2026-06-01T12:00:02.000Z",
"finishedAt": "2026-06-01T12:02:00.000Z",
"errorMessage": null,
"errorCode": null,
"backofficeBatchId": "229462",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"name": "JOAO DA SILVA",
"workflowPresetAlias": "ocr_auto_2min",
"result": null,
"docs": [
{
"docName": "CNH",
"docId": 262740,
"docType": "cnh",
"type": "identificacao",
"keys": [
{
"keyAlias": "nome",
"keyName": "Nome",
"value": "JOAO DA SILVA"
},
{
"keyAlias": "cpf",
"keyName": "CPF",
"value": "12345678909"
}
]
}
]
}
{
"error": "NOT_FOUND",
"message": "Document not found",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"timestamp": "2026-06-01T12:00:00.000Z"
}
{
"error": "INTERNAL_ERROR",
"message": "Failed to retrieve document",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"timestamp": "2026-06-01T12:00:00.000Z"
}
Previous
Obter Arquivos do Documento OCRRecupere em base64 os arquivos processados de um documento OCR
Next
⌘I
Consultar Documento OCR
curl --request GET \
--url https://api.valid.com/docs-gateway/api/v1/ocr/{id} \
--header 'x-api-key: <api-key>'import requests
url = "https://api.valid.com/docs-gateway/api/v1/ocr/{id}"
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/ocr/{id}', 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/ocr/{id}",
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/ocr/{id}"
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/ocr/{id}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.valid.com/docs-gateway/api/v1/ocr/{id}")
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{
"id": "123e4567-e89b-12d3-a456-426614174000",
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"projectId": "123e4567-e89b-12d3-a456-426614174002",
"productId": "123e4567-e89b-12d3-a456-426614174003",
"cpf": "12345678909",
"status": "COMPLETED",
"type": "ocr",
"createdAt": "2026-06-01T12:00:00.000Z",
"updatedAt": "2026-06-01T12:02:00.000Z",
"sentAt": "2026-06-01T12:00:01.000Z",
"sentToBackofficeAt": "2026-06-01T12:00:02.000Z",
"finishedAt": "2026-06-01T12:02:00.000Z",
"errorMessage": null,
"errorCode": null,
"backofficeBatchId": "229462",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"name": "JOAO DA SILVA",
"workflowPresetAlias": "ocr_auto_2min",
"result": null,
"docs": [
{
"docName": "CNH",
"docId": 262740,
"docType": "cnh",
"type": "identificacao",
"keys": [
{
"keyAlias": "nome",
"keyName": "Nome",
"value": "JOAO DA SILVA"
},
{
"keyAlias": "cpf",
"keyName": "CPF",
"value": "12345678909"
}
]
}
]
}
{
"error": "NOT_FOUND",
"message": "Document not found",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"timestamp": "2026-06-01T12:00:00.000Z"
}
{
"error": "INTERNAL_ERROR",
"message": "Failed to retrieve document",
"requestId": "7d7a6f2b-8d9f-4f55-9a2d-ec8e7b4f1d0c",
"timestamp": "2026-06-01T12:00:00.000Z"
}