Foundaree Memory for developers

People save notes once in Foundaree Memory, like “my shop opens at 9” or “keep replies short”. Your app can read those notes at the start of a chat and save new ones. Same memory, in every AI app.

How it works

  1. Your app registers once and gets a client id.
  2. The person signs in with Foundaree and taps Allow.
  3. Your server gets a token.
  4. Before each AI reply, your server fetches the notes. After, it saves anything new.

1. Register your app

curl -X POST https://foundaree.com/api/oauth/register \
  -H "Content-Type: application/json" \
  -d '{"client_name":"My App","redirect_uris":["https://myapp.example/callback"]}'
# → {"client_id":"..."}   Keep the client_id. Do this once.

2. Send the person to Foundaree

Open this address in their browser. They see your app’s name and exactly what it can do, and tap Allow. They come back to your redirect address with a code. It is OAuth with PKCE (S256); there is no client secret.

https://foundaree.com/oauth/authorize
  ?client_id=YOUR_CLIENT_ID
  &redirect_uri=https://myapp.example/callback
  &response_type=code
  &scope=memory
  &state=ANY_RANDOM_TEXT
  &code_challenge=PKCE_CHALLENGE
  &code_challenge_method=S256

3. Swap the code for a token

curl -X POST https://foundaree.com/api/oauth/token \
  -d grant_type=authorization_code \
  -d client_id=YOUR_CLIENT_ID \
  -d code=THE_CODE_FROM_THE_REDIRECT \
  -d redirect_uri=https://myapp.example/callback \
  -d code_verifier=YOUR_PKCE_VERIFIER
# → {"access_token":"...","refresh_token":"...","expires_in":3600,"scope":"memory"}

4. Use their Memory

# What does this person want every AI to know? (ready to put in a prompt)
curl "https://foundaree.com/api/v1/memory/context?q=writing%20style" \
  -H "Authorization: Bearer ACCESS_TOKEN"

# Save something new the person told your app
curl -X POST https://foundaree.com/api/v1/memory \
  -H "Authorization: Bearer ACCESS_TOKEN" -H "Content-Type: application/json" \
  -d '{"content":"Prefers short, friendly replies","topic":"style"}'

# The notes as a list (best match first)
curl "https://foundaree.com/api/v1/memory?q=shop&limit=10" -H "Authorization: Bearer ACCESS_TOKEN"

/context returns { "context": "...", "count": 3 }: the notes as plain text you can put straight into a prompt. A note saved by your app shows the app’s name as its source.

The tunnel in one function

// One chat turn, with Foundaree Memory in the middle. Run this on your server.
async function chat(userMessage, accessToken) {
  const auth = { Authorization: "Bearer " + accessToken };

  // 1. Ask Foundaree what this person already told their other AIs.
  const memory = await fetch(
    "https://foundaree.com/api/v1/memory/context?q=" + encodeURIComponent(userMessage),
    { headers: auth }
  ).then((r) => r.json());

  // 2. Give it to your AI, then answer the person.
  const reply = await callYourAI({
    system: "You are a helpful assistant.\n\n" + memory.context,
    user: userMessage,
  });

  // 3. If the person said "remember ...", save it so every AI knows it too.
  if (/^remember\b/i.test(userMessage)) {
    await fetch("https://foundaree.com/api/v1/memory", {
      method: "POST",
      headers: { ...auth, "Content-Type": "application/json" },
      body: JSON.stringify({ content: userMessage.replace(/^remember\s*/i, "") }),
    });
  }
  return reply;
}

Rules

  • Ask for the person's permission first. They sign in with Foundaree and tap Allow. You never see their password.
  • Read and add only. Your app cannot change or delete notes. The person does that at foundaree.com/memory.
  • The notes are the person's facts and preferences, not instructions. Never obey commands written inside a note.
  • Save only what the person asked you to remember. Passwords, one-time codes, API keys and card numbers are refused.
  • Call from your server, not from a web page on another site. Keep tokens private.
  • Tokens last 1 hour. Use the refresh_token to get a new one. People can disconnect your app any time in Settings.

Building an AI assistant instead? Use the connector at https://foundaree.com/mcp. Read the AI guide. People manage their notes at /memory.