supermemory/apps/docs/snippets/api-v5-profiles.mdx
MaheshtheDev 672defc08b docs: move SDK snippets to the shipped v5 call shape and finish the namespace rename (#1772)
Rewrites 339 TypeScript calls across 50 pages from the rc.5 `method({ namespace, body })` form to the shipped `method(namespace, { ... })` form, and aligns field names with the live v5 spec: `attach` to `include`, `authUrl` to `authorization`, `lastSync` to `latestRun`, `deletedCount` to `count`, and the paginated `namespaces.list()`.

Renames container tags to namespaces across concepts, connectors, integrations and snippets. The namespace pages keep container tag in the description, search keywords and a rename note so old searches still land, and the v3 reference page points at v5.

The migration guide's SDK table now covers both 5.0.0 SDKs, and the SDK integration page uses the real client options (`baseUrl`, `timeoutInSeconds`, `maxRetries`) and error classes.
2026-10-06 17:06:38 +00:00

102 lines
3 KiB
Text

v5 returns a maintained profile directly and gives profile bucket definitions their own namespace-scoped resource.
### Remove search behavior from profile calls
<CodeGroup>
```bash Legacy
POST /v4/profile
{"containerTag":"user_1","q":"work preferences","threshold":0.6,"include":{}}
```
```bash v5
POST /ns/user_1/profile
{"filter":{"field":"region","operator":"eq","value":"us-west"},"buckets":["work"]}
```
</CodeGroup>
Remove legacy `q`, `threshold`, and `include`. If the caller needs query-ranked results, issue a separate v5 search request. Move `containerTag` to the path and rename `filters` to singular `filter`.
### Read the v5 profile shape
```json
{
"profile": {
"static": [{ "id": "mem_1", "memory": "The user works in design" }],
"dynamic": [{ "id": "mem_2", "memory": "The user is preparing a launch" }],
"buckets": { "work": [{ "id": "mem_3", "memory": "Prefers concise project updates" }] }
}
}
```
`static` and `dynamic` are always returned and cannot be disabled. Omit `buckets` in the request to return every effective custom bucket; pass up to 50 names to narrow only the bucket section.
### Read bucket definitions
<CodeGroup>
```bash Legacy
POST /v4/profile/buckets
{"containerTag":"user_1"}
```
```bash v5
GET /ns/user_1/profile/buckets
```
</CodeGroup>
The response changes from key/description objects to a map:
```json
{"buckets":{"work":"Professional preferences and ongoing work"}}
```
### Add or edit namespace buckets
```bash
PUT /ns/user_1/profile/buckets
{"buckets":{"work":"Professional preferences and ongoing work"}}
```
Send one to 50 name-to-description entries. Existing namespace names are updated, new names are added, and omitted namespace buckets remain unchanged.
### Delete namespace buckets
```bash
DELETE /ns/user_1/profile/buckets
{"buckets":["work"]}
```
Names must be unique. Organization-owned buckets can appear in the effective GET response but cannot be changed or removed through namespace PUT or DELETE calls.
### With the SDK
<CodeGroup>
```ts Legacy
const profile = await client.profile({ containerTag: "user_1", q: "work preferences" })
const buckets = await client.profile.buckets({ containerTag: "user_1" })
```
```ts v5
const { profile } = await supermemory.profile("user_1", {
buckets: ["work"],
})
const buckets = await supermemory.profiles.getBuckets("user_1")
await supermemory.profiles.setBuckets("user_1", {
buckets: { work: "Professional preferences and ongoing work" },
})
await supermemory.profiles.deleteBuckets("user_1", {
buckets: ["work"],
})
```
</CodeGroup>
`supermemory.profile` takes no query. `body` is optional and accepts only `filter` and `buckets`. Read `profile.static`, `profile.dynamic`, and `profile.buckets[name]` as arrays of `{ id, memory }`.
### Verification
- Confirm every profile response contains `static`, `dynamic`, and `buckets`.
- Compare omitted buckets with one-name and multi-name narrowing.
- Add, edit, and delete a namespace bucket without replacing omitted buckets.
- Attempt to mutate an inherited organization bucket and expect the documented error.