API Reference
Ask

Ask

POST

/v1/ask

Ask natural language questions about your stored memories. Hypersave uses AI to find relevant content and generate intelligent answers.

Request Body

ParameterTypeRequiredDescription
querystringYesYour question in natural language
limitnumberNoMax memories to consider (default: 10)
spaceIdstringNoLimit search to specific space
filtersobjectNoAdditional filters (tags, date range, etc.)
includeContextbooleanNoInclude source memories in response (default: false)
modelstringNoAI model to use (default, fast, smart)

Examples

Basic Question

curl -X POST https://api.hypersave.io/v1/ask \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "When is the next board meeting?"
  }'

Question with Context

Include the source memories that were used to generate the answer:

curl -X POST https://api.hypersave.io/v1/ask \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What were the key decisions from last week?",
    "includeContext": true,
    "limit": 5
  }'

Question with Filters

Filter by tags, date range, or specific space:

curl -X POST https://api.hypersave.io/v1/ask \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What is the project budget?",
    "filters": {
      "tags": ["finance", "budget"],
      "after": "2024-01-01",
      "before": "2024-12-31"
    }
  }'

Response

Success Response

{
  "success": true,
  "answer": "The next board meeting is scheduled for January 25th at 2:00 PM. The agenda includes quarterly financial review and the new product roadmap presentation.",
  "confidence": 0.92,
  "tokensUsed": 450
}

Response with Context

When includeContext: true:

{
  "success": true,
  "answer": "The next board meeting is scheduled for January 25th at 2:00 PM.",
  "confidence": 0.92,
  "context": [
    {
      "id": "doc_abc123",
      "content": "Board meeting confirmed for January 25th at 2pm. Agenda: Q4 review, product roadmap...",
      "title": "Calendar Update",
      "relevance": 0.95
    },
    {
      "id": "doc_xyz789",
      "content": "Preparing slides for the January board meeting presentation...",
      "title": "Meeting Prep Notes",
      "relevance": 0.78
    }
  ],
  "tokensUsed": 650
}

Response Fields

FieldTypeDescription
answerstringAI-generated answer to your question
confidencenumberConfidence score (0-1)
contextarraySource memories (when includeContext: true)
tokensUsednumberTokens consumed for this request
noResultbooleanTrue if no relevant information was found

Model Options

ModelDescriptionBest For
defaultBalanced speed and qualityMost queries
fastFaster responses, lower qualitySimple questions
smartHigher quality, slowerComplex questions
curl -X POST https://api.hypersave.io/v1/ask \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "Analyze the trends in our customer feedback",
    "model": "smart"
  }'

No Results Response

When Hypersave can't find relevant information:

{
  "success": true,
  "answer": "I don't have enough information to answer this question.",
  "noResult": true,
  "suggestion": "Try saving relevant content first, or rephrase your question."
}

If you're getting "no result" responses, try saving more relevant content or use broader search terms in your query.

Error Responses

Empty Query

{
  "success": false,
  "error": "VALIDATION_ERROR",
  "message": "Query is required"
}

Query Too Long

{
  "success": false,
  "error": "VALIDATION_ERROR",
  "message": "Query exceeds maximum length of 1000 characters"
}