Skip to main content
POST
/
onboarding
/
api
/
v1
/
steps
/
fraud
Inicia processo de análise de fraude
curl --request POST \
  --url https://api.valid.com/onboarding/api/v1/steps/fraud \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "cpf": "<string>",
  "appRedirect": "<string>",
  "selfieImage": "<string>",
  "webhookUrl": "<string>",
  "webhookBasicAuth": "<string>"
}
'
import requests

url = "https://api.valid.com/onboarding/api/v1/steps/fraud"

payload = {
    "cpf": "<string>",
    "appRedirect": "<string>",
    "selfieImage": "<string>",
    "webhookUrl": "<string>",
    "webhookBasicAuth": "<string>"
}
headers = {
    "x-api-key": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    cpf: '<string>',
    appRedirect: '<string>',
    selfieImage: '<string>',
    webhookUrl: '<string>',
    webhookBasicAuth: '<string>'
  })
};

fetch('https://api.valid.com/onboarding/api/v1/steps/fraud', 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/onboarding/api/v1/steps/fraud",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'cpf' => '<string>',
    'appRedirect' => '<string>',
    'selfieImage' => '<string>',
    'webhookUrl' => '<string>',
    'webhookBasicAuth' => '<string>'
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.valid.com/onboarding/api/v1/steps/fraud"

	payload := strings.NewReader("{\n  \"cpf\": \"<string>\",\n  \"appRedirect\": \"<string>\",\n  \"selfieImage\": \"<string>\",\n  \"webhookUrl\": \"<string>\",\n  \"webhookBasicAuth\": \"<string>\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<api-key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.valid.com/onboarding/api/v1/steps/fraud")
  .header("x-api-key", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"cpf\": \"<string>\",\n  \"appRedirect\": \"<string>\",\n  \"selfieImage\": \"<string>\",\n  \"webhookUrl\": \"<string>\",\n  \"webhookBasicAuth\": \"<string>\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.valid.com/onboarding/api/v1/steps/fraud")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"cpf\": \"<string>\",\n  \"appRedirect\": \"<string>\",\n  \"selfieImage\": \"<string>\",\n  \"webhookUrl\": \"<string>\",\n  \"webhookBasicAuth\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "requestProcessUrl": "<string>",
  "requestId": "<string>",
  "createdAt": "<string>",
  "code": "<string>",
  "message": "<string>",
  "details": [
    {}
  ]
}
Use POST /onboarding/api/v1/steps/fraud para iniciar o processo de análise de fraude. A requisição espera receber o CPF do usuário, a imagem da selfie em Base64 e informações de configuração como a URL e dados de autenticação do webhook para entrega do resultado. Além dessas informações é possível utilizar URLs de redirecionamento e flags para páginas de introdução e sucesso. A API irá iniciar um novo processo de análise e retornar o identificador do processo criado, a URL para acompanhar o processo e a data de criação.

Request Body

cpf
string
required
CPF do indivíduo para o processo de fraude.Exemplo: 12345678900
appRedirect
string
required
Caminho de redirecionamento do aplicativo após a conclusão do processo.Exemplo: /onboarding/redirect
selfieImage
string
Imagem da selfie do usuário em formato Base64.Exemplo: aW1hZ2UtQmFzZTY0
webhookUrl
string
URL para notificação de webhook com o resultado final.Exemplo: https://seusistema.com/webhook
webhookBasicAuth
string
Credenciais Basic Auth (usuario:senha) para autenticação do webhook.Exemplo: usuario:senha

Response

Retorna o identificador do processo criado, a URL de acompanhamento e a data de criação.

Exemplo de sucesso (200 OK)

{
  "requestProcessUrl": "https://service.onboarding.comz/steps/resource/fraud/{{requestId}}",
  "requestId": "05be75cc-8f8a-414a-891f-434aa9b4e7a5",
  "createdAt": "2023-01-01T12:00:00"
}
requestProcessUrl
string
required
URL para a próxima etapa ou visualização do recurso.
requestId
string
required
ID único da requisição iniciada.
createdAt
string
required
Data e hora de criação da requisição.

Respostas de Erro

A API pode retornar os status 400 (Bad request), 422 (Validation or semantic error) e 500 (Internal server error), seguindo o modelo padrão de erro da aplicação.
code
string
required
Código do erro que categoriza o tipo de erro.Exemplo: VALIDATION_ERROR
message
string
required
Mensagem de erro.Exemplo: The request is invalid
details
object[]
Lista contendo ou não um erro detalhado.
  • field (string): caminho do campo incorreto ou inválido. Exemplo: name
  • message (string): mensagem de erro do campo. Exemplo: The field cannot be blank