Skip to main content
If you’re integrating from a language Memic doesn’t have an SDK for yet, or just want to verify the API works, you can use cURL or any HTTP client. This walkthrough hits the same endpoints as the Python quickstart, just over raw HTTP.

1. Get an API key

Grab one from the dashboard and export it in your shell:
export MEMIC_API_KEY="mk_live_..."
export MEMIC_BASE_URL="https://api.memic.ai/api/v1"

2. Verify authentication

curl "$MEMIC_BASE_URL/me" \
  -H "X-API-Key: $MEMIC_API_KEY"
Expected response:
{
  "organization_id": "fc4dab50-480d-454f-8c62-f25248d5cd9e",
  "organization_name": "Acme Corp",
  "project_id": "49d4ff53-64df-4dd1-8714-4763954a18ac",
  "project_name": "Tech companies",
  "environment_id": "...",
  "environment_slug": "production"
}
If this returns your organization and project, you’re authenticated.

3. List files in your environment

curl "$MEMIC_BASE_URL/files" \
  -H "X-API-Key: $MEMIC_API_KEY"
You’ll get a paginated list of files already in the environment.

4. Upload a file (two-step flow)

Memic uses presigned URLs for upload so large files go directly to storage. It’s a two-step process: init to get a presigned URL, then PUT the file to that URL, then confirm to trigger processing.

Step 1 — Initialize the upload

curl "$MEMIC_BASE_URL/files/init" \
  -H "X-API-Key: $MEMIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filename": "product-handbook.pdf",
    "content_type": "application/pdf",
    "size_bytes": 1048576
  }'
Response:
{
  "file_id": "...",
  "upload_url": "https://storage.memic.ai/...",
  "expires_at": "..."
}

Step 2 — Upload the file to the presigned URL

curl -X PUT "<upload_url from step 1>" \
  --data-binary @./product-handbook.pdf

Step 3 — Confirm the upload

curl -X POST "$MEMIC_BASE_URL/files/<file_id>/confirm" \
  -H "X-API-Key: $MEMIC_API_KEY"
Memic now starts processing the file (chunking, embedding, indexing).

Step 4 — Poll for processing status

curl "$MEMIC_BASE_URL/files/<file_id>/status" \
  -H "X-API-Key: $MEMIC_API_KEY"
Wait until status is ready.
curl "$MEMIC_BASE_URL/search" \
  -H "X-API-Key: $MEMIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "what is our refund policy",
    "top_k": 5
  }'

6. Chat

curl "$MEMIC_BASE_URL/chat" \
  -H "X-API-Key: $MEMIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "user", "content": "Summarize our refund policy"}
    ]
  }'

What’s next?

API Reference

Every endpoint, every parameter, every error code — with a live try-it playground.