Quickstart

Quickstart

Learn how to quickly set up Moonbase.

Prerequisites

It's recommended that you follow the onboarding process after signing up.

1. Create a project

Project

Your project ID can be found on the project settings page.

Project page

2. Create an API key

Tokens

You can create an API key under your team settings. This is available for both personal accounts and team accounts.

3. Send logs

curl -X POST "https://api.moonbasehq.com/v1/projects/<projectId>/logs?levelKey=level" \
  -H "x-moonbase-token: <token>" \
  -H "Content-Type: application/json" \
  -d '{
      "body": "Congrats! You published your first log.",
      "level": "info"
  }'

SDK Installation

Install the SDK. For this example, we'll be using the Node SDK.

pnpm i --save @moonbasehq/js

Configure the SDK

const moon = new Moonbase({
  apiKey: 'moonbase_...',
  projectId: 'clvmvinlr0003zs0sh6z675hk'
});

Ingest logs for a project

import { Moonbase } from "@moonbasehq/js";
 
const messages = [
  {
    body: "Congrats! You published your first log.",
    some: {
      nested: {
        object: true
      }
    }
  }
]
 
moon.ingest(messages).then((res) => {
  console.log('Done ingesting!');
}).