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 Memicclient = 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.
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.
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}")