> ## Documentation Index
> Fetch the complete documentation index at: https://developers.lighton.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Get a search result in under 5 minutes.

## 1. Get your API key

Create one from the **API Keys** section of the [console](https://console.lighton.ai) and copy it. You will not see it again. Then set it as an environment variable:

```bash theme={null}
export LIGHTON_API_KEY=your_api_key_here
```

See [Authentication](/authentication) for more on key management.

## 2. Upload a document

```python theme={null}
import requests, time

headers = {"Authorization": "Bearer $LIGHTON_API_KEY"}

response = requests.post(
    "https://api.lighton.ai/api/v3/files",
    headers=headers,
    data={"workspace_id": 42},
    files={"file": open("handbook.pdf", "rb")},
)
file = response.json()
print(f"Uploaded: {file['id']}, status: {file['status']}")
# → Uploaded: 12345, status: pending
```

Indexing takes a few seconds. Poll until `status` is `embedded`:

```python theme={null}
file_id = file["id"]
while True:
    r = requests.get(f"https://api.lighton.ai/api/v3/files/{file_id}", headers=headers)
    if r.json()["status"] == "embedded":
        break
    time.sleep(2)
```

## 3. Search it

```python theme={null}
response = requests.post(
    "https://api.lighton.ai/api/v3/search",
    headers=headers,
    json={
        "query": "What is the vacation policy at LightOn?",
        "workspace_id": [42],
        "max_results": 3,
    },
)
for result in response.json()["results"]:
    print(f"[p.{result['source']['page_start']}–{result['source']['page_end']}, score={result['score']:.2f}]")
    print(result["content"][:120])
    print()
```

```
[p.4–4, score=0.94]
Employees are entitled to 25 days of paid leave per year...

[p.4–4, score=0.87]
Unused vacation days carry over up to a maximum of 10 days...

[p.7–7, score=0.71]
Public holidays are in addition to the annual leave entitlement...
```

Three API calls: upload, wait, search. That's the full pipeline.

<Card title="Next: Authentication" icon="key" href="/authentication">
  Learn how API keys work and how to handle auth errors.
</Card>
