Create Audit Log
curl --request POST \
--url https://api.example.com/api/audit/ \
--header 'Content-Type: application/json' \
--data '
{
"message": {},
"timestamp": "<string>"
}
'import requests
url = "https://api.example.com/api/audit/"
payload = {
"message": {},
"timestamp": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({message: {}, timestamp: '<string>'})
};
fetch('https://api.example.com/api/audit/', 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/api/audit/",
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([
'message' => [
],
'timestamp' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/api/audit/"
payload := strings.NewReader("{\n \"message\": {},\n \"timestamp\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/api/audit/")
.header("Content-Type", "application/json")
.body("{\n \"message\": {},\n \"timestamp\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/audit/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": {},\n \"timestamp\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyAudit
Create Audit Log
Create an audit log entry
POST
/
api
/
audit
/
Create Audit Log
curl --request POST \
--url https://api.example.com/api/audit/ \
--header 'Content-Type: application/json' \
--data '
{
"message": {},
"timestamp": "<string>"
}
'import requests
url = "https://api.example.com/api/audit/"
payload = {
"message": {},
"timestamp": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({message: {}, timestamp: '<string>'})
};
fetch('https://api.example.com/api/audit/', 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/api/audit/",
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([
'message' => [
],
'timestamp' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/api/audit/"
payload := strings.NewReader("{\n \"message\": {},\n \"timestamp\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/api/audit/")
.header("Content-Type", "application/json")
.body("{\n \"message\": {},\n \"timestamp\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/audit/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": {},\n \"timestamp\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyAuthentication
Supports both Firebase and API Key authentication.Request Body
object
required
Structured log data (JSONB)
string
ISO 8601 timestamp (defaults to now)
Example Request
curl -X POST https://api.sari-platform.com/api/audit/ \
-H "X-Client-ID: client_abc123" \
-H "X-API-Key: <api_key>" \
-H "Content-Type: application/json" \
-d '{
"message": {
"action": "api_call",
"collection_id": "collection-uuid",
"method": "GET",
"endpoint": "/users",
"status_code": 200,
"duration_ms": 150
},
"timestamp": "2024-01-15T10:00:00Z"
}'
Response
{
"id": "log-uuid",
"message": {
"action": "api_call",
"collection_id": "collection-uuid",
"method": "GET",
"endpoint": "/users",
"status_code": 200,
"duration_ms": 150
},
"timestamp": "2024-01-15T10:00:00Z"
}
Common Message Fields
| Field | Description |
|---|---|
action | Type of action (api_call, login, etc.) |
client_id | Client identifier |
collection_id | Collection UUID |
method | HTTP method |
endpoint | API endpoint |
status_code | Response status |
duration_ms | Request duration |
Errors
| Status | Description |
|---|---|
| 400 | Invalid request body |
| 401 | Invalid authentication |
⌘I

