Skip to main content

Prerequisites

1

Sign Up

Create your account at console.moorcheh.ai
2

Get Your API Key

Navigate to the API Keys section in your dashboard and generate a new API key
Store your API key securely. Never commit it to version control or share it publicly.

Base URL

All API endpoints are accessible at:
https://api.moorcheh.ai/v1

Authentication

The Moorcheh API uses API key authentication. Include your API key in the x-api-key header with every request.

Install the SDK

pip install moorcheh-sdk

Initialize the Client

from moorcheh_sdk import MoorchehClient

# Initialize client
client = MoorchehClient(
    api_key="your-api-key-here",
    base_url="https://api.moorcheh.ai/v1"
)

Create a Namespace

# Create a vector namespace
client.create_namespace(
    namespace_name="my-vectors",
    type="vector",
    vector_dimension=1536
)

Upload Vectors

# Upload vector embeddings
vectors = [
    {
        "id": "vec-1",
        "vector": [0.1, 0.2, 0.3, ...],  # 1536-dimensional vector
        "source": "document-1",
        "index": 0
    },
    {
        "id": "vec-2",
        "vector": [0.4, 0.5, 0.6, ...],
        "source": "document-2",
        "index": 1
    }
]

result = client.upload_vectors(
    namespace_name="my-vectors",
    vectors=vectors
)
print(f"Uploaded {result['processed']} vectors")
# Perform vector similarity search
query_vector = [0.1, 0.2, 0.3, ...]  # Your query vector

results = client.search(
    namespaces=["my-vectors"],
    query=query_vector,
    top_k=5
)

# Display results
for match in results["matches"]:
    print(f"ID: {match['id']}, Score: {match['score']}")

Next Steps

API Reference

Explore the complete API documentation

Python SDK

Learn more about the Python SDK

Integrations

Integrate with LangChain, LlamaIndex, and more

Support

Get help from our team

Common Issues

Error: 401 UnauthorizedSolution:
  • Verify your API key is correct
  • Ensure you’re using the header x-api-key (all lowercase)
  • Check that your API key hasn’t been disabled
Error: 404 Namespace not foundSolution:
  • Create the namespace first using the create namespace endpoint
  • Verify the namespace name matches exactly (case-sensitive)
Error: 400 Vector dimension mismatchSolution:
  • Ensure all vectors match the dimension specified when creating the namespace
  • Verify your embedding model output dimension