Click any endpoint below to see details, examples, and copy-paste code.
Need an API key? Create one here (requires sign in).
What is this?
An API that lets you do two things — use either one or both together:
1. Turn text into numbers
Give it any text, get back a list of numbers (called an "embedding") that captures the meaning of that text. Two similar sentences will produce similar numbers.
Use case: compare text similarity, build recommendations, power AI features.
2. Store & search by meaning
Save your documents, and later search them by meaning instead of exact keywords. Ask "how to deploy?" and find a doc about "shipping to production".
Use case: AI chatbot knowledge base, semantic search, document Q&A.
How the Vector Database is structured
You can have unlimited projects, each with multiple collections, each with millions of documents.
Getting Started
Get your API key
Go to API Keys and create a new key. Copy it — you’ll need it for every request.
Set your base URL and headers
Every request goes to the same base URL with your API key in the header:
const API = "https://embeddings.anantgupta.xyz";
const headers = {
"x-api-key": "YOUR_KEY",
"Content-Type": "application/json"
};Make your first call
See the examples under each endpoint below, or try one of these:
Note: In the endpoints below, :project and :collection are placeholders. Replace them with your actual names, e.g. /projects/myapp/collections/docs/search
Turn text into numbers. No storage, no setup — just send text and get embeddings back.
const res = await fetch(API + "/embed", {
method: "POST", headers,
body: JSON.stringify({ texts: ["hello world", "another text"] })
});
const { vectors } = await res.json();
// vectors[0] = [0.012, -0.034, ...] (1024 numbers per text)POST /embedRequest Body
textsstring[]Array of texts to embed{"texts": ["hello world", "another text"]}Response 200 OK
vectorsnumber[][]Array of embedding vectors (1024 numbers each)dimensionsnumberVector size (1024)countnumberNumber of texts embedded{"vectors": [[0.012, -0.034, ...]], "dimensions": 1024, "count": 2}Already using OpenAI embeddings? Just change the base URL — no code changes needed. Works with the official OpenAI SDKs.
POST /v1/embeddingsAuthorization: Bearer YOUR_KEYbge-m3from openai import OpenAI
client = OpenAI(
api_key="YOUR_KEY",
base_url="https://embeddings.anantgupta.xyz/v1"
)
# Single text
response = client.embeddings.create(
input="hello world",
model="bge-m3"
)
vector = response.data[0].embedding # 1024 numbers
# Multiple texts
response = client.embeddings.create(
input=["hello", "world"],
model="bge-m3"
)
vectors = [d.embedding for d in response.data]Migrating from OpenAI?
Just change two things:
base_url = "https://api.openai.com/v1" → base_url = "https://embeddings.anantgupta.xyz/v1"api_key = "sk-..." → api_key = "emb_..."Note: Dimensions change from 1536 (OpenAI) to 1024 (BGE-M3). If your vector DB has a fixed dimension, you’ll need to recreate the index.
A project is like a folder. It groups your collections together.
GET /projectsResponse 200 OK
projectsobjectMap of project names to their collection names{"projects": {"myapp": ["docs", "code"]}}DELETE /projects/myappResponse 200 OK
deletednumberNumber of collections removedcollectionsstring[]Names of deleted collections{"deleted": 2, "collections": ["myapp__docs", "myapp__code"]}A collection is a searchable database inside a project. Think of it like a table that understands meaning.
POST /projects/myapp/collectionsRequest Body
namestringCollection name (e.g. "docs")distancestring?Optional. Default: "Cosine"{"name": "docs"}Response 200 OK
createdstringFull collection IDvectorSizenumberEmbedding dimensions (1024){"created": "myapp__docs", "vectorSize": 1024}GET /projects/myapp/collectionsResponse 200 OK
projectstringProject namecollectionsstring[]List of collection names{"project": "myapp", "collections": ["docs", "code"]}GET /projects/myapp/collections/docsResponse 200 OK
infoobjectCollection stats including points_count, config, etc.{"project": "myapp", "collection": "docs", "info": {"points_count": 450}}DELETE /projects/myapp/collections/docsResponse 200 OK
deletedstringName of the deleted collection{"deleted": "myapp__docs"}Add text to a collection. The text is automatically converted to an embedding and stored — you just send the text.
// Add documents
await fetch(API + "/projects/myapp/collections/docs/documents", {
method: "POST", headers,
body: JSON.stringify({ documents: [
{ id: 1, text: "React is great for UIs", metadata: { category: "frontend" } },
{ id: 2, text: "Express handles routing", metadata: { category: "backend" } }
]})
});POST /projects/myapp/collections/docs/documentsRequest Body
documentsarrayArray of documents to storedocuments[].idnumberUnique ID for this documentdocuments[].textstringThe text content to embed and storedocuments[].metadataobject?Optional key-value pairs for filtering{"documents": [{"id": 1, "text": "React is a JS library", "metadata": {"category": "frontend"}}]}Response 200 OK
storednumberNumber of documents stored{"stored": 1, "collection": "myapp__docs"}GET /projects/myapp/collections/docs/documentsResponse 200 OK
documentsarrayArray of stored documents with text and metadatanext_offsetstring?Pass this as ?offset= to get the next page{"documents": [{"id": 1, "text": "...", "category": "frontend"}], "next_offset": "..."}DELETE /projects/myapp/collections/docs/documentsRequest Body
idsnumber[]Array of document IDs to delete{"ids": [1, 2, 3]}Response 200 OK
deletednumberNumber of documents removed{"deleted": 3}Find documents by meaning. Ask "how to deploy?" and it’ll find your doc about "shipping to production" — even though the words are different.
const res = await fetch(API + "/projects/myapp/collections/docs/search", {
method: "POST", headers,
body: JSON.stringify({ query: "frontend development", limit: 5 })
});
const { results } = await res.json();
// results[0] = { id: 1, score: 0.89, text: "React is great for UIs" }POST /projects/myapp/collections/docs/searchRequest Body
querystringYour search text (searched by meaning, not keywords)limitnumber?Max results to return (default: 5)filterobject?Optional metadata filter (see Filtering below){"query": "frontend frameworks", "limit": 5}Response 200 OK
resultsarrayMatched documents, sorted by relevanceresults[].idnumberDocument IDresults[].scorenumberSimilarity score (0 to 1, higher = better match)results[].textstringThe document textresults[].*anyAny metadata fields from the document{"results": [{"id": 1, "score": 0.95, "text": "React is a JS library", "category": "frontend"}]}Filtering search results
If your documents have metadata (like category), you can filter search to only match specific values:
// "Find deployment docs, but only in the devops category"
{
"query": "deployment",
"limit": 5,
"filter": {
"must": [{ "key": "category", "match": { "value": "devops" } }]
}
}
Metadata is set when you add documents: {"id": 1, "text": "...", "metadata": {"category": "devops"}}
Errors & Limits
Authentication: Every request needs an x-api-key header. Missing or invalid key returns 401.
Errors: Failed requests return {"error": "description"} with appropriate HTTP status (400, 404, 500).
Batch size: Embed up to 32 texts per request. For documents, send up to 8 at a time (each gets embedded on the server).
Text length: Up to 8,192 tokens per text (~6,000 words).
Names: Project and collection names must be 1-64 characters, alphanumeric with hyphens and underscores.
Use cases
Store your docs, let users ask questions in natural language
Search blog posts, help articles, or products by meaning
Find similar items — articles, products, or content
Retrieve relevant context to feed into LLMs like GPT or Claude