Update
curl --request PUT \
--url https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"new_url": "<string>",
"events": [
"<string>"
],
"secret": "<string>",
"account_id": 123
}
'import requests
url = "https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks"
payload = {
"url": "<string>",
"new_url": "<string>",
"events": ["<string>"],
"secret": "<string>",
"account_id": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: '<string>',
new_url: '<string>',
events: ['<string>'],
secret: '<string>',
account_id: 123
})
};
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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'url' => '<string>',
'new_url' => '<string>',
'events' => [
'<string>'
],
'secret' => '<string>',
'account_id' => 123
]),
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 \"url\": \"<string>\",\n \"new_url\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"secret\": \"<string>\",\n \"account_id\": 123\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"new_url\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"secret\": \"<string>\",\n \"account_id\": 123\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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"new_url\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"secret\": \"<string>\",\n \"account_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"account_id": 4521,
"events": ["payin", "payout"],
"url": "https://my-url.requestcatcher.com/new",
"secret": "whsec_9f8e7d6c5b4a3210"
}
{
"message": "Webhook not found."
}
{
"error_code": "validation",
"error_description": "Validation error",
"fields": {
"account_id": ["The account does not exist or is not linked to your merchant."]
},
"field_errors": [
{
"field": "account_id",
"code": "invalid_account",
"params": [],
"message": "The account does not exist or is not linked to your merchant."
}
]
}
{
"error_code": "validation",
"error_description": "Validation error",
"fields": {
"events.0": ["A webhook for this event already exists for this account."]
},
"field_errors": [
{
"field": "events.0",
"code": "webhook_already_exists",
"params": [],
"message": "A webhook for this event already exists for this account."
}
]
}
{
"error_code": "validation",
"error_description": "Validation error",
"fields": {
"new_url": ["A webhook with this URL already exists for this account."]
},
"field_errors": [
{
"field": "new_url",
"code": "webhook_url_already_exists",
"params": [],
"message": "A webhook with this URL already exists for this account."
}
]
}
Webhook
Update
Update the URL, events and secret of an existing webhook
PUT
/
v2
/
register
/
companies
/
webhooks
Update
curl --request PUT \
--url https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"new_url": "<string>",
"events": [
"<string>"
],
"secret": "<string>",
"account_id": 123
}
'import requests
url = "https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks"
payload = {
"url": "<string>",
"new_url": "<string>",
"events": ["<string>"],
"secret": "<string>",
"account_id": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: '<string>',
new_url: '<string>',
events: ['<string>'],
secret: '<string>',
account_id: 123
})
};
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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'url' => '<string>',
'new_url' => '<string>',
'events' => [
'<string>'
],
'secret' => '<string>',
'account_id' => 123
]),
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 \"url\": \"<string>\",\n \"new_url\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"secret\": \"<string>\",\n \"account_id\": 123\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"new_url\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"secret\": \"<string>\",\n \"account_id\": 123\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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"new_url\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"secret\": \"<string>\",\n \"account_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"account_id": 4521,
"events": ["payin", "payout"],
"url": "https://my-url.requestcatcher.com/new",
"secret": "whsec_9f8e7d6c5b4a3210"
}
{
"message": "Webhook not found."
}
{
"error_code": "validation",
"error_description": "Validation error",
"fields": {
"account_id": ["The account does not exist or is not linked to your merchant."]
},
"field_errors": [
{
"field": "account_id",
"code": "invalid_account",
"params": [],
"message": "The account does not exist or is not linked to your merchant."
}
]
}
{
"error_code": "validation",
"error_description": "Validation error",
"fields": {
"events.0": ["A webhook for this event already exists for this account."]
},
"field_errors": [
{
"field": "events.0",
"code": "webhook_already_exists",
"params": [],
"message": "A webhook for this event already exists for this account."
}
]
}
{
"error_code": "validation",
"error_description": "Validation error",
"fields": {
"new_url": ["A webhook with this URL already exists for this account."]
},
"field_errors": [
{
"field": "new_url",
"code": "webhook_url_already_exists",
"params": [],
"message": "A webhook with this URL already exists for this account."
}
]
}
Update Webhook
This endpoint allows updating the URL, the events and the signing secret of a registered webhook.- The webhook is identified by its
urland the optionalaccount_id, both sent in the request body. The path never carries the URL - To move the webhook to another address, send the new address in
new_url eventsreplaces the whole list: to stop receiving an event on this URL, send the list without it; to start receiving one, add it
Registering, updating or removing a webhook may take up to 5 minutes to take effect. Until then, webhooks keep being delivered to the previous destination.
Request Body
string
required
Current URL of the webhook that will be updated. Together with
account_id, it identifies the webhook. If the account has no webhook with this URL, the request fails with 404.Maximum length: 120 charactersExample: https://my-url.requestcatcher.com/teststring
New endpoint URL for the webhook. When omitted, the URL stays the same.It must not be registered on another webhook of the account (URLs that differ only in letter case count as the same URL); otherwise the request fails with
422 and the webhook_url_already_exists code.Maximum length: 120 charactersExample: https://my-url.requestcatcher.com/newstring[]
required
Complete list of events the webhook will receive after the update. Send at least one event, without repeating any.Allowed values:
onboarding, payin, payout, kycEach event can be on only one webhook per account: sending an event that another webhook of the account already receives fails with 422 and the webhook_already_exists code on that item (for example events.0). Remove it from the other webhook first.Example: ["payin", "payout"]string
Secret used to sign the
payin, payout and kyc webhooks with HMAC-SHA256. When provided, every webhook delivered to this URL includes the x-webhook-wp-signature header.Maximum length: 255 characters. Use a long, randomly generated value.Example: whsec_9f8e7d6c5b4a3210integer
ID of the account whose webhook will be updated: your own merchant or one of its subaccounts.When omitted, the webhook of your merchant (the authenticated account) is updated.If the account does not exist or is not linked to your merchant, the request fails with
422 and the invalid_account code.Example: 4521Without
account_id, the update always targets your merchant, even if the webhook you want to change was listed by Query under a subaccount. Send the account_id returned with the webhook to update the right one.The update replaces the whole configuration. If
secret is omitted or null, the current secret is removed and the webhooks are no longer signed. Always send the secret you want to keep.An event left out of
events stops being delivered to this URL. On a subaccount, it then goes to the main account’s webhook for that event, if there is one — see Subaccounts without a webhook.To rotate the secret, send the new value in
secret. Changes may take up to 5 minutes to take effect, so accept signatures computed with either the old or the new secret during this period.Response
integer
ID of the account the webhook belongs to.Example:
4521string[]
Events the webhook receives after the update.Allowed values:
onboarding, payin, payout, kycExample: ["payin", "payout"]string
Endpoint URL of the webhook after the updateExample:
https://my-url.requestcatcher.com/newstring
Secret used to sign the webhooks delivered to this URL, or
null if none is set.Example: whsec_9f8e7d6c5b4a3210Request Example
curl --request PUT \
--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 '{
"url": "https://my-url.requestcatcher.com/test",
"new_url": "https://my-url.requestcatcher.com/new",
"events": ["payin", "payout"],
"secret": "whsec_9f8e7d6c5b4a3210",
"account_id": 4521
}'
const response = await fetch('https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks', {
method: 'PUT',
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://my-url.requestcatcher.com/test',
new_url: 'https://my-url.requestcatcher.com/new',
events: ['payin', 'payout'],
secret: 'whsec_9f8e7d6c5b4a3210',
account_id: 4521
})
});
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 = {
'url': 'https://my-url.requestcatcher.com/test',
'new_url': 'https://my-url.requestcatcher.com/new',
'events': ['payin', 'payout'],
'secret': 'whsec_9f8e7d6c5b4a3210',
'account_id': 4521
}
response = requests.put(url, json=data, headers=headers)
print(response.json())
{
"account_id": 4521,
"events": ["payin", "payout"],
"url": "https://my-url.requestcatcher.com/new",
"secret": "whsec_9f8e7d6c5b4a3210"
}
{
"message": "Webhook not found."
}
{
"error_code": "validation",
"error_description": "Validation error",
"fields": {
"account_id": ["The account does not exist or is not linked to your merchant."]
},
"field_errors": [
{
"field": "account_id",
"code": "invalid_account",
"params": [],
"message": "The account does not exist or is not linked to your merchant."
}
]
}
{
"error_code": "validation",
"error_description": "Validation error",
"fields": {
"events.0": ["A webhook for this event already exists for this account."]
},
"field_errors": [
{
"field": "events.0",
"code": "webhook_already_exists",
"params": [],
"message": "A webhook for this event already exists for this account."
}
]
}
{
"error_code": "validation",
"error_description": "Validation error",
"fields": {
"new_url": ["A webhook with this URL already exists for this account."]
},
"field_errors": [
{
"field": "new_url",
"code": "webhook_url_already_exists",
"params": [],
"message": "A webhook with this URL already exists for this account."
}
]
}
Was this page helpful?

