curl --request POST \
--url https://api.staging.credicarro.com.br/integration/v1/webhook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tipo": 3,
"url": "https://parceiro.com.br/webhooks/credicarro",
"tipo_autenticacao": 2,
"credencial": "dXN1YXJpbzpzZW5oYQ=="
}
'import requests
url = "https://api.staging.credicarro.com.br/integration/v1/webhook"
payload = {
"tipo": 3,
"url": "https://parceiro.com.br/webhooks/credicarro",
"tipo_autenticacao": 2,
"credencial": "dXN1YXJpbzpzZW5oYQ=="
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tipo: 3,
url: 'https://parceiro.com.br/webhooks/credicarro',
tipo_autenticacao: 2,
credencial: 'dXN1YXJpbzpzZW5oYQ=='
})
};
fetch('https://api.staging.credicarro.com.br/integration/v1/webhook', 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.staging.credicarro.com.br/integration/v1/webhook",
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([
'tipo' => 3,
'url' => 'https://parceiro.com.br/webhooks/credicarro',
'tipo_autenticacao' => 2,
'credencial' => 'dXN1YXJpbzpzZW5oYQ=='
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.staging.credicarro.com.br/integration/v1/webhook"
payload := strings.NewReader("{\n \"tipo\": 3,\n \"url\": \"https://parceiro.com.br/webhooks/credicarro\",\n \"tipo_autenticacao\": 2,\n \"credencial\": \"dXN1YXJpbzpzZW5oYQ==\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.staging.credicarro.com.br/integration/v1/webhook")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"tipo\": 3,\n \"url\": \"https://parceiro.com.br/webhooks/credicarro\",\n \"tipo_autenticacao\": 2,\n \"credencial\": \"dXN1YXJpbzpzZW5oYQ==\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.staging.credicarro.com.br/integration/v1/webhook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tipo\": 3,\n \"url\": \"https://parceiro.com.br/webhooks/credicarro\",\n \"tipo_autenticacao\": 2,\n \"credencial\": \"dXN1YXJpbzpzZW5oYQ==\"\n}"
response = http.request(request)
puts response.read_body{
"id_webhook": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"segredo_assinatura": "<segredo-de-assinatura>"
}{
"tipo": "Validation.Cpf.Invalid",
"titulo": "Requisição inválida",
"status": 400,
"detalhe": "O CPF informado em 'cpf' é inválido.",
"campo": "cpf",
"erros": [
{
"codigo": "Validation.InvalidFormat",
"mensagem": "O valor informado para 'valorVeiculo' não é um número válido.",
"campo": "cpf"
}
]
}{
"tipo": "Validation.Cpf.Invalid",
"titulo": "Requisição inválida",
"status": 400,
"detalhe": "O CPF informado em 'cpf' é inválido.",
"campo": "cpf",
"erros": [
{
"codigo": "Validation.InvalidFormat",
"mensagem": "O valor informado para 'valorVeiculo' não é um número válido.",
"campo": "cpf"
}
]
}{
"tipo": "Validation.Cpf.Invalid",
"titulo": "Requisição inválida",
"status": 400,
"detalhe": "O CPF informado em 'cpf' é inválido.",
"campo": "cpf",
"erros": [
{
"codigo": "Validation.InvalidFormat",
"mensagem": "O valor informado para 'valorVeiculo' não é um número válido.",
"campo": "cpf"
}
]
}{
"tipo": "Validation.Cpf.Invalid",
"titulo": "Requisição inválida",
"status": 400,
"detalhe": "O CPF informado em 'cpf' é inválido.",
"campo": "cpf",
"erros": [
{
"codigo": "Validation.InvalidFormat",
"mensagem": "O valor informado para 'valorVeiculo' não é um número válido.",
"campo": "cpf"
}
]
}Cadastrar webhook
Cadastra um webhook ativo para o parceiro autenticado. É permitido mais de um webhook por tipo.
A resposta traz o segredo de assinatura (segredo_assinatura) em claro, usado para validar o header
X-CrediCarro-Signature das notificações. Ele não pode ser recuperado depois, então guarde-o nesse momento.
curl --request POST \
--url https://api.staging.credicarro.com.br/integration/v1/webhook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tipo": 3,
"url": "https://parceiro.com.br/webhooks/credicarro",
"tipo_autenticacao": 2,
"credencial": "dXN1YXJpbzpzZW5oYQ=="
}
'import requests
url = "https://api.staging.credicarro.com.br/integration/v1/webhook"
payload = {
"tipo": 3,
"url": "https://parceiro.com.br/webhooks/credicarro",
"tipo_autenticacao": 2,
"credencial": "dXN1YXJpbzpzZW5oYQ=="
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tipo: 3,
url: 'https://parceiro.com.br/webhooks/credicarro',
tipo_autenticacao: 2,
credencial: 'dXN1YXJpbzpzZW5oYQ=='
})
};
fetch('https://api.staging.credicarro.com.br/integration/v1/webhook', 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.staging.credicarro.com.br/integration/v1/webhook",
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([
'tipo' => 3,
'url' => 'https://parceiro.com.br/webhooks/credicarro',
'tipo_autenticacao' => 2,
'credencial' => 'dXN1YXJpbzpzZW5oYQ=='
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.staging.credicarro.com.br/integration/v1/webhook"
payload := strings.NewReader("{\n \"tipo\": 3,\n \"url\": \"https://parceiro.com.br/webhooks/credicarro\",\n \"tipo_autenticacao\": 2,\n \"credencial\": \"dXN1YXJpbzpzZW5oYQ==\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.staging.credicarro.com.br/integration/v1/webhook")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"tipo\": 3,\n \"url\": \"https://parceiro.com.br/webhooks/credicarro\",\n \"tipo_autenticacao\": 2,\n \"credencial\": \"dXN1YXJpbzpzZW5oYQ==\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.staging.credicarro.com.br/integration/v1/webhook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tipo\": 3,\n \"url\": \"https://parceiro.com.br/webhooks/credicarro\",\n \"tipo_autenticacao\": 2,\n \"credencial\": \"dXN1YXJpbzpzZW5oYQ==\"\n}"
response = http.request(request)
puts response.read_body{
"id_webhook": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"segredo_assinatura": "<segredo-de-assinatura>"
}{
"tipo": "Validation.Cpf.Invalid",
"titulo": "Requisição inválida",
"status": 400,
"detalhe": "O CPF informado em 'cpf' é inválido.",
"campo": "cpf",
"erros": [
{
"codigo": "Validation.InvalidFormat",
"mensagem": "O valor informado para 'valorVeiculo' não é um número válido.",
"campo": "cpf"
}
]
}{
"tipo": "Validation.Cpf.Invalid",
"titulo": "Requisição inválida",
"status": 400,
"detalhe": "O CPF informado em 'cpf' é inválido.",
"campo": "cpf",
"erros": [
{
"codigo": "Validation.InvalidFormat",
"mensagem": "O valor informado para 'valorVeiculo' não é um número válido.",
"campo": "cpf"
}
]
}{
"tipo": "Validation.Cpf.Invalid",
"titulo": "Requisição inválida",
"status": 400,
"detalhe": "O CPF informado em 'cpf' é inválido.",
"campo": "cpf",
"erros": [
{
"codigo": "Validation.InvalidFormat",
"mensagem": "O valor informado para 'valorVeiculo' não é um número válido.",
"campo": "cpf"
}
]
}{
"tipo": "Validation.Cpf.Invalid",
"titulo": "Requisição inválida",
"status": 400,
"detalhe": "O CPF informado em 'cpf' é inválido.",
"campo": "cpf",
"erros": [
{
"codigo": "Validation.InvalidFormat",
"mensagem": "O valor informado para 'valorVeiculo' não é um número válido.",
"campo": "cpf"
}
]
}url precisa ser HTTPS e pública, com até 2048 caracteres: sem localhost, IP privado, usuário/senha ou #fragmento. Caso contrário, a API retorna 422 com Organization.Webhook.InvalidEndpoint. Uma URL malformada (não absoluta) retorna 400 com Validation.Url.Invalid.Tipos de webhook
| Valor | Tipo | Disponibilidade |
|---|---|---|
1 | Cliente | ⚪ Sem envio no momento — pode ser cadastrado, mas não envia notificações. |
2 | Simulação | ⚪ Sem envio no momento — pode ser cadastrado, mas não envia notificações. |
3 | Proposta | 🟢 Disponível — envia uma notificação a cada atualização da proposta. |
1) e Simulação (2) podem ser configurados, mas não enviam notificações. Atualmente, apenas o tipo Proposta (3) está disponível.Tipos de autenticação
| Valor | Significado |
|---|---|
1 | Nenhuma — a requisição é enviada sem credencial de autenticação. |
2 | Basic — envia Authorization: Basic {credencial}, com credencial em Base64 de usuario:senha. |
3 | JWT — envia Authorization: Bearer {credencial}. |
tipo_autenticacao = 1, ela é ignorada. O tipo de autenticação e a credencial não podem ser alterados depois do cadastro. É permitido mais de um webhook por tipo.Segredo de assinatura
A resposta trazsegredo_assinatura, usado para verificar a autenticidade das notificações recebidas. Ele é exibido apenas nesta resposta — guarde-o com segurança, pois não é possível consultá-lo novamente. Consulte Verificação e segurança.Authorizations
Cabeçalho de autenticação Bearer no formato Bearer <token> onde <token> é seu TOKEN de autenticação
Body
Evento notificado pelo webhook. Valores aceitos:
- 1 = Customer
- 2 = Simulation
- 3 = Proposal
3
URL HTTPS pública, com até 2048 caracteres, que receberá as notificações (sem localhost, IP privado, usuário/senha ou fragmento).
"https://parceiro.com.br/webhooks/credicarro"
Autenticação enviada pela Credicarro ao chamar a URL. Não pode ser alterada depois da criação. Valores aceitos:
- 1 = None (sem autenticação)
- 2 = Basic
- 3 = Jwt
2
Credencial enviada no header Authorization. Obrigatória para Basic (valor em Base64 de usuario:senha,
enviado como Basic {credencial}) e Jwt (token enviado como Bearer {credencial}).
"dXN1YXJpbzpzZW5oYQ=="