NXCD API
URL Base de Acesso à API para produção:
https://nxcd.app
URL Base de Acesso à API para homologação:
https://staging.nxcd.app
Apis de consumo Nextcode.
Classificação ¶
Classificação de documentos ¶
Classificação de documentosPOST/document-validation/classification
Classifica um documento enviado
Example URI
POST /document-validation/classification
Request
Headers
Content-Type: multipart/form-data; boundary=--BOUNDARY
Authorization: Bearer [auth-token ou id-token]
Body
-----BOUNDARY
Content-Disposition: form-data; name="file"; filename="image.jpg"
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a
HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBD/Z
-----BOUNDARY
Response
200
Headers
Content-Type: application/json
Body
{
"id": "752e5823-120c-4b35-8f44-64990894c3fe9",
"created": "2019-05-30T19:19:42.695Z",
"classification": {
"probability": 0.9629011,
"tagName": "CNH FV"
}
}
Schema
{
"type": "object",
"additionalProperties": false,
"required": true,
"properties": {
"id": {
"type": "string"
},
"created": {
"type": "string"
},
"classification": {
"type": "object",
"properties": {
"probability": {
"type": "number"
},
"tagName": {
"type": "string",
"enum": [
"CNH F",
"CNH FV",
"CNH V",
"RG F",
"RG FV",
"RG V",
"IMPRESSOS",
"COMPRES",
"CPF"
]
}
}
}
}
}
Extração ¶
Extração de dados via url ¶
Extração de dados via urlPOST/data-extraction
Extrai dados de um arquivo enviado em uma url, uma vez que já se sabe qual é seu tipo
Example URI
POST /data-extraction
Request
Headers
Content-Type: application/json
Authorization: Bearer [auth-token ou id-token]
Body
{
"fileUrl": "url do arquivo de imagem",
"documentType": "cnh | rg"
}
Response
200
Headers
Content-Type: application/json
Body
{
"exact": {
"DATA_EXP": "14/08/2006",
"DATA_NASC": "19/05/1988",
"RG": "11.111.111-1",
"NOME": "FULANO DA SILVA",
"NOME_PAI": "CICLANO DA SILVA",
"NOME_MAE": "FULANA DA SILVA",
"FLAGS": "NAME_3_FB",
"NATURALIDADE": "RIO DE JANEIRO"
},
"fallback": {},
"missing": []
}
Schema
{
"type": "object",
"additionalProperties": false,
"required": true,
"properties": {
"exact": {
"type": "object",
"additionalProperties": true,
"required": true
},
"fallback": {
"type": "object",
"additionalProperties": true,
"required": true
},
"missing": {
"type": "array",
"items": {
"type": "string"
},
"required": true
}
}
}
Extração de dados via base64 ¶
Extração de dados via base64POST/data-extraction/base64
Extrai dados de um arquivo enviado via base64, uma vez que já se sabe qual é seu tipo
Example URI
POST /data-extraction/base64
Request
Headers
Content-Type: application/json
Authorization: Bearer [auth-token ou id-token]
Body
{
"file": "base64 do arquivo de imagem",
"documentType": "cnh | rg"
}
Response
200
Headers
Content-Type: application/json
Body
{
"exact": {
"DATA_EXP": "14/08/2006",
"DATA_NASC": "19/05/1988",
"RG": "11.111.111-1",
"NOME": "FULANO DA SILVA",
"NOME_PAI": "CICLANO DA SILVA",
"NOME_MAE": "FULANA DA SILVA",
"FLAGS": "NAME_3_FB",
"NATURALIDADE": "RIO DE JANEIRO"
},
"fallback": {},
"missing": []
}
Schema
{
"type": "object",
"additionalProperties": false,
"required": true,
"properties": {
"exact": {
"type": "object",
"additionalProperties": true,
"required": true
},
"fallback": {
"type": "object",
"additionalProperties": true,
"required": true
},
"missing": {
"type": "array",
"items": {
"type": "string"
},
"required": true
}
}
}
Extração de dados com validação do Bureau ¶
Extração de dados com validação do BureauPOST/data-extraction/validation
Extrai dados de um arquivo enviado via base64, valida seus dados contra um bureau de informações, retorna o que foi extraído, os dados do bureau e a validação de dados.
Importante: A validação de dados somente funciona para CNH. A validação de categorias somente testa para carteiras do tipo
A
(secompare.cnh.categoria == false
então carteira não é somente A)
Example URI
POST /data-extraction/validation
Request
Headers
Content-Type: application/json
Authorization: Bearer [auth-token ou id-token]
Body
{
"file": "base64 do arquivo de imagem",
"documentType": "cnh"
}
Response
200
Headers
Content-Type: application/json
Body
{
"extract": {
"exact": {
"CPF": "999.999.999-99",
"RENACH": "SP839475678",
"CONTROLE": "99999999999",
"EMISSOR": "SSP/SP",
"DATA_NASC": "06/07/1978",
"VALIDADE": "23/08/2024",
"PRIM_HAB": "20/06/2000",
"EMISSAO": "28/08/2010",
"NOME": "FULANO DA SILVA",
"RG": "09809878",
"NOME_MAE": "MAE DO FULANO DA SILVA",
"NOME_PAI": "PAI DO FULANO DA SILVA",
"REGISTRO": "10293849586",
"LOCAL": "SANTO ANDRE,SP"
},
"fallback": {},
"missing": []
},
"bureau": {
"name": "FULANO DA SILVA",
"cpf": "99999999999",
"birthDate": "1962-02-06",
"mothersName": "MAE DO FULANO DA SILVA"
},
"compare": {
"imageData": {
"disponivel": true,
"probabilidade": "Altíssima probabilidade",
"similaridade": 0.9661317639978979
},
"documentData": {
"nome": true,
"filiacao": {
"nome_mae": true,
"nome_mae_similaridade": 1
},
"endereco": {},
"documento": {
"numero": true
},
"cnh": {
"nome": true,
"categoria": false,
"nome_similaridade": 1,
"numero_registro": true,
"data_primeira_habilitacao": true,
"data_validade": true
},
"nome_similaridade": 1,
"data_nascimento": true
}
}
}
Schema
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$ref": "#/definitions/Welcome",
"definitions": {
"Welcome": {
"type": "object",
"additionalProperties": false,
"properties": {
"extract": {
"$ref": "#/definitions/Extract"
},
"bureau": {
"$ref": "#/definitions/Bureau"
},
"compare": {
"$ref": "#/definitions/Compare"
}
},
"required": [],
"title": "Welcome"
},
"Bureau": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"cpf": {
"type": "string"
},
"birthDate": {
"type": "string",
"format": "date"
},
"mothersName": {
"type": "string"
}
},
"required": [],
"title": "Bureau"
},
"Compare": {
"type": "object",
"additionalProperties": false,
"properties": {
"imageData": {
"$ref": "#/definitions/ImageData"
},
"documentData": {
"$ref": "#/definitions/DocumentData"
}
},
"required": [],
"title": "Compare"
},
"DocumentData": {
"type": "object",
"additionalProperties": false,
"properties": {
"nome": {
"type": "boolean"
},
"filiacao": {
"$ref": "#/definitions/Fallback"
},
"endereco": {
"$ref": "#/definitions/Fallback"
},
"documento": {
"$ref": "#/definitions/Fallback"
},
"cnh": {
"$ref": "#/definitions/Cnh"
},
"nome_similaridade": {
"type": "integer"
},
"data_nascimento": {
"type": "boolean"
}
},
"required": [],
"title": "DocumentData"
},
"Cnh": {
"type": "object",
"additionalProperties": false,
"properties": {
"nome": {
"type": "boolean"
},
"categoria": {
"type": "boolean"
},
"nome_similaridade": {
"type": "integer"
},
"numero_registro": {
"type": "boolean"
}
},
"required": [],
"title": "Cnh"
},
"Fallback": {
"type": "object",
"additionalProperties": false,
"title": "Fallback"
},
"ImageData": {
"type": "object",
"additionalProperties": false,
"properties": {
"disponivel": {
"type": "boolean"
},
"probabilidade": {
"type": "string"
},
"similaridade": {
"type": "number"
}
},
"required": [],
"title": "ImageData"
},
"Extract": {
"type": "object",
"additionalProperties": false,
"properties": {
"exact": {
"$ref": "#/definitions/Exact"
},
"fallback": {
"$ref": "#/definitions/Fallback"
},
"missing": {
"type": "array",
"items": {}
}
},
"required": [],
"title": "Extract"
},
"Exact": {
"type": "object",
"additionalProperties": false,
"properties": {
"NOME": {
"type": "string"
},
"RG": {
"type": "string"
},
"EMISSOR": {
"type": "string"
},
"CPF": {
"type": "string"
},
"DATA_NASC": {
"type": "string"
},
"NOME_PAI": {
"type": "string"
},
"NOME_MAE": {
"type": "string"
},
"PERMISSAO": {
"type": "string"
},
"ACC": {
"type": "string"
},
"CAT_HAB": {
"type": "string"
},
"REGISTRO": {
"type": "string"
},
"VALIDADE": {
"type": "string"
},
"PRIM_HAB": {
"type": "string"
},
"OBSERVACOES": {
"type": "string"
},
"LOCAL": {
"type": "string"
},
"EMISSAO": {
"type": "string"
},
"CONTROLE": {
"type": "string"
},
"RENACH": {
"type": "string"
}
},
"required": [],
"title": "Exact"
}
}
}