Skip to main content
POST
/
v2
/
register
/
companies
/
webhooks
Setup
curl --request POST \
  --url https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "event": "<string>",
  "url": "<string>"
}
'
import requests

url = "https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks"

payload = {
"event": "<string>",
"url": "<string>"
}
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({event: '<string>', url: '<string>'})
};

fetch('https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks', 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.sandbox.wepayout.com.br/v2/register/companies/webhooks",
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([
'event' => '<string>',
'url' => '<string>'
]),
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.sandbox.wepayout.com.br/v2/register/companies/webhooks"

payload := strings.NewReader("{\n \"event\": \"<string>\",\n \"url\": \"<string>\"\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.sandbox.wepayout.com.br/v2/register/companies/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event\": \"<string>\",\n \"url\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks")

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 \"event\": \"<string>\",\n \"url\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "event": "onboarding",
  "url": "https://my-url.requestcatcher.com/test"
    "created_at": "2024-01-15T10:30:00Z"
  }
}
{
  "success": false,
  "error": {
    "code": "invalid_url",
    "message": "Webhook URL must use HTTPS protocol",
    "field": "url"
  }
}
{
  "success": false,
  "error": {
    "code": "unauthorized",
    "message": "Invalid API key provided"
  }
}

Setup

The system allows the registration of webhook URLs to receive automatic notifications about relevant events. Webhook URL: HTTPS address where the events will be delivered.
Supported event: onboarding
Notification format: JSON payload sent via HTTP request
Request method: All notifications will be sent exclusively using the POST method

Request Body

event
string
required
Type of event that will trigger the webhook. Currently, only the onboarding event is supported.Example: onboarding
url
string
required
Endpoint URL that will receive the webhook notifications for the selected event.URL characters: a-z, A-Z charactersExample: https://my-url.com/test

Response

event
string
Type of event that will trigger the webhook. Currently, only the onboarding event is supported.Example: onboarding
url
string
Endpoint URL that was registered to receive webhook notifications.Example: https://my-url.requestcatcher.com/test

Request Example

curl --request POST \
  --url https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {token}' \
  --header 'Content-Type: application/json' \
  --data '{
    "event": "onboarding",
    "url": "https://my-url.requestcatcher.com/test"
  }'
const response = await fetch('https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks', {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    event: 'onboarding',
    url: 'https://my-url.requestcatcher.com/test'
  })
});

const data = await response.json();
console.log(data);
import requests

url = 'https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks'
headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json'
}
data = {
    'event': 'onboarding',
    'url': 'https://my-url.requestcatcher.com/test'
}

response = requests.post(url, json=data, headers=headers)
print(response.json())
{
  "event": "onboarding",
  "url": "https://my-url.requestcatcher.com/test"
    "created_at": "2024-01-15T10:30:00Z"
  }
}
{
  "success": false,
  "error": {
    "code": "invalid_url",
    "message": "Webhook URL must use HTTPS protocol",
    "field": "url"
  }
}
{
  "success": false,
  "error": {
    "code": "unauthorized",
    "message": "Invalid API key provided"
  }
}

Webhook Payload

When an onboarding event occurs, a POST request will be sent to your webhook URL:
{
  "id": "1234-5678-90ab-cdef-1234567890ab",
  "status": "active",
  "updated_at": "2024-01-15T10:30:00Z",
  "account_id": 123,
}
The account_id is only returned the first time in the webhook when the status is active.
Your webhook endpoint must return a 200 OK status code to acknowledge receipt. If the endpoint fails or returns an error, the system will retry delivery.