# Introduction

Welcome to the Opally API documentation. The Opally API gives you programmatic access to your company's email, chat, voice, lead, and agent action data — making it easy to build custom dashboards, integrate with BI tools, or power your own reporting UI.

## Base URL

```
https://api.opally.com/v1
```

All API requests must be made over HTTPS. Requests over plain HTTP will be rejected.

## Quick Start

1. **Get your API key** from the Opally dashboard under **Integrations > Developer > API Access**
2. **Make your first request:**

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

```bash
curl https://api.opally.com/v1/analytics/overview \
  -H "Authorization: Bearer op_live_your_api_key_here"
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const response = await fetch('https://api.opally.com/v1/analytics/overview', {
  headers: {
    'Authorization': 'Bearer op_live_your_api_key_here'
  }
});
const data = await response.json();
console.log(data);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

response = requests.get(
    'https://api.opally.com/v1/analytics/overview',
    headers={'Authorization': 'Bearer op_live_your_api_key_here'}
)
data = response.json()
print(data)
```

{% endtab %}

{% tab title="CLI" %}

```bash
npm install -g @opally/cli
opally login op_live_your_api_key_here
opally analytics overview
```

{% endtab %}
{% endtabs %}

3. **Explore** the endpoints below to fetch analytics, conversation logs, and leads.

## CLI

The [Opally CLI](https://github.com/opally-com/opally-cli) lets you query the API directly from your terminal — no code required.

```bash
npm install -g @opally/cli
opally login op_live_your_api_key_here
```

```bash
opally emails list --limit 5
opally chats messages <id>
opally analytics overview --from 2026-03-01 --to 2026-03-13
opally leads list --source chat --json
```

All commands support `--json` for machine-readable output. See the [CLI documentation](https://github.com/opally-com/opally-cli) for the full command reference.

## What can you build?

* **Custom dashboards** — Display email, chat, and voice metrics in your own internal tools
* **BI integrations** — Pull data into Looker, Metabase, or any analytics platform
* **Guest communication logs** — Show conversation history in your PMS or CRM
* **Lead tracking** — Pipe captured leads into your sales pipeline

## API Overview

| Resource                                                    | Endpoints                 | Description                             |
| ----------------------------------------------------------- | ------------------------- | --------------------------------------- |
| [Analytics](/opally-api-docs/analytics/overview.md)         | `GET /v1/analytics/*`     | Aggregated metrics and time-series data |
| [Conversations](/opally-api-docs/conversations/overview.md) | `GET /v1/conversations/*` | Email logs, chat threads, voice calls   |
| [Leads](/opally-api-docs/leads/overview.md)                 | `GET /v1/leads`           | Captured lead contact information       |


---

# 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://opally.gitbook.io/opally-api-docs/readme.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.
