Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docu.loghub.app/docs/llms.txt

Use this file to discover all available pages before exploring further.

Body


actor
object
required
The ‘actor’ parameter refers to who performs the action, which can be a user or a system. If the action is performed by the system, there is no need to send the name, email, internal_id and you can send only the description parameter to describe the system (ex: Cron update prices)
action
string
required
The ‘action’ parameter refers to the action performed, such as ‘settings.updated’, ‘email.sending’ or ‘has change admin password’, etc.
metadata
object
required
You can send whatever you need within this object. For example, you can attach an object with the old data and another with the changes made to the data.
external_id
string|number
required
It corresponds to a unique identifier of your application to which the audit event will be associated. For example, if your application manages workspaces, you can send the workspace ID. Then, when you incorporate our log audit table into your application, you will be able to perform specific workspace filtering.
tags
array
tag list ex: [“production, “team-admin”, ”…”]
context
object
required
cconst myHeaders = new Headers();
myHeaders.append("token", "your_secret");
myHeaders.append("organization", "organization_id");
myHeaders.append("Content-Type", "application/json");

const raw = JSON.stringify({
  "actor": {
    "type": "user",
    "data": {
      "name": "Jonathan Wick",
      "email": "[email protected]",
      "internal_id": "1"
    }
  },
  "action": "api.testing.tres",
  "metadata": {
    "old": {
      "theme": "dark",
      "organization_name": "continental"
    },
    "new": {
      "theme": "light",
      "organization_name": "the continental"
    },
    "key": "value"
  },
  "tags": [
    "production",
    "..."
  ],
  "external_id": "1",
  "context": {
    "location": "190.0.0.12",
    "user_agent": "Chrome..."
  }
});

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  redirect: "follow"
};

fetch("https://api.loghub.app/v1/event", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
{
    "code": "CREATE_EVENT_OK",
    "status": "ok",
    "data": {
        "id": "d71331b8-5448-4542-9a3f-bf3021390a1c",
        "timestamp": 1713035172197
    }
}