Logs de auditoría
curl --request GET \
--url https://api.example.com/admin/audit-logsimport requests
url = "https://api.example.com/admin/audit-logs"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/admin/audit-logs', 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.example.com/admin/audit-logs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/admin/audit-logs"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/admin/audit-logs")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/admin/audit-logs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "log_abc123",
"userId": "usr_abc123",
"action": "user.login",
"resource": "auth",
"details": {
"ip": "192.168.1.1",
"userAgent": "Mozilla/5.0"
},
"createdAt": "2026-03-30T14:00:00Z"
},
{
"id": "log_def456",
"userId": "usr_abc123",
"action": "merchant.create",
"resource": "merchants",
"details": {
"merchantId": "merch_abc123",
"name": "Mi Tienda Online"
},
"createdAt": "2026-03-30T13:00:00Z"
}
],
"page": 1,
"limit": 20,
"total": 2
}
Admin
Logs de auditoría
Obtiene los registros de auditoría de la plataforma. Requiere rol ADMIN.
GET
/
admin
/
audit-logs
Logs de auditoría
curl --request GET \
--url https://api.example.com/admin/audit-logsimport requests
url = "https://api.example.com/admin/audit-logs"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/admin/audit-logs', 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.example.com/admin/audit-logs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/admin/audit-logs"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/admin/audit-logs")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/admin/audit-logs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "log_abc123",
"userId": "usr_abc123",
"action": "user.login",
"resource": "auth",
"details": {
"ip": "192.168.1.1",
"userAgent": "Mozilla/5.0"
},
"createdAt": "2026-03-30T14:00:00Z"
},
{
"id": "log_def456",
"userId": "usr_abc123",
"action": "merchant.create",
"resource": "merchants",
"details": {
"merchantId": "merch_abc123",
"name": "Mi Tienda Online"
},
"createdAt": "2026-03-30T13:00:00Z"
}
],
"page": 1,
"limit": 20,
"total": 2
}
Requiere autenticación con Bearer token y rol ADMIN.
Respuesta
La respuesta es un array de registros de auditoría:{
"data": [
{
"id": "log_abc123",
"userId": "usr_abc123",
"action": "user.login",
"resource": "auth",
"details": {
"ip": "192.168.1.1",
"userAgent": "Mozilla/5.0"
},
"createdAt": "2026-03-30T14:00:00Z"
},
{
"id": "log_def456",
"userId": "usr_abc123",
"action": "merchant.create",
"resource": "merchants",
"details": {
"merchantId": "merch_abc123",
"name": "Mi Tienda Online"
},
"createdAt": "2026-03-30T13:00:00Z"
}
],
"page": 1,
"limit": 20,
"total": 2
}