Write Data
Store and update user data in BlueNexus's secure, confidential database. Collections are created automatically on first use, and all data is automatically isolated per user and application.
Create a New Record
Store a new record in a specified collection. Collections are created automatically on first use.
import fetch from "node-fetch";
const memoryData = {
title: "Morning Workout",
content: "Completed 30-minute run in the park. Feeling energized!",
category: "fitness",
timestamp: "2024-12-15T08:30:00Z",
tags: ["exercise", "health", "running"],
mood: "energized",
schemaUri: "https://example.com/schemas/memory.json", // Optional (see structured data)
};
const response = await fetch(
"https://api.bluenexus.ai/api/v1/data/memories",
{
method: "POST",
headers: {
Authorization: `Bearer ${USER_ACCESS_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify(memoryData),
}
);
const createdRecord = await response.json();
// Example response:
// {
// "id": "66bd3762c23f9e3f152fb4d1",
// "title": "Morning Workout",
// "content": "Completed 30-minute run in the park. Feeling energized!",
// "category": "fitness",
// "timestamp": "2024-12-15T08:30:00Z",
// "tags": ["exercise", "health", "running"],
// "mood": "energized",
// "createdAt": "2024-12-15T09:00:00.000Z",
// "updatedAt": "2024-12-15T09:00:00.000Z"
// }Update a Data Record
Update an existing record by its ID. You can update any fields in the record.
Partial Updates: Only the fields you provide will be updated. Other fields remain unchanged.
Best Practices
Use descriptive, plural collection names (e.g., "memories", "preferences", "notes")
Include timestamp fields in your data for better tracking
Use
schemaUrifor important data to ensure consistencyUpdate only the fields that changed to minimize data transfer
Last updated

