Skip to main content
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>"
}
'

Authentication

Supports both Firebase and API Key authentication.

Request Body

message
object
required
Structured log data (JSONB)
timestamp
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

FieldDescription
actionType of action (api_call, login, etc.)
client_idClient identifier
collection_idCollection UUID
methodHTTP method
endpointAPI endpoint
status_codeResponse status
duration_msRequest duration

Errors

StatusDescription
400Invalid request body
401Invalid authentication