API Reference

Explore all available API endpoints for xmem.

Query with Context

Send a query and receive an LLM response with intelligently selected context.

POST/api/query

Session Management

Create and manage memory sessions for conversations.

POST/api/sessions

Feedback Collection

Submit feedback on context relevance to improve future rankings.

POST/api/feedback

Context Preview

Preview the context that would be selected for a given query.

GET/api/context

Memory Management

Add, update, or delete items in the memory store.

POST/api/memory

Query with Context

POST/api/query

Send a query and receive an LLM response with intelligently selected context.

Example

// Query with Context Example
const response = await fetch('https://www.xmem.xyz/api/query', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_API_KEY'
  },
  body: JSON.stringify({
    query: "What were the key decisions in yesterday's meeting?",
    sessionId: "session_12345",
    maxTokens: 4000,
    rankingMethod: "smart"
  })
});

const result = await response.json();
console.log(result.response); // LLM response with context