Skip to main content
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.

1. Install the SDK

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:
export MEMIC_API_KEY="mk_live_..."
The SDK picks it up automatically. You can also pass it explicitly:
from memic import Memic

client = Memic(api_key="mk_live_...")
Every API key is bound to exactly one environment (e.g. staging or production). Swap the key to swap environments — no code changes.

3. Verify your connection

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:
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:
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:
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:
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

Guide: Ingestion

Batch uploads, metadata, folder organization.

Guide: Search

Filters, top-k tuning, hybrid retrieval.

Recipe: Chatbot

Build a customer-facing chat over your docs.

API Reference

Every endpoint, every parameter.