Profile

Query a profile

Ask a natural-language question about a user’s memory or historical data. This endpoint retrieves insights from the user’s ingested events, documents, and summaries, returning a concise, deterministic text answer.

POST /query

Purpose

Use this endpoint when you want to query what the system already knows about a user — such as preferences, communication patterns, relationships, or routines.

Typical use cases include:

  • Asking “Who does this user collaborate with most?”

  • Determining “When does this user prefer meetings?”

  • Retrieving user-specific insights for model grounding or decision logic.

Endpoint

Headers

Authorization: x-api-key: <token>

Request Body

Field

Type

Required

Description

user_id

string

Yes

The user ID whose memory or profile to query.

question

string

Yes

A natural-language question to answer based on the user’s stored data.

use_cache

boolean

Optional

If true, returns a cached recent answer for repeated queries. Default: false.

Example Request

{
  "user_id": "usr_42af7c",
  "question": "Who are the three people Ash emails most frequently, and what are their roles?",
  "use_cache": true
}

Example cURL

curl -X POST "https://api.fastino.ai/query" \
  -H "Authorization: x-api-key: sk_test_123" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "usr_42af7c",
    "question": "Who are the three people Ash emails most frequently, and what are their roles?",
    "use_cache": true
  }'

Example Response

{
  "user_id": "usr_42af7c",
  "answer": "Ash frequently communicates with George Maloney (COO @ Fastino), Curren Kulkarni (Chief of Staff), and Dhruv Atreja (Engineering Lead)."
}

Response Fields

Field

Type

Description

user_id

string

ID of the queried user.

answer

string

Deterministic natural-language answer derived from user data.

Behavior

  • Responses are generated deterministically and grounded in the user’s stored data.

  • Setting "use_cache": true will reuse recent results for identical queries, improving performance.

  • The answer field always returns concise, factual text suitable for direct use in chat, LLM reasoning, or analytics.

  • Cached results expire automatically when new data is ingested for the user.

Error Responses

HTTP Code

Error Code

Description

400

INVALID_REQUEST

The request body is malformed or missing required fields.

401

UNAUTHORIZED

API key missing or invalid.

404

USER_NOT_FOUND

No user exists with the provided user_id.

500

SERVER_ERROR

Internal service failure. Retry after a short delay.

Example:

{
  "error": {
    "code": "USER_NOT_FOUND",
    "message": "No user found with ID usr_42af7c"
  }
}

Example Implementation (Python)

import requests

BASE_URL = "https://api.fastino.ai"
HEADERS = {"Authorization": "x-api-key: sk_live_456", "Content-Type": "application/json"}

payload = {
    "user_id": "usr_42af7c",
    "question": "Who does Ash collaborate with most often?",
    "use_cache": True
}

r = requests.post(f"{BASE_URL}/query", json=payload, headers=HEADERS)
print(r.json()["answer"])

Best Practices

  • Keep questions clear, factual, and user-specific (avoid ambiguous prompts).

  • Enable use_cache for repeated dashboard or agent queries to reduce latency.

  • Ensure the user has relevant ingested data before querying.

  • Combine /query with /summary to cross-check results.

  • For multi-turn agents, store answers locally to maintain continuity across sessions.

Related Endpoints

Endpoint

Description

GET /summary

Retrieve a deterministic, purpose-based user summary.

POST /chunks

Retrieve top-k relevant memory snippets for grounding.

POST /ingest

Add new events or documents for future queries.

Summary:
Use POST /query to ask natural-language questions about a user’s profile and history.
This endpoint is ideal for fetching precise, deterministic insights — powering personalized reasoning and memory recall across your agents.

On this page