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

# Quickstart (Python)

> Install, authenticate, upload a file, and search — in five minutes.

This guide takes you from zero to a working search query against your own
content. You'll need Python 3.10+ and a Memic API key from the
[dashboard](https://memic.ai/dashboard/api-keys).

## 1. Install the SDK

```bash theme={null}
pip install memic
```

## 2. Authenticate

All Memic API calls are authenticated with an API key. Get one from your
environment's API keys page in the dashboard, then set it as an environment
variable:

```bash theme={null}
export MEMIC_API_KEY="mk_live_..."
```

The SDK picks it up automatically. You can also pass it explicitly:

```python theme={null}
from memic import Memic

client = Memic(api_key="mk_live_...")
```

<Info>
  Every API key is bound to exactly one **environment** (e.g. `staging` or
  `production`). Swap the key to swap environments — no code changes.
</Info>

## 3. Verify your connection

```python theme={null}
from memic import Memic

client = Memic()
print(client.me())
# ApiKeyInfo(organization_name='...', project_name='...', environment_slug='production')
```

If this returns your org and project, you're authenticated correctly.

## 4. Upload a file

Memic's upload flow uses presigned URLs so large files go directly to storage
without passing through the API server. The SDK handles both steps for you:

```python theme={null}
result = client.files.upload("./product-handbook.pdf")
print(result.file_id)
```

The file is queued for processing (chunking, embedding, indexing). You can
poll for status:

```python theme={null}
status = client.files.get_status(result.file_id)
print(status.status)  # pending → processing → ready
```

Typical processing time for a PDF is under 30 seconds.

## 5. Search your content

Once the file is `ready`, semantic search works immediately:

```python theme={null}
results = client.search("what is our refund policy")

for hit in results.semantic:
    print(f"[{hit.score:.2f}] {hit.text[:200]}...")
    print(f"   from {hit.source.file_name}")
```

## 6. Chat over your content

Search returns passages; chat returns grounded answers:

```python theme={null}
response = client.chat("Summarize our refund policy in three bullet points")

print(response.answer)
for citation in response.citations:
    print(f"  → {citation.file_name} (p. {citation.page})")
```

## Next steps

<CardGroup cols={2}>
  <Card title="Guide: Ingestion" icon="upload" href="/guides/ingestion">
    Batch uploads, metadata, folder organization.
  </Card>

  <Card title="Guide: Search" icon="magnifying-glass" href="/guides/search">
    Filters, top-k tuning, hybrid retrieval.
  </Card>

  <Card title="Recipe: Chatbot" icon="comments" href="/recipes/chatbot-with-memory">
    Build a customer-facing chat over your docs.
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/introduction">
    Every endpoint, every parameter.
  </Card>
</CardGroup>
