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".
Endpoints
GET ws-rest/health
requires authentication
Example request:
curl --request GET \
--get "https://service.brsafe.com.br/ws-rest/health" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "user: fr12345" \
--header "password: 123456"const url = new URL(
"https://service.brsafe.com.br/ws-rest/health"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"user": "fr12345",
"password": "123456",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://service.brsafe.com.br/ws-rest/health',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'user' => 'fr12345',
'password' => '123456',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://service.brsafe.com.br/ws-rest/health'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'user': 'fr12345',
'password': '123456'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (500):
Show headers
cache-control: no-cache, private
content-type: application/json
{
"error": {
"name": "",
"code": 0,
"message": "",
"detail": []
}
}
Received response:
Request failed with error:
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\": \"dolore\",
\"uf\": \"DF\",
\"codUsuario\": \"inventore\",
\"codReanalise\": \"ea\"
}"
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": "dolore",
"uf": "DF",
"codUsuario": "inventore",
"codReanalise": "ea"
};
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' => 'dolore',
'uf' => 'DF',
'codUsuario' => 'inventore',
'codReanalise' => 'ea',
],
]
);
$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": "dolore",
"uf": "DF",
"codUsuario": "inventore",
"codReanalise": "ea"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'user': 'fr12345',
'password': '123456'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Received response:
Request failed with error:
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\": \"nobis\"
}"
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": "nobis"
};
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' => 'nobis',
],
]
);
$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": "nobis"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'user': 'fr12345',
'password': '123456'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Received response:
Request failed with error:
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\": \"tempora\",
\"cod_pdv\": \"inventore\",
\"num_cpfcnpj\": 7
}"
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": "tempora",
"cod_pdv": "inventore",
"num_cpfcnpj": 7
};
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' => 'tempora',
'cod_pdv' => 'inventore',
'num_cpfcnpj' => 7,
],
]
);
$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": "tempora",
"cod_pdv": "inventore",
"num_cpfcnpj": 7
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'user': 'fr12345',
'password': '123456'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Received response:
Request failed with error:
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\": 12,
\"protocolo\": 20,
\"contrato\": 17,
\"max_time\": 9,
\"campos\": {
\"cod_loja\": \"explicabo\",
\"cod_vendedor\": 5,
\"cod_udid\": 16,
\"cod_agencia\": 11,
\"cod_conta\": 17,
\"cod_dac\": 12,
\"nom_segmento\": \"voluptatem\",
\"nom_situacao\": \"iusto\",
\"des_produto\": \"cupiditate\",
\"des_titularidade\": \"sed\",
\"num_cpfcnpj_empresa\": 5,
\"nom_nome\": \"nihil\",
\"des_justificativa\": \"sit\",
\"dat_contrato\": \"quisquam\",
\"dat_nascimento\": \"nulla\",
\"cod_id_contrato\": 11
}
}"
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": 12,
"protocolo": 20,
"contrato": 17,
"max_time": 9,
"campos": {
"cod_loja": "explicabo",
"cod_vendedor": 5,
"cod_udid": 16,
"cod_agencia": 11,
"cod_conta": 17,
"cod_dac": 12,
"nom_segmento": "voluptatem",
"nom_situacao": "iusto",
"des_produto": "cupiditate",
"des_titularidade": "sed",
"num_cpfcnpj_empresa": 5,
"nom_nome": "nihil",
"des_justificativa": "sit",
"dat_contrato": "quisquam",
"dat_nascimento": "nulla",
"cod_id_contrato": 11
}
};
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' => 12,
'protocolo' => 20,
'contrato' => 17,
'max_time' => 9,
'campos' => [
'cod_loja' => 'explicabo',
'cod_vendedor' => 5,
'cod_udid' => 16,
'cod_agencia' => 11,
'cod_conta' => 17,
'cod_dac' => 12,
'nom_segmento' => 'voluptatem',
'nom_situacao' => 'iusto',
'des_produto' => 'cupiditate',
'des_titularidade' => 'sed',
'num_cpfcnpj_empresa' => 5,
'nom_nome' => 'nihil',
'des_justificativa' => 'sit',
'dat_contrato' => 'quisquam',
'dat_nascimento' => 'nulla',
'cod_id_contrato' => 11,
],
],
]
);
$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": 12,
"protocolo": 20,
"contrato": 17,
"max_time": 9,
"campos": {
"cod_loja": "explicabo",
"cod_vendedor": 5,
"cod_udid": 16,
"cod_agencia": 11,
"cod_conta": 17,
"cod_dac": 12,
"nom_segmento": "voluptatem",
"nom_situacao": "iusto",
"des_produto": "cupiditate",
"des_titularidade": "sed",
"num_cpfcnpj_empresa": 5,
"nom_nome": "nihil",
"des_justificativa": "sit",
"dat_contrato": "quisquam",
"dat_nascimento": "nulla",
"cod_id_contrato": 11
}
}
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"
}
Received response:
Request failed with error:
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\": \"et\",
\"indexadores\": {
\"id_indexador\": 18,
\"des_valor\": 12
}
}"
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": "et",
"indexadores": {
"id_indexador": 18,
"des_valor": 12
}
};
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' => 'et',
'indexadores' => [
'id_indexador' => 18,
'des_valor' => 12,
],
],
]
);
$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": "et",
"indexadores": {
"id_indexador": 18,
"des_valor": 12
}
}
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": []
}
}
Received response:
Request failed with error:
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\": \"possimus\",
\"respostas\": {
\"id_pergunta\": 14,
\"id_resposta\": 9
}
}"
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": "possimus",
"respostas": {
"id_pergunta": 14,
"id_resposta": 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/resultado/gerar',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'user' => 'fr12345',
'password' => '123456',
],
'json' => [
'token' => 'possimus',
'respostas' => [
'id_pergunta' => 14,
'id_resposta' => 9,
],
],
]
);
$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": "possimus",
"respostas": {
"id_pergunta": 14,
"id_resposta": 9
}
}
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": []
}
}
Received response:
Request failed with error: