API > Webhooks - Update webhook
Webhooks - Update webhook
PUT https://{entorno}.ticketbaiws.eus/webhooks/{codigo_webhook}/
Updates an existing webhook (URL, secret, errors only, enabled or events).
Available in the test and production environments. Use the same environment the webhook was created in (api-test or api).
PARAMETERS
| url string required URL the webhook is sent to | https://... |
| secret string required Secret key used to sign the webhook so its content can be validated. The signature is computed with HMAC SHA256 and sent base64-encoded in the X-Tbaiws-Hmac-Sha256 header | xajky22kjasy |
| solo_errores boolean optional Send the webhook only when there are errors or when the invoice is accepted with errors or warnings | true |
| activo boolean optional Webhook enabled. Lets you switch the webhook off temporarily | true |
| eventos array optional Events notified to this webhook (see events). If not sent, the current ones are kept | ["cambio_estado", "spfe_envio"] |
How to compute the signature in PHP:
$calculated_hmac = base64_encode(hash_hmac('sha256', $request_body , $secret, true));
PUT https://{entorno}.ticketbaiws.eus/webhooks/{codigo_webhook}/
$ curl --request PUT \
--url https://api-test.ticketbaiws.eus/webhooks/6904a3501884e/ \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Token: xxx' \
--header 'Nif: 00000014Z'
--data '
{
"url": "https://www.berein.com/",
"secret": "xajky22kjasy",
"solo_errores" : true,
"activo": true,
"eventos": ["cambio_estado", "spfe_envio", "spfe_recibida"]
}'
$ composer require ticketbaiws/ticketbaiws-php
<?php
// Installation: composer require ticketbaiws/ticketbaiws-php
require 'vendor/autoload.php';
$tbai = new \TicketbaiWS\Client('xxx', '00000014Z', ['entorno' => 'test']);
$r = $tbai->modificarWebhook('6904a3501884e', [
'url' => 'https://www.berein.com/',
'secret' => 'xajky22kjasy',
'solo_errores' => true,
'activo' => true,
'eventos' => ['cambio_estado', 'spfe_envio', 'spfe_recibida'],
]);
if ($r->isError()) {
echo $r->getMessageText();
} else {
print_r($r->getData());
}
$ python -m pip install requests
import requests
url = "https://api-test.ticketbaiws.eus/webhooks/6904a3501884e/"
payload = {
"url": "https://www.berein.com/",
"secret": "xajky22kjasy",
"solo_errores" : true,
"activo": true,
"eventos": ["cambio_estado", "spfe_envio", "spfe_recibida"]
}
headers = {"Accept": "application/json", "Token" : "xxx", "Nif" : "00000014Z"}
response = requests.request("PUT", url, json=payload, headers=headers)
print(response.text)
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "https://api-test.ticketbaiws.eus/webhooks/6904a3501884e/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Accept: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, '{"url": "https://www.berein.com/","secret": "xajky22kjasy","solo_errores" : true,"activo": true,"eventos": ["cambio_estado","spfe_envio","spfe_recibida"]}');
CURLcode ret = curl_easy_perform(hnd);
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '{"url": "https://www.berein.com/","secret": "xajky22kjasy","solo_errores" : true,"activo": true,"eventos": ["cambio_estado","spfe_envio","spfe_recibida"]}');
Request request = new Request.Builder()
.url("https://api-test.ticketbaiws.eus/webhooks/6904a3501884e/")
.put(body)
.addHeader("Accept", "application/json")
.addHeader("Token", "xxx")
.addHeader("Nif", "00000014Z")
.build();
Response response = client.newCall(request).execute();
{ } Response JSON
HTTP/1.1 200 OK
{
"result": "OK",
"return": {
"codigo": "6904a3501874e",
"url": "https://www.berein.com/",
"entorno": "test",
"secret": "xajky22kjasy",
"solo_errores": true,
"activo": true,
"fecha_creado": "2025-10-31T12:53:52+01:00",
"fecha_modificado": "2025-11-03T10:16:15+01:00",
"eventos": ["cambio_estado", "spfe_envio", "spfe_recibida"]
},
"msg": ""
}
Example notification JSON
Headers:
array (
'X-Tbaiws-Hmac-Sha256' => 'Hl+X3FT/r5yH3wsgaku46votvTpUPSLPeDNCiCj+syM=',
'X-Tbaiws-Topic' => 'cambio_estado',
'X-Tbaiws-Environment' => 'real',
'X-Tbaiws-Id' => '6904a3501884e',
'User-Agent' => 'TbaiWS Hook',
'Content-Type' => 'application/json',
'Content-Length' => '168',
'Connection' => 'close'
)
Payload:
{"codigo_webhook":"6904a3501884e","nif":"B123456789","evento":"cambio_estado","serie":"5","numero":"500593135","fecha_emision":"03\/11\/2025","estado":"OK","avisos":""}
TicketBAI / Verifactu methods
- POST New invoice / resubmission (zuzendu) TicketBAI / Verifactu
- POST Complete a simplified invoice
- GET Get a TicketBAI / Verifactu invoice
- GET List TicketBAI / Verifactu invoices
- GET Download TicketBAI / Verifactu XML
- GET Download invoice in FacturaE format
- GET Download invoice as PDF
- GET System status
- DEL Cancel a TicketBAI / Verifactu invoice
- PUT Force TicketBAI / Verifactu resend
- POST Validate a NIF with the AEAT
- POST Validate a VAT number in VIES
Representation document
- GET Representation document - Download template
- POST Representation document - Upload document
- GET Representation document - Download uploaded document
- DELETE Representation document - Revoke uploaded document
BATUZ BIZKAIA specific methods
- GET List IAE activity codes
- POST LROE - Received invoices - Submit (BATUZ)
- PUT LROE - Received invoices - Update (BATUZ)
- GET LROE - Received invoices - Query (BATUZ)
- DEL LROE - Received invoices - Cancel (BATUZ)
- POST LROE - Expenses without invoice - Submit (BATUZ, form 140)
- PUT LROE - Expenses without invoice - Update (BATUZ, form 140)
- GET LROE - Expenses without invoice - Query (BATUZ, form 140)
- DEL LROE - Expenses without invoice - Cancel (BATUZ, form 140)
- POST LROE - Cash accounting COLLECTIONS - Submit (BATUZ)
- PUT LROE - Cash accounting COLLECTIONS - Update (BATUZ)
- GET LROE - Cash accounting COLLECTIONS - Query (BATUZ)
- DEL LROE - Cash accounting COLLECTIONS - Cancel (BATUZ)
- POST LROE - Cash accounting PAYMENTS - Submit (BATUZ)
- PUT LROE - Cash accounting PAYMENTS - Update (BATUZ)
- GET LROE - Cash accounting PAYMENTS - Query (BATUZ)
- DEL LROE - Cash accounting PAYMENTS - Cancel (BATUZ)
SII (AEAT)
Customers and products (invoicing tool)
- GET Customers - Search / get customers
- POST Customers - New customer
- PUT Customers - Update customer
- GET Products - Search / get products
