@xfloor-memory-sdk
  1. SDK
@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. SDK

Typescript SDK

FloorMemory TypeScript SDK#

The FloorMemory TypeScript SDK provides full type safety on top of the FloorMemory APIs, making it ideal for:
Frontend applications (React, Next.js, Vue)
Large strictly typed codebases
Enterprise dashboards
AI-assisted UI layers
It mirrors the FloorMemory API surface with strongly typed request/response contracts.
You can use it to:
Query memory-aware conversations
Add content and structured events to Floors
Retrieve activity feeds and conversations
Fetch floor metadata for UI rendering and permissions
Manage floor visibility and settings (owner-only)
There is no single high-level client abstraction.
You work with capability-based API classes (Query, Events, Floors, Auth).

Source Code#

Official TypeScript SDK#

πŸ‘‰ https://github.com/xFloorllm/floor-memory-sdk-client/tree/main/ts

Production Examples (Highly Recommended)#

πŸ‘‰ https://github.com/xFloorllm/floor-memory-sdk-examples/tree/main/ts
The examples repository contains:
Strictly typed frontend integrations
React usage patterns
Event ingestion flows
Multi-turn conversational examples
Production-safe configuration patterns
If you are building a real application, start there.

Installation#

or

Importing the SDK#

import {
  Configuration,
  QueryApi,
  EventApi,
  GetRecentEventsApi,
  GetFloorInformationApi,
  EditFloorApi,
  DefaultApi,
} from "@xfloor/floor-memory-sdk-ts";

Authentication & Setup#

All FloorMemory APIs require:
Bearer Access Token
App ID
const config = new Configuration({
  accessToken: "<USER_ACCESS_TOKEN>",
  basePath: "https://appfloor.in", // optional
});

Important Notes#

Token is sent as:
Authorization: Bearer <token>
appId is passed explicitly per API call
appId is never globally configured
Never embed tokens in frontend source code (use secure storage)

Common Parameter Glossary#

ParameterMeaning
userIdUnique xfloor user identifier. Enables personalization and conversation continuity.
appIdCalling application context identifier.
floorIdSingle floor scope.
floorIdsMulti-floor scope (used by Query API).
blockIdBlock container inside floor.
blockTypeCategory type (post, forum).
Async ingestionCreate Event returns success when queued; use Recent Events to confirm visibility.

Querying a Floor (Primary API)#

The Query API is the main way to interact with FloorMemory.
const queryApi = new QueryApi(config);

const response = await queryApi.query({
  userId: "user_123",
  floorId: "floor_456",
  appId: "1234567890123",
  query: "Explain binary search trees",
});

console.log(response.answer);

Parameters#

FieldTypeRequiredDescription
userIdstringβœ…Enables conversation continuity
floorIdstringβœ…Floor to search within
querystringβœ…Natural language query
appIdstringOptionalApplication context identifier

What This Does#

Loads relevant conversation history
Retrieves floor-grounded knowledge
Returns contextual answer
Stores interaction for follow-ups

Adding Content to a Floor (Create Event)#

Use events to add knowledge that future conversations can reference.
const eventApi = new EventApi(config);

await eventApi.createEvent(
  {
    floorId: "floor_456",
    userId: "user_123",
    title: "Binary Search Tree Notes",
    content: "A binary search tree is a node-based data structure...",
    blockId: "1765960948723",
    blockType: "1",
  },
  {
    appId: "1234567890123",
  }
);

Parameters#

FieldTypeRequiredDescription
floorIdstringβœ…Target floor
userIdstringβœ…Author
titlestringOptionalFeed/UI title
contentstringβœ…Main text content
blockIdstringOptionalBlock container
blockTypestringOptionalCategory (0 for post, 1 for forum)
appIdstringOptionalPassed separately

Event Behavior#

Indexed automatically
Scoped to floor
Ingestion is asynchronous
Immediately returns when queued
If your SDK exposes the raw OpenAPI-style API (inputInfo), then:
block_id = block container
block_type = category type
app_id is passed separately, not inside payload

Retrieve Recent Events (Activity Feed)#

const eventsApi = new GetRecentEventsApi(config);

const events = await eventsApi.getRecentEvents({
  floorId: "floor_456",
  userId: "user_123",
  appId: "1234567890123",
});

events.forEach(event => {
  console.log(event.title);
});
Use this if you need deterministic confirmation of ingestion.

Fetch Floor Metadata#

const floorApi = new GetFloorInformationApi(config);

const floor = await floorApi.getFloorInformation({
  floorId: "floor_456",
  userId: "user_123",
  appId: "1234567890123",
});

console.log(floor.title);
console.log(floor.blocks);
Returns metadata only (no embeddings).

Edit Floor (Owner Only)#

const editApi = new EditFloorApi(config);

await editApi.editFloor({
  floorId: "floor_456",
  userId: "user_123",
  appId: "1234567890123",
  title: "Advanced Data Structures",
  details: "Notes on trees and graphs",
});

Manage Floor Visibility#

const defaultApi = new DefaultApi(config);

await defaultApi.makeFloorPrivate({
  floorId: "floor_456",
  userId: "user_123",
  appId: "1234567890123",
});

Complete Client-Side Example (React)#

import { useState } from "react";
import { Configuration, QueryApi } from "@xfloor/floor-memory-sdk-ts";

const config = new Configuration({
  accessToken: localStorage.getItem("XFLOOR_TOKEN")!,
  basePath: "https://appfloor.in",
});

const queryApi = new QueryApi(config);

export function AskFloor() {
  const [question, setQuestion] = useState("");
  const [answer, setAnswer] = useState<string | null>(null);
  const [loading, setLoading] = useState(false);

  async function ask() {
    setLoading(true);
    try {
      const res = await queryApi.query({
        userId: "user_123",
        floorId: "floor_456",
        appId: "1234567890123",
        query: question,
      });
      setAnswer(res.answer);
    } finally {
      setLoading(false);
    }
  }

  return (
    <div>
      <input
        value={question}
        onChange={e => setQuestion(e.target.value)}
        placeholder="Ask something…"
      />
      <button onClick={ask} disabled={loading}>
        Ask
      </button>

      {answer && <p>{answer}</p>}
    </div>
  );
}

Using the Official TypeScript Examples#

If you are building:
A React / Next.js frontend
A typed dashboard
A memory-enabled chat interface
A structured content ingestion UI
A production SPA
Use the official examples:
πŸ‘‰ https://github.com/xFloorllm/floor-memory-sdk-examples/tree/main/ts
The examples repository demonstrates:
Proper token handling
Strict TypeScript typing patterns
Clean separation of config and API usage
Deterministic ingestion flow
Multi-floor conversational patterns

Error Handling#

try {
  await queryApi.query({ ... });
} catch (error) {
  console.error(error);
}

Best Practices#

401 / 403 β†’ Re-authenticate
4xx β†’ Validation or permission issues
5xx β†’ Retry or show fallback UI
Avoid silent failures

Performance & Usage Notes#

One Configuration per logged-in user
Safe for SPA frameworks
Do not hardcode secrets
Use secure token storage and refresh logic
Keep userId stable for conversation continuity

Where to Go Next#

πŸ‘‰ JavaScript SDK
πŸ‘‰ Python SDK
πŸ‘‰ Java SDK
πŸ‘‰ Core FloorMemory APIs
Modified atΒ 2026-02-19 05:04:04
Previous
JavaScript SDK
Next
Java SDK
Built with