MENU navbar-image

Introduction

BrSafe's RESTful Service Documentation

Base URL

http://localhost

Authenticating requests

In this API, authentication is done by including username and password in the header with the keys "user" and "password".

Index

List the indexes

requires authentication

Authenticate user and retrieve list of indexes

Example request:
curl --request POST \
    "https://service.brsafe.com.br/ws-rest/v1/indexadores/gerar" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "user: fr12345" \
    --header "password: 123456" \
    --data "{
    \"tipoDocumento\": \"omnis\",
    \"uf\": \"DF\",
    \"codUsuario\": \"hic\",
    \"codReanalise\": \"earum\"
}"
const url = new URL(
    "https://service.brsafe.com.br/ws-rest/v1/indexadores/gerar"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "user": "fr12345",
    "password": "123456",
};

let body = {
    "tipoDocumento": "omnis",
    "uf": "DF",
    "codUsuario": "hic",
    "codReanalise": "earum"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'https://service.brsafe.com.br/ws-rest/v1/indexadores/gerar',
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'user' => 'fr12345',
            'password' => '123456',
        ],
        'json' => [
            'tipoDocumento' => 'omnis',
            'uf' => 'DF',
            'codUsuario' => 'hic',
            'codReanalise' => 'earum',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://service.brsafe.com.br/ws-rest/v1/indexadores/gerar'
payload = {
    "tipoDocumento": "omnis",
    "uf": "DF",
    "codUsuario": "hic",
    "codReanalise": "earum"
}
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'user': 'fr12345',
  'password': '123456'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request   

POST ws-rest/v1/indexadores/gerar

Body Parameters

tipoDocumento  string optional  

Document type

uf  string optional  

State - Max 2 digits

codUsuario  string optional  

User Code

codReanalise  string optional  

Reanalysis code

Queries

Query protocol data

requires authentication

Query protocol data by code

Example request:
curl --request POST \
    "https://service.brsafe.com.br/ws-rest/v1/protocolo/consultar" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "user: fr12345" \
    --header "password: 123456" \
    --data "{
    \"cod_protocolo\": \"repudiandae\"
}"
const url = new URL(
    "https://service.brsafe.com.br/ws-rest/v1/protocolo/consultar"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "user": "fr12345",
    "password": "123456",
};

let body = {
    "cod_protocolo": "repudiandae"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'https://service.brsafe.com.br/ws-rest/v1/protocolo/consultar',
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'user' => 'fr12345',
            'password' => '123456',
        ],
        'json' => [
            'cod_protocolo' => 'repudiandae',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://service.brsafe.com.br/ws-rest/v1/protocolo/consultar'
payload = {
    "cod_protocolo": "repudiandae"
}
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'user': 'fr12345',
  'password': '123456'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request   

POST ws-rest/v1/protocolo/consultar

Body Parameters

cod_protocolo  string optional  

Protocol

Check the status of an analysis

requires authentication

Example request:
curl --request POST \
    "https://service.brsafe.com.br/ws-rest/v1/analise/status" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "user: fr12345" \
    --header "password: 123456" \
    --data "{
    \"cod_usuario\": \"rerum\",
    \"cod_pdv\": \"consequatur\",
    \"num_cpfcnpj\": 9
}"
const url = new URL(
    "https://service.brsafe.com.br/ws-rest/v1/analise/status"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "user": "fr12345",
    "password": "123456",
};

let body = {
    "cod_usuario": "rerum",
    "cod_pdv": "consequatur",
    "num_cpfcnpj": 9
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'https://service.brsafe.com.br/ws-rest/v1/analise/status',
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'user' => 'fr12345',
            'password' => '123456',
        ],
        'json' => [
            'cod_usuario' => 'rerum',
            'cod_pdv' => 'consequatur',
            'num_cpfcnpj' => 9,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://service.brsafe.com.br/ws-rest/v1/analise/status'
payload = {
    "cod_usuario": "rerum",
    "cod_pdv": "consequatur",
    "num_cpfcnpj": 9
}
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'user': 'fr12345',
  'password': '123456'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request   

POST ws-rest/v1/analise/status

Body Parameters

cod_usuario  string  

User of the attendant who performed the scan

cod_pdv  string  

Code of the store in which the scan user is associated

num_cpfcnpj  integer  

Customer's CPF/CNPJ

List user records

requires authentication

List record of a given user according to the contract number, protocol or CPF

Example request:
curl --request POST \
    "https://service.brsafe.com.br/ws-rest/v1/analise/protocolo" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "user: fr12345" \
    --header "password: 123456" \
    --data "{
    \"cpf\": 1,
    \"protocolo\": 13,
    \"contrato\": 10,
    \"max_time\": 1,
    \"campos\": {
        \"cod_loja\": \"quae\",
        \"cod_vendedor\": 9,
        \"cod_udid\": 10,
        \"cod_agencia\": 3,
        \"cod_conta\": 14,
        \"cod_dac\": 6,
        \"nom_segmento\": \"quae\",
        \"nom_situacao\": \"maxime\",
        \"des_produto\": \"voluptatem\",
        \"des_titularidade\": \"sunt\",
        \"num_cpfcnpj_empresa\": 3,
        \"nom_nome\": \"necessitatibus\",
        \"des_justificativa\": \"veniam\",
        \"dat_contrato\": \"iure\",
        \"dat_nascimento\": \"tempora\",
        \"cod_id_contrato\": 13
    }
}"
const url = new URL(
    "https://service.brsafe.com.br/ws-rest/v1/analise/protocolo"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "user": "fr12345",
    "password": "123456",
};

let body = {
    "cpf": 1,
    "protocolo": 13,
    "contrato": 10,
    "max_time": 1,
    "campos": {
        "cod_loja": "quae",
        "cod_vendedor": 9,
        "cod_udid": 10,
        "cod_agencia": 3,
        "cod_conta": 14,
        "cod_dac": 6,
        "nom_segmento": "quae",
        "nom_situacao": "maxime",
        "des_produto": "voluptatem",
        "des_titularidade": "sunt",
        "num_cpfcnpj_empresa": 3,
        "nom_nome": "necessitatibus",
        "des_justificativa": "veniam",
        "dat_contrato": "iure",
        "dat_nascimento": "tempora",
        "cod_id_contrato": 13
    }
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'https://service.brsafe.com.br/ws-rest/v1/analise/protocolo',
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'user' => 'fr12345',
            'password' => '123456',
        ],
        'json' => [
            'cpf' => 1,
            'protocolo' => 13,
            'contrato' => 10,
            'max_time' => 1,
            'campos' => [
                'cod_loja' => 'quae',
                'cod_vendedor' => 9,
                'cod_udid' => 10,
                'cod_agencia' => 3,
                'cod_conta' => 14,
                'cod_dac' => 6,
                'nom_segmento' => 'quae',
                'nom_situacao' => 'maxime',
                'des_produto' => 'voluptatem',
                'des_titularidade' => 'sunt',
                'num_cpfcnpj_empresa' => 3,
                'nom_nome' => 'necessitatibus',
                'des_justificativa' => 'veniam',
                'dat_contrato' => 'iure',
                'dat_nascimento' => 'tempora',
                'cod_id_contrato' => 13,
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://service.brsafe.com.br/ws-rest/v1/analise/protocolo'
payload = {
    "cpf": 1,
    "protocolo": 13,
    "contrato": 10,
    "max_time": 1,
    "campos": {
        "cod_loja": "quae",
        "cod_vendedor": 9,
        "cod_udid": 10,
        "cod_agencia": 3,
        "cod_conta": 14,
        "cod_dac": 6,
        "nom_segmento": "quae",
        "nom_situacao": "maxime",
        "des_produto": "voluptatem",
        "des_titularidade": "sunt",
        "num_cpfcnpj_empresa": 3,
        "nom_nome": "necessitatibus",
        "des_justificativa": "veniam",
        "dat_contrato": "iure",
        "dat_nascimento": "tempora",
        "cod_id_contrato": 13
    }
}
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'user': 'fr12345',
  'password': '123456'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Example response (200):


{
    "num_cpf": "12345678909",
    "protocolo": "12345",
    "contrato": "12345",
    "status_analise": "Concluído",
    "nom_resultado": "SEM RISCO APARENTE",
    "data_criacao": "23/11/2020",
    "data_conclusao": "23/11/2020"
}
 

Request   

POST ws-rest/v1/analise/protocolo

Body Parameters

cpf  integer  

User's CPF

protocolo  integer  

User's protocol

contrato  integer  

Contract number

max_time  integer  

Maximum search time

campos  object  

Fields list

campos.cod_loja  required optional  

Store code

campos.cod_vendedor  integer  

Attendant code

campos.cod_udid  integer  

campos.cod_agencia  integer  

campos.cod_conta  integer  

campos.cod_dac  integer  

campos.nom_segmento  string  

campos.nom_situacao  string  

campos.des_produto  string  

campos.des_titularidade  string  

campos.num_cpfcnpj_empresa  integer  

campos.nom_nome  string  

Name

campos.des_justificativa  string  

campos.dat_contrato  string  

Contract date

campos.dat_nascimento  string  

Birth date

campos.cod_id_contrato  integer  

Contract id

Questions

Query questions

requires authentication

Method to retrieve questions

Example request:
curl --request POST \
    "https://service.brsafe.com.br/ws-rest/v1/perguntas/gerar" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "user: fr12345" \
    --header "password: 123456" \
    --data "{
    \"token\": \"libero\",
    \"indexadores\": {
        \"id_indexador\": 12,
        \"des_valor\": 15
    }
}"
const url = new URL(
    "https://service.brsafe.com.br/ws-rest/v1/perguntas/gerar"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "user": "fr12345",
    "password": "123456",
};

let body = {
    "token": "libero",
    "indexadores": {
        "id_indexador": 12,
        "des_valor": 15
    }
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'https://service.brsafe.com.br/ws-rest/v1/perguntas/gerar',
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'user' => 'fr12345',
            'password' => '123456',
        ],
        'json' => [
            'token' => 'libero',
            'indexadores' => [
                'id_indexador' => 12,
                'des_valor' => 15,
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://service.brsafe.com.br/ws-rest/v1/perguntas/gerar'
payload = {
    "token": "libero",
    "indexadores": {
        "id_indexador": 12,
        "des_valor": 15
    }
}
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'user': 'fr12345',
  'password': '123456'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Example response (400):


{
    "error": {
        "name": "ParametroInvalido",
        "code": 503,
        "status_code": 400,
        "message": "Parâmetros inválidos.",
        "detail": []
    }
}
 

Request   

POST ws-rest/v1/perguntas/gerar

Body Parameters

token  string optional  

Encryption key

indexadores  object optional  

List of index values

indexadores.id_indexador  integer optional  

Index ID

indexadores.des_valor  integer optional  

Index value

Result

Generate result

requires authentication

Method to generate result

Example request:
curl --request POST \
    "https://service.brsafe.com.br/ws-rest/v1/resultado/gerar" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "user: fr12345" \
    --header "password: 123456" \
    --data "{
    \"token\": \"voluptate\",
    \"respostas\": {
        \"id_pergunta\": 16,
        \"id_resposta\": 14
    }
}"
const url = new URL(
    "https://service.brsafe.com.br/ws-rest/v1/resultado/gerar"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "user": "fr12345",
    "password": "123456",
};

let body = {
    "token": "voluptate",
    "respostas": {
        "id_pergunta": 16,
        "id_resposta": 14
    }
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'https://service.brsafe.com.br/ws-rest/v1/resultado/gerar',
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'user' => 'fr12345',
            'password' => '123456',
        ],
        'json' => [
            'token' => 'voluptate',
            'respostas' => [
                'id_pergunta' => 16,
                'id_resposta' => 14,
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://service.brsafe.com.br/ws-rest/v1/resultado/gerar'
payload = {
    "token": "voluptate",
    "respostas": {
        "id_pergunta": 16,
        "id_resposta": 14
    }
}
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'user': 'fr12345',
  'password': '123456'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Example response (400):


{
    "error": {
        "name": "ParametroInvalido",
        "code": 503,
        "status_code": 400,
        "message": "Parâmetros inválidos.",
        "detail": []
    }
}
 

Request   

POST ws-rest/v1/resultado/gerar

Body Parameters

token  string optional  

Encryption key

respostas  object optional  

Response values list

respostas.id_pergunta  integer optional  

Question ID

respostas.id_resposta  integer optional  

Response ID