# Quick Start

Go from zero to your first LVNG API call in under five minutes. This guide walks you through getting an API key and sending your first request using curl.

## Prerequisites

- An LVNG account -- [sign up at lvng.ai](https://lvng.ai) if you don't have one.
- A terminal with `curl` available.

## 1. Get Your API Key

Every request to the LVNG API must be authenticated. The fastest way to get started is with an API key.

1. Sign in to your dashboard at [lvng.ai](https://lvng.ai).
2. Navigate to **Settings > API Keys**.
3. Click **Generate New Key**.
4. Copy the key and store it somewhere safe. You will not be able to see it again.

API keys follow this format, where the token portion is 32-64 random characters:

```bash
vtron_cust_{customerId}_{token}
```

> **Important:** Treat your API key like a password. Never commit it to version control or expose it in client-side code. Use environment variables instead.

## 2. Configure Your Environment

Set your API key as an environment variable so you can reference it in commands.

```bash
# .env (add to .gitignore)
LVNG_API_KEY=vtron_cust_abc123_sk_live_9f8e7d6c5b4a3210fedcba98

# Base URL for all API requests
LVNG_API_URL=https://api.lvng.ai/api
```

Or export directly in your terminal:

```bash
export LVNG_API_KEY="vtron_cust_abc123_sk_live_9f8e7d6c5b4a3210fedcba98"
```

## 3. Make Your First API Call

Send a message to the LVNG chat endpoint. The base URL for all API requests is `https://api.lvng.ai/api`.

### Using curl

```bash
curl -X POST https://api.lvng.ai/api/v2/chat \
  -H "Authorization: Bearer $LVNG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Hello, LVNG!",
    "platform": "api"
  }'
```

### Response

```json
{
  "reply": "Hello! I'm LVNG, your AI assistant. How can I help you today?",
  "metadata": {
    "toolsUsed": [],
    "model": "sonnet",
    "responseTime": 1243
  }
}
```

### Using Node.js (fetch)

No SDK is required. Use the standard `fetch` API available in Node.js 18+.

```typescript
const response = await fetch('https://api.lvng.ai/api/v2/chat', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.LVNG_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    message: 'Hello, LVNG!',
    platform: 'api',
  }),
})

const data = await response.json()
console.log(data.reply)
// => "Hello! I'm LVNG, your AI assistant. How can I help you today?"
console.log(data.metadata)
// => { toolsUsed: [], model: "sonnet", responseTime: 1243 }
```

### Using Python (requests)

```python
import os
import requests

response = requests.post(
    "https://api.lvng.ai/api/v2/chat",
    headers={
        "Authorization": f"Bearer {os.environ['LVNG_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "message": "Hello, LVNG!",
        "platform": "api",
    },
)

data = response.json()
print(data["reply"])
print(data["metadata"])
```

## SDKs

> **Coming soon:** Official SDKs for TypeScript, Python, and Go are in development. In the meantime, the LVNG API is a standard REST API -- use any HTTP client in any language.

## Authentication Methods

The examples above use API key authentication via the `Authorization: Bearer` header. The API also supports JWT tokens for browser-based applications using the same header. The `x-api-key` header is also accepted as an alternative. See the [Authentication](/docs/getting-started/authentication) page for full details.

| Method | Header | Best For |
|--------|--------|----------|
| API Key | `Authorization: Bearer YOUR_API_KEY` | Backend services, scripts |
| JWT Token | `Authorization: Bearer <jwt>` | Browser apps, user sessions |

## Next Steps

- [Authentication](/docs/getting-started/authentication) -- JWT tokens, API key formats, request context, and tenant isolation.
- [API Reference](/docs/api) -- Full endpoint reference for chat, agents, workflows, and more.
- [Rate Limits](/docs/getting-started/rate-limits) -- Per-endpoint and per-plan rate limits, headers, and retry strategies.
- [Error Codes](/docs/errors) -- HTTP and Socket.io error codes, response formats, and troubleshooting.
