@xfloor-memory-sdk
  1. Core FloorMemory
@xfloor-memory-sdk
  • Get Started
    • Overview
    • Quick Start
    • Authentication and Identification
    • Core Concepts (5-Minute Read)
    • What to Use First (API Map)
  • SDK
    • Overview
    • SDK Installation & Setup
    • Python SDK
    • JavaScript SDK
    • Typescript SDK
    • Java SDK
    • FAQ & Troubleshooting
    • Copy-Paste Debug Checklists
  • Core FloorMemory
    • Query (Primary API)
      POST
    • Create Event (Post Content)
      POST
    • Recent Events
      GET
    • Basic information of a floor
      GET
  • Floor Management
    • Edit floor
      POST
    • Make floor Private
      POST
    • Make floor public
      POST
    • Rename floor
      POST
  • Registration
    • Sign Up
      POST
    • Sign In with email ID
      POST
    • Sign In with Mobile number
      POST
    • Validation
      POST
    • Change Password
      POST
    • Reset Password
      POST
    • Change email ID
      POST
    • Change Mobile number
      POST
    • Send Validation code
      POST
    • External User Registration
      POST
  • SDKs
  • Schemas
    • PostAdd
    • QueryResponse
    • Media
    • UserDetails
    • SignUpResponse
    • BlockDetails
    • FloorInfo
    • Threads
    • EventResponse
    • 400ErrorCode
    • Remaining
  1. Core FloorMemory

Query (Primary API)

POST
/agent/memory/query

Conversational Query API#

This is the core API of xfloor.
It accepts a natural language query and returns a conversational response
derived from:
Content ingested into the specified Floor
The user’s prior conversation history (if provided)
Relevant metadata and context
This API is designed for multi-turn conversations and can be used
to build:
AI chatbots
Knowledge assistants
Floor-specific copilots
This API enables conversational, context-aware querying over data stored within xfloor.
It accepts a natural language query (for example, “What options do I have in your institute?”) and returns relevant information derived from the specified floors and their associated content.
The API is designed for multi-turn conversations. Follow-up questions from the same user automatically build upon prior context, allowing the system to refine, expand, or clarify results across successive calls.

Core Capabilities#

Interprets natural language queries
Retrieves relevant information from one or more floors
Applies time-, type-, and tag-based filters
Supports Top-K retrieval for result control
Optionally includes metadata with responses
Can generate summarized responses when requested
Maintains conversation continuity across multiple queries from the same user

Authentication & Identity#

A valid user_id is required
User authentication is assumed to be completed before calling this API
app_id identifies the calling application context
Conversational continuity is maintained per user_id
Note: All queries from the same user_id are treated as part of a single conversational context unless explicitly reset by the application.

Request Contract#

HTTP Method#

POST

Content-Type#

application/json
Important:
This API accepts JSON requests only.
multipart/form-data is not supported.

Request Body (JSON)#

Field Descriptions#

FieldTypeRequiredDescription
user_idstringYesUnique xfloor user identifier. Used to maintain conversational continuity and personalization.
querystringYesNatural language query provided by the user.
floor_idsarray of stringsYesList of floor identifiers that define the search scope. Must be provided as a JSON array.
filtersobjectOptionalAdditional constraints to narrow search results.
filters.time_fromstring (ISO-8601)OptionalStart timestamp for filtering content by creation or update time.
filters.time_tostring (ISO-8601)OptionalEnd timestamp for filtering content by creation or update time.
filters.typesarray of stringsOptionalContent types to include (e.g., post, blog, forum).
filters.tagsarray of stringsOptionalTags used to further refine results.
kintegerOptionalMaximum number of results to retrieve (Top-K). Defaults to system-defined behavior if omitted.
include_metadatastring ("0" or "1")OptionalWhether to include metadata (source, timestamps, tags) in the response. Defaults to "0".
summary_neededstring ("0" or "1")OptionalWhether a summarized conversational answer should be generated. Defaults to "0".
app_idstringOptionalIdentifies the application invoking the API. Useful for multi-app integrations.

Important Encoding Rules#

floor_ids must be provided as a JSON array
"floor_ids": ["floor_1", "floor_2"]
Boolean-style flags (include_metadata, summary_needed) are encoded as string values: "0" or "1"
filters must be provided as a JSON object, not a string

Canonical Request Example#

{
  "user_id": "xf_user_123",
  "query": "What options do I have in your institute?",
  "floor_ids": ["institute_floor"],
  "filters": {
    "types": ["post", "blog"],
    "tags": ["admissions"]
  },
  "k": 5,
  "include_metadata": "1",
  "summary_needed": "1",
  "app_id": "student_portal"
}

Behavior#

1.
The query is analyzed using conversational and semantic understanding.
2.
Relevant content is retrieved from the specified floors.
3.
Filters (time, type, tags) are applied if provided.
4.
Results are ranked and limited based on k.
5.
If summary_needed = "1", a synthesized conversational summary is generated.
6.
If include_metadata = "1", metadata is attached to each result item.
7.
The response is returned in a conversational format suitable for follow-up questions.

Response Contract#

High-Level Response Structure#

{
  "answer": "Assistant-generated conversational response",
  "items": [
    {
      "id": "content_id",
      "type": "post",
      "text": "Original content snippet",
      "metadata": { }
    }
  ]
}

Response Field Semantics#

FieldAlways PresentDescriptionRendering Guidance
answerNoAssistant-generated conversational response. Depends on summary_needed. Is present if summary_needed=1Render prominently
itemsYes (may be empty)List of matched content used for groundingRender optionally
items[].metadataConditionalIncluded only if include_metadata = "1"Render on demand
No-Result Case:
If no relevant content is found, items will be an empty array and answer will contain a conversational fallback response.

Conversation Continuity#

Conversation state is maintained per user_id
Follow-up queries automatically reference prior context
The API does not require explicit conversation IDs
Applications may reset conversation context by using a new user_id

Error Handling#

The API may return errors in the following cases:
Missing or invalid user_id
Empty or unsupported query
Invalid or inaccessible floor_ids
Authorization or application context errors
Internal processing failures
All errors are returned with appropriate HTTP status codes and descriptive messages.

Typical Use Case Flow#

1.
User asks an initial question
“What options do I have in your institute?”
2.
Application calls /agent/memory/query
3.
Results are displayed to the user
4.
User asks a follow-up
“Which ones are available on weekends?”
5.
Application calls the same API again with the new query
6.
Conversation continues seamlessly using prior context

One-Line Summary#

Executes a conversational query over xfloor content, returning context-aware, filtered, and optionally summarized results with support for multi-turn interactions.

Request

Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Body Params application/jsonRequired

Examples

Responses

🟢200Success
application/json
Primary response payload containing assistant output and retrieved content.
This response represents the successful execution of a conversational query processed by the agent.
The API performs:
1.
Interpretation of the user’s query
2.
Optional retrieval of relevant content (posts/events/blocks)
3.
Generation of a final natural-language answer
The response contains two logical parts:
answer → the assistant’s final conversational response (what should be shown to the user)
items → the list of retrieved content items that were matched and used (or considered) during answer generation

Response Structure

{
  "answer": "string",
  "items": [ ... ]
}

Top-Level Fields

FieldTypeDescription
answerStringFinal assistant-generated response to the user query
itemsArrayList of matched content items retrieved during processing

answer

"answer": "non veniam reprehenderit labore"

Description

This is the final conversational output generated by the agent.
It is intended to be directly rendered in the chat or UI.
The content may be:
A direct answer
A summary
A synthesized response based on retrieved items

items[] – Retrieved Content Items

Each entry in items represents a content block or event that matched the query.
These items are typically used for:
Explainability (“why this answer?”)
Debugging or analytics
Showing sources or related content (optional UI)

Item Object Structure

{
  "block_type": 25453249,
  "block_id": "96",
  "floor_uid": "87",
  "event_id": "59",
  "text": "Deficio cruentus voluptatem...",
  "score": -80399794.92417637,
  "block_title": "furthermore separately skeleton...",
  "block_details": "Duis magna dolore",
  "from_floor_uid": "73",
  "user_id": "32",
  "match_type": "culpa mollit"
}

Item Fields

FieldTypeDescription
block_typeNumberIdentifier of the block type (e.g., feed, blog, forum, quiz)
block_idStringUnique identifier of the block containing the content
block_titleStringTitle of the block
block_detailsStringDescription or metadata associated with the block
event_idStringIdentifier of the specific event/post within the block
floor_uidStringInternal floor ID where the content belongs
from_floor_uidStringSource floor ID (used when content is derived, federated, or aggregated)
user_idStringIdentifier of the user who created the content
textStringContent text used for matching or retrieval
scoreNumberSimilarity or relevance score assigned by the retrieval system
match_typeStringType or category of match (e.g., semantic, keyword, hybrid)

Interpretation of score

Higher relevance is typically indicated by better score ranking (interpretation depends on backend logic)
Scores may be positive or negative depending on normalization and similarity model
Clients should not rely on absolute score values, only relative ordering

Typical Usage Patterns

Chat UI

Display only answer
Ignore items unless showing “Sources” or “Related content”

Debug / Analytics

Inspect items to understand what content influenced the answer
Use score, match_type, and block metadata

Explainable AI

Show selected items as citations or expandable references

Notes for Developers

items may be an empty array if no relevant content was retrieved
The answer is always present on success
The order of items is typically sorted by relevance
Field values and score scales are implementation-specific and may evolve

Minimal Mental Model

Answer = what the agent says
Items = what the agent looked at
Body

🟠422Error
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://appfloor.in/agent/memory/query' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "user_id": "string",
    "query": "string",
    "floor_ids": [
        "string"
    ],
    "include_metadata": "string",
    "summary_needed": "string",
    "app_id": "string",
    "filters": {
        "time_from": "string",
        "time_to": "string",
        "filter_types": "string",
        "filter_tags": "string"
    }
}'
Response Response Example
200 - Example 1
{
    "items": [
        {
            "block_type": 0,
            "block_id": "string",
            "floor_uid": "string",
            "event_id": "string",
            "text": "string",
            "score": 0,
            "block_title": "string",
            "block_details": "string",
            "from_floor_uid": "string",
            "user_id": "string",
            "match_type": "string"
        }
    ],
    "answer": "string"
}
Modified at 2026-02-23 16:09:37
Previous
Core FloorMemory
Next
Create Event (Post Content)
Built with