Quick Start
Publish your first event.

Setup your Project

LogSnag uses projects to give you a workspace for each of your applications. Within a project, you may create as many channels to organize your events in any way you choose.
To get started, create your first project and channel. In this example, I have called my project my-website and my first channel user-register
The project and channel values should be lowercase! Alphabet characters, digits, and dashes "-" are accepted. Validation Regex: ^[a-z0-9]+(?:-[a-z0-9]+)*$

Copy your API token

Your API requests are authenticated using API keys. Any request that doesn't include an API key will return an error. Head to the API page under Settings, then create and copy a new API token.
Important: If you're using LogSnag within a public-facing website or client application. Please ensure to set your Token's access level to "Public" and limit its roles to a specific project and channel.

Publish your first event

Now you can publish your first event to LogSnag. To do so, make a POST request to the log endpoint. Once you have published your event, it will show up in the LogSnag App in real-time, and you will receive a push notification if you have set the notify flag to true.
post
https://api.logsnag.com/v1/
log
Publish an event to LogSnag.
Take a look at an example for publishing events.
cURL
Python
JavaScript
curl --location --request POST 'https://api.logsnag.com/v1/log' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"project": "my-website",
"channel": "user-register",
"event": "User Registered",
"description": "email: [email protected]",
"icon": "πŸ”₯",
"notify": true,
"tags": {
"email": "[email protected]",
"uid": "uid1234"
}
}'
import requests
import json
​
url = "https://api.logsnag.com/v1/log"
​
payload = json.dumps({
"project": "my-website",
"channel": "user-register",
"event": "User Registered",
"description": "email: [email protected]",
"icon": "πŸ”₯",
"notify": True,
"tags": {
"email": "[email protected]",
"uid": "uid1234"
}
})
headers = {
'Authorization': 'Bearer <TOKEN>',
'Content-Type': 'application/json'
}
​
requests.request("POST", url, headers=headers, data=payload)
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer <TOKEN>");
myHeaders.append("Content-Type", "application/json");
​
var raw = JSON.stringify({
"project": "my-website",
"channel": "user-register",
"event": "User Registered",
"description": "email: [email protected]",
"icon": "πŸ”₯",
"notify": true,
"tags": {
"email": "[email protected]",
"uid": "uid1234"
}
});
​
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
​
fetch("https://api.logsnag.com/v1/log", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Check out the Log endpoint to learn more.

Publish your first Insight

Insights are tiny widgets you may set up in any way you want. They always represent the latest value and update in real-time. They are great for tracking KPIs, service status, metrics, etc.
post
https://api.logsnag.com/v1
/insight
Publish an insight to LogSnag.
Take a look at an example for publishing insights.
cURL
Python
JavaScript
curl --location --request POST 'https://api.logsnag.com/v1/insight' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"project": "my-website",
"title": "User Count",
"value": "12,500",
"icon": "πŸ§‘"
}'
import requests
import json
​
url = "https://api.logsnag.com/v1/insight"
​
payload = json.dumps({
"project": "my-website",
"title": "User Count",
"value": "12,500",
"icon": "πŸ§‘"
})
headers = {
'Authorization': 'Bearer <TOKEN>',
'Content-Type': 'application/json'
}
​
requests.request("POST", url, headers=headers, data=payload)
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer <TOKEN>");
myHeaders.append("Content-Type", "application/json");
​
var raw = JSON.stringify({
"project": "my-website",
"title": "User Count",
"value": "12,500",
"icon": "πŸ§‘"
});
​
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
​
fetch("https://api.logsnag.com/v1/insight", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Check out the Insight endpoint to learn more.
Copy link
Outline
Setup your Project
Copy your API token
Publish your first event
post
Publish an event to LogSnag.
Publish your first Insight
post
Publish an insight to LogSnag.