# Quick Start

## Create a project.

LogSnag lets you make a project for each app you have. You can make as many as you like!

Click the "+" button on the side and give your project a name, like "**my-saas**."

## Create a channel.

Channels are like boxes for your events. You could have one for payments, another for logins, and so on.

Click the "+" button on the side and name your channel "**payments**."

{% hint style="info" %}
Keep your project and channel names simple! Use lowercase for project and channel names, with letters, numbers, and dashes.
{% endhint %}

## Create an API token.

API tokens let LogSnag know it's really you. You can make as many as you like, each with different access levels.

To make an API token, go to the API page in Settings and create and copy a new token.

{% hint style="info" %}
If you're using LogSnag on a website or app that others can see, make sure to set your Token's access to "Public." Also, keep its roles limited to a certain project and channel.
{% endhint %}

## Track your first event.

Now that you have your project, channel, and API token, you're ready to track an event! You can do this by making a POST request to the LogSnag API.

{% tabs %}
{% tab title="cURL" %}

```shell
curl --location --request POST 'https://api.logsnag.com/v1/log' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "project": "my-saas",
    "channel": "payments",
    "event": "New Subscription",
    "user_id": "user-123",
    "icon": "💰",
    "notify": true,
    "tags": {
        "plan": "premium",
        "cycle": "monthly",
        "trial": false
    }
}'
```

{% endtab %}

{% tab title="Python" %}

```
pip3 install logsnag
```

```python
from logsnag import LogSnag

logsnag = LogSnag(token='<TOKEN>', project='my-saas')

logsnag.track(
    channel="payments",
    event="New Subscription",
    user_id="user-123",
    icon="💰",
    notify=True,
    tags={
        "plan": "premium",
        "cycle": "monthly",
        "trial": False
    }
)
```

{% endtab %}

{% tab title="JavaScript" %}

```html
<script src="https://cdn.logsnag.com/js/1.0.0/ls.js"></script>
```

```javascript
const logsnag = new window.LogSnag({
  token: '<TOKEN>',
  project: 'my-saas',
})

await logsnag.track({
  channel: "payments",
  event: "New Subscription",
  user_id: "user-123",
  icon: "💰",
  notify: true,
  tags: {
    plan: "premium",
    cycle: "monthly",
    trial: false
  } 
})
```

{% endtab %}

{% tab title="NodeJS" %}

```shell
npm install logsnag
```

```javascript
import { LogSnag } from 'logsnag';

const logsnag = new LogSnag({
  token: '<TOKEN>',
  project: 'my-saas',
})

await logsnag.track({
  channel: "payments",
  event: "New Subscription",
  user_id: "user-123",
  icon: "💰",
  notify: true,
  tags: {
    plan: "premium",
    cycle: "monthly",
    trial: false
  } 
})
```

{% endtab %}

{% tab title="Deno" %}

```typescript
import { LogSnag } from 'https://cdn.logsnag.com/deno/1.0.0/index.ts';

const logsnag = new LogSnag({
  token: '<TOKEN>',
  project: 'my-saas',
})

await logsnag.track({
  channel: "payments",
  event: "New Subscription",
  user_id: "user-123",
  icon: "💰",
  notify: true,
  tags: {
    plan: "premium",
    cycle: "monthly",
    trial: false
  } 
})
```

{% endtab %}
{% endtabs %}

After making the request, you'll get a notification on your device. You'll also see the event pop up in real time on the LogSnag dashboard! It'll be under the **"payments"** channel in the **"my-saas"** project.

Want to learn more about logs? Have a look at the /log endpoint section. You can also check out other endpoints on the API references page.

{% content-ref url="/pages/6994vR8X0vBWH0AoJtg5" %}
[Log](/api-reference/log.md)
{% endcontent-ref %}

{% content-ref url="/pages/K5zs92Wz1oU9bvKXsjME" %}
[Identify](/api-reference/identify.md)
{% endcontent-ref %}

{% content-ref url="/pages/VRvto3bU9Y2voy2FS9Oc" %}
[Insight](/api-reference/insight.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.logsnag.com/quick-start.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
