> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anonalabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Javascript

# JavaScript / TypeScript SDK

Anona Memory's officially supported client library is Python (`pip install anona`) - see the [Python SDK docs](/sdk/python).

There is no dedicated JavaScript/TypeScript SDK yet. From Node.js or the browser, call the REST API directly.

## Using the REST API from Node.js

```javascript theme={null}
const API_BASE = "http://anona-prod-alb-747552680.us-east-1.elb.amazonaws.com";
const API_KEY = process.env.ANONA_API_KEY;

async function addMemory(spaceId, content, metadata) {
  const res = await fetch(`${API_BASE}/v1/memories`, {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${API_KEY}`,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({ space_id: spaceId, content, metadata })
  });
  if (!res.ok) {
    const err = await res.json();
    throw new Error(`${res.status}: ${err.error.message}`);
  }
  return res.json();
}

async function search(spaceId, query, limit = 10) {
  const res = await fetch(`${API_BASE}/v1/search`, {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${API_KEY}`,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({ space_id: spaceId, query, limit })
  });
  const data = await res.json();
  return data.results;
}
```

## Browser Usage

Never call the API directly from client-side JavaScript - your API key would be exposed. Route calls through your own backend:

```javascript theme={null}
// Backend route, e.g. /api/memories/search
app.post("/api/memories/search", async (req, res) => {
  const results = await search(req.body.spaceId, req.body.query);
  res.json(results);
});
```

```javascript theme={null}
// Frontend
const results = await fetch("/api/memories/search", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ spaceId: "spc_a1b2c3d4", query: "Where does Alice work?" })
}).then(r => r.json());
```

## Full Endpoint Reference

See the [API Reference](/api-reference/authentication) for every available endpoint, request/response shape, and error format.

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Python SDK" icon="python" href="/sdk/python">
    Officially supported client library
  </Card>

  <Card title="API Reference" icon="rectangle-terminal" href="/api-reference/authentication">
    Full REST API documentation
  </Card>
</CardGroup>
