curl --request PATCH \
--url https://api.tupana.ai/v2/webhooks/{webhook_id}/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"api_version": 2
}
'import requests
url = "https://api.tupana.ai/v2/webhooks/{webhook_id}/"
payload = { "api_version": 2 }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({api_version: 2})
};
fetch('https://api.tupana.ai/v2/webhooks/{webhook_id}/', 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.tupana.ai/v2/webhooks/{webhook_id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'api_version' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.tupana.ai/v2/webhooks/{webhook_id}/"
payload := strings.NewReader("{\n \"api_version\": 2\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<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.patch("https://api.tupana.ai/v2/webhooks/{webhook_id}/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"api_version\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tupana.ai/v2/webhooks/{webhook_id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_version\": 2\n}"
response = http.request(request)
puts response.read_body{
"id": "dowe_2c9e5a1b7f3d0",
"url": "<string>",
"events": [
"document.issued"
],
"events_display": [
"Emitido",
"Entregado",
"Rechazado SII"
],
"secret": "<string>",
"is_active": true,
"last_status_code": 123,
"last_sent_at": "2023-11-07T05:31:56Z",
"success_rate": 50,
"last_delivery": {
"id": "wede_5f1c2a9b7d3e0",
"event": "<string>",
"is_success": true,
"status_code": 123,
"sent_at": "2023-11-07T05:31:56Z",
"document_id": 123
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"environment": "both",
"api_version": 1
}{
"error": "VALIDATION_ERROR",
"message": "<string>"
}{
"error": "VALIDATION_ERROR",
"message": "<string>"
}{
"error": "VALIDATION_ERROR",
"message": "<string>"
}Actualizar un webhook (API v2)
Cambia la URL, los eventos, el ambiente o la versión de ids (api_version) de un webhook de Tupana.
curl --request PATCH \
--url https://api.tupana.ai/v2/webhooks/{webhook_id}/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"api_version": 2
}
'import requests
url = "https://api.tupana.ai/v2/webhooks/{webhook_id}/"
payload = { "api_version": 2 }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({api_version: 2})
};
fetch('https://api.tupana.ai/v2/webhooks/{webhook_id}/', 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.tupana.ai/v2/webhooks/{webhook_id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'api_version' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.tupana.ai/v2/webhooks/{webhook_id}/"
payload := strings.NewReader("{\n \"api_version\": 2\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<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.patch("https://api.tupana.ai/v2/webhooks/{webhook_id}/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"api_version\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tupana.ai/v2/webhooks/{webhook_id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_version\": 2\n}"
response = http.request(request)
puts response.read_body{
"id": "dowe_2c9e5a1b7f3d0",
"url": "<string>",
"events": [
"document.issued"
],
"events_display": [
"Emitido",
"Entregado",
"Rechazado SII"
],
"secret": "<string>",
"is_active": true,
"last_status_code": 123,
"last_sent_at": "2023-11-07T05:31:56Z",
"success_rate": 50,
"last_delivery": {
"id": "wede_5f1c2a9b7d3e0",
"event": "<string>",
"is_success": true,
"status_code": 123,
"sent_at": "2023-11-07T05:31:56Z",
"document_id": 123
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"environment": "both",
"api_version": 1
}{
"error": "VALIDATION_ERROR",
"message": "<string>"
}{
"error": "VALIDATION_ERROR",
"message": "<string>"
}{
"error": "VALIDATION_ERROR",
"message": "<string>"
}url, events, secret, is_active, environment o api_version.
Es la forma de subir un webhook creado antes de octubre de 2026 al contrato de ids públicos:
{ "api_version": 2 }
data.id, sender.id y receiver.id llegan como docu_… y ment_…. Ver Identificadores en el payload.Authorizations
Body
Campos editables de un webhook. Todos opcionales (PATCH).
Formato de los identificadores que viajan en el payload. 2: todos los ids son public_id (docu_… documento, ment_… emisor/receptor, scdo_… programado, fir_… solicitud de folios, dowe_… webhook). 1: ids enteros, el contrato de la API v1. Si se omite, el default sigue la ruta de creación: /v2/webhooks/ crea en 2 y /v1/webhooks/ crea en 1 (desde la plataforma, la versión que ya usa la empresa). Los webhooks creados antes de octubre 2026 quedaron en 1: súbelos con PATCH o desde la plataforma.
1, 2 Response
Webhook
Formato de los identificadores que viajan en el payload. 2: todos los ids son public_id (docu_… documento, ment_… emisor/receptor, scdo_… programado, fir_… solicitud de folios, dowe_… webhook). 1: ids enteros, el contrato de la API v1. Si se omite, el default sigue la ruta de creación: /v2/webhooks/ crea en 2 y /v1/webhooks/ crea en 1 (desde la plataforma, la versión que ya usa la empresa). Los webhooks creados antes de octubre 2026 quedaron en 1: súbelos con PATCH o desde la plataforma.
1, 2 