Create webhook
curl --request POST \
--url https://api.lojou.app/v1/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://minhaloja.example.com/webhooks/lojou",
"name": "Novo pedido",
"events": [
"order_approved",
"order_cancelled"
],
"product_details": {},
"event_success": "<string>",
"event_error": "<string>"
}
'import requests
url = "https://api.lojou.app/v1/webhooks"
payload = {
"url": "https://minhaloja.example.com/webhooks/lojou",
"name": "Novo pedido",
"events": ["order_approved", "order_cancelled"],
"product_details": {},
"event_success": "<string>",
"event_error": "<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({
url: 'https://minhaloja.example.com/webhooks/lojou',
name: 'Novo pedido',
events: ['order_approved', 'order_cancelled'],
product_details: {},
event_success: '<string>',
event_error: '<string>'
})
};
fetch('https://api.lojou.app/v1/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.lojou.app/v1/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([
'url' => 'https://minhaloja.example.com/webhooks/lojou',
'name' => 'Novo pedido',
'events' => [
'order_approved',
'order_cancelled'
],
'product_details' => [
],
'event_success' => '<string>',
'event_error' => '<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.lojou.app/v1/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://minhaloja.example.com/webhooks/lojou\",\n \"name\": \"Novo pedido\",\n \"events\": [\n \"order_approved\",\n \"order_cancelled\"\n ],\n \"product_details\": {},\n \"event_success\": \"<string>\",\n \"event_error\": \"<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.lojou.app/v1/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://minhaloja.example.com/webhooks/lojou\",\n \"name\": \"Novo pedido\",\n \"events\": [\n \"order_approved\",\n \"order_cancelled\"\n ],\n \"product_details\": {},\n \"event_success\": \"<string>\",\n \"event_error\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lojou.app/v1/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 \"url\": \"https://minhaloja.example.com/webhooks/lojou\",\n \"name\": \"Novo pedido\",\n \"events\": [\n \"order_approved\",\n \"order_cancelled\"\n ],\n \"product_details\": {},\n \"event_success\": \"<string>\",\n \"event_error\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Webhook created successfully.",
"webhook": {
"id": 3,
"name": "Novo pedido",
"url": "https://minhaloja.example.com/webhooks/lojou",
"events": [
"order_approved"
],
"product_details": null,
"event_success": null,
"event_error": null,
"reports_count": 0,
"created_at": "2026-08-31T16:25:00.000000Z",
"updated_at": "2026-08-31T16:25:00.000000Z"
}
}{
"status": "error",
"message": "Unauthorized user."
}{
"status": "error",
"message": "Permission denied for this endpoint.",
"error_code": "insufficient_scope",
"required_scopes": [
"orders.read"
],
"missing_scopes": [
"orders.read"
],
"granted_scopes": [
"products.read",
"products.write"
]
}{
"status": "error",
"message": "Validation failed.",
"errors": {
"amount": [
"The amount field is required."
]
}
}Webhooks
Create webhook
See the Webhooks guide for the exact payload shape Lojou sends, available events, and delivery behavior (no signature, no retries).
POST
/
v1
/
webhooks
Create webhook
curl --request POST \
--url https://api.lojou.app/v1/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://minhaloja.example.com/webhooks/lojou",
"name": "Novo pedido",
"events": [
"order_approved",
"order_cancelled"
],
"product_details": {},
"event_success": "<string>",
"event_error": "<string>"
}
'import requests
url = "https://api.lojou.app/v1/webhooks"
payload = {
"url": "https://minhaloja.example.com/webhooks/lojou",
"name": "Novo pedido",
"events": ["order_approved", "order_cancelled"],
"product_details": {},
"event_success": "<string>",
"event_error": "<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({
url: 'https://minhaloja.example.com/webhooks/lojou',
name: 'Novo pedido',
events: ['order_approved', 'order_cancelled'],
product_details: {},
event_success: '<string>',
event_error: '<string>'
})
};
fetch('https://api.lojou.app/v1/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.lojou.app/v1/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([
'url' => 'https://minhaloja.example.com/webhooks/lojou',
'name' => 'Novo pedido',
'events' => [
'order_approved',
'order_cancelled'
],
'product_details' => [
],
'event_success' => '<string>',
'event_error' => '<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.lojou.app/v1/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://minhaloja.example.com/webhooks/lojou\",\n \"name\": \"Novo pedido\",\n \"events\": [\n \"order_approved\",\n \"order_cancelled\"\n ],\n \"product_details\": {},\n \"event_success\": \"<string>\",\n \"event_error\": \"<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.lojou.app/v1/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://minhaloja.example.com/webhooks/lojou\",\n \"name\": \"Novo pedido\",\n \"events\": [\n \"order_approved\",\n \"order_cancelled\"\n ],\n \"product_details\": {},\n \"event_success\": \"<string>\",\n \"event_error\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lojou.app/v1/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 \"url\": \"https://minhaloja.example.com/webhooks/lojou\",\n \"name\": \"Novo pedido\",\n \"events\": [\n \"order_approved\",\n \"order_cancelled\"\n ],\n \"product_details\": {},\n \"event_success\": \"<string>\",\n \"event_error\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Webhook created successfully.",
"webhook": {
"id": 3,
"name": "Novo pedido",
"url": "https://minhaloja.example.com/webhooks/lojou",
"events": [
"order_approved"
],
"product_details": null,
"event_success": null,
"event_error": null,
"reports_count": 0,
"created_at": "2026-08-31T16:25:00.000000Z",
"updated_at": "2026-08-31T16:25:00.000000Z"
}
}{
"status": "error",
"message": "Unauthorized user."
}{
"status": "error",
"message": "Permission denied for this endpoint.",
"error_code": "insufficient_scope",
"required_scopes": [
"orders.read"
],
"missing_scopes": [
"orders.read"
],
"granted_scopes": [
"products.read",
"products.write"
]
}{
"status": "error",
"message": "Validation failed.",
"errors": {
"amount": [
"The amount field is required."
]
}
}Autorizações
Send an API key or an OAuth access token in the Authorization header
as a Bearer token. See Authentication for details.
Corpo
application/json
Exemplo:
"https://minhaloja.example.com/webhooks/lojou"
Exemplo:
"Novo pedido"
order_refund is offered as an option but is not currently fired by
any real event — see the Webhooks guide.
Opções disponíveis:
order_approved, order_cancelled, order_refund Exemplo:
["order_approved", "order_cancelled"]
Resposta
Webhook created
The response is of type object.
