Update webhook endpoint
curl --request PATCH \
--url https://api.getlago.com/api/v2/webhook_endpoints/{lago_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"webhook_endpoint": {
"name": "Billing webhooks",
"webhook_url": "https://hooks.acme.example/lago",
"signature_algo": "standard_webhooks",
"event_types": [
"add_on.created"
]
}
}
'import requests
url = "https://api.getlago.com/api/v2/webhook_endpoints/{lago_id}"
payload = { "webhook_endpoint": {
"name": "Billing webhooks",
"webhook_url": "https://hooks.acme.example/lago",
"signature_algo": "standard_webhooks",
"event_types": ["add_on.created"]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
webhook_endpoint: {
name: 'Billing webhooks',
webhook_url: 'https://hooks.acme.example/lago',
signature_algo: 'standard_webhooks',
event_types: ['add_on.created']
}
})
};
fetch('https://api.getlago.com/api/v2/webhook_endpoints/{lago_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.getlago.com/api/v2/webhook_endpoints/{lago_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([
'webhook_endpoint' => [
'name' => 'Billing webhooks',
'webhook_url' => 'https://hooks.acme.example/lago',
'signature_algo' => 'standard_webhooks',
'event_types' => [
'add_on.created'
]
]
]),
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.getlago.com/api/v2/webhook_endpoints/{lago_id}"
payload := strings.NewReader("{\n \"webhook_endpoint\": {\n \"name\": \"Billing webhooks\",\n \"webhook_url\": \"https://hooks.acme.example/lago\",\n \"signature_algo\": \"standard_webhooks\",\n \"event_types\": [\n \"add_on.created\"\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.getlago.com/api/v2/webhook_endpoints/{lago_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"webhook_endpoint\": {\n \"name\": \"Billing webhooks\",\n \"webhook_url\": \"https://hooks.acme.example/lago\",\n \"signature_algo\": \"standard_webhooks\",\n \"event_types\": [\n \"add_on.created\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v2/webhook_endpoints/{lago_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"webhook_endpoint\": {\n \"name\": \"Billing webhooks\",\n \"webhook_url\": \"https://hooks.acme.example/lago\",\n \"signature_algo\": \"standard_webhooks\",\n \"event_types\": [\n \"add_on.created\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"webhook_endpoint": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"webhook_url": "https://hooks.acme.example/lago",
"signature_algo": "standard_webhooks",
"event_types": [
"add_on.created"
],
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"signing_keys": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"secret_key": "whsec_ZmFrZS1zZWNyZXQtZm9yLWRvY3VtZW50YXRpb24tb25seQ==",
"created_at": "2022-04-29T08:59:51.123456Z"
}
]
}
}{
"code": "invalid_expand",
"details": [
{
"code": "malformed",
"field": "expands",
"meta": {
"allowed_values": []
}
}
]
}{
"code": "unauthorized",
"details": []
}{
"code": "feature_unavailable",
"details": []
}{
"code": "resource_not_found",
"details": [
{
"code": "resource_not_found",
"field": "base",
"meta": {
"resource": "resource_name"
}
}
]
}{
"code": "validation_errors",
"details": [
{
"code": "value_is_mandatory",
"field": "name",
"meta": {}
}
]
}Webhook endpoints
Partially update webhook endpoint
PUT and PATCH both accept partial updates.
PATCH
/
webhook_endpoints
/
{lago_id}
Update webhook endpoint
curl --request PATCH \
--url https://api.getlago.com/api/v2/webhook_endpoints/{lago_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"webhook_endpoint": {
"name": "Billing webhooks",
"webhook_url": "https://hooks.acme.example/lago",
"signature_algo": "standard_webhooks",
"event_types": [
"add_on.created"
]
}
}
'import requests
url = "https://api.getlago.com/api/v2/webhook_endpoints/{lago_id}"
payload = { "webhook_endpoint": {
"name": "Billing webhooks",
"webhook_url": "https://hooks.acme.example/lago",
"signature_algo": "standard_webhooks",
"event_types": ["add_on.created"]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
webhook_endpoint: {
name: 'Billing webhooks',
webhook_url: 'https://hooks.acme.example/lago',
signature_algo: 'standard_webhooks',
event_types: ['add_on.created']
}
})
};
fetch('https://api.getlago.com/api/v2/webhook_endpoints/{lago_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.getlago.com/api/v2/webhook_endpoints/{lago_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([
'webhook_endpoint' => [
'name' => 'Billing webhooks',
'webhook_url' => 'https://hooks.acme.example/lago',
'signature_algo' => 'standard_webhooks',
'event_types' => [
'add_on.created'
]
]
]),
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.getlago.com/api/v2/webhook_endpoints/{lago_id}"
payload := strings.NewReader("{\n \"webhook_endpoint\": {\n \"name\": \"Billing webhooks\",\n \"webhook_url\": \"https://hooks.acme.example/lago\",\n \"signature_algo\": \"standard_webhooks\",\n \"event_types\": [\n \"add_on.created\"\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.getlago.com/api/v2/webhook_endpoints/{lago_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"webhook_endpoint\": {\n \"name\": \"Billing webhooks\",\n \"webhook_url\": \"https://hooks.acme.example/lago\",\n \"signature_algo\": \"standard_webhooks\",\n \"event_types\": [\n \"add_on.created\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v2/webhook_endpoints/{lago_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"webhook_endpoint\": {\n \"name\": \"Billing webhooks\",\n \"webhook_url\": \"https://hooks.acme.example/lago\",\n \"signature_algo\": \"standard_webhooks\",\n \"event_types\": [\n \"add_on.created\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"webhook_endpoint": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"webhook_url": "https://hooks.acme.example/lago",
"signature_algo": "standard_webhooks",
"event_types": [
"add_on.created"
],
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"signing_keys": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"secret_key": "whsec_ZmFrZS1zZWNyZXQtZm9yLWRvY3VtZW50YXRpb24tb25seQ==",
"created_at": "2022-04-29T08:59:51.123456Z"
}
]
}
}{
"code": "invalid_expand",
"details": [
{
"code": "malformed",
"field": "expands",
"meta": {
"allowed_values": []
}
}
]
}{
"code": "unauthorized",
"details": []
}{
"code": "feature_unavailable",
"details": []
}{
"code": "resource_not_found",
"details": [
{
"code": "resource_not_found",
"field": "base",
"meta": {
"resource": "resource_name"
}
}
]
}{
"code": "validation_errors",
"details": [
{
"code": "value_is_mandatory",
"field": "name",
"meta": {}
}
]
}API v2 is in beta. Endpoints return the
X-Lago-Endpoint-Status: beta header.Authorizations
Path Parameters
Query Parameters
Body
application/json
Request payload