# Save one Assistant preference for the caller

Stores one concise preference (at most 200 characters) for all the caller’s projects (`projectId: null`) or for one project, optionally limited to some of its channels. `language` and `length` keep one entry per scope and channel set: a new one replaces the old. Statements that look like passwords, keys or tokens are refused. Fails with `memory_full` when the scope reached its limit, and `memory_off` while memory is off for the caller.

URL: /docs/reference/assistant-memory/saveAssistantMemory

```json
{"openapi":"3.0.3","info":{"title":"Postdot API","description":"The HTTP API for the lightweight, self-hosted Postdot publication orchestrator.","version":"0.1.0"},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"Postdot API key","description":"A user-owned Postdot API key sent as `Authorization: Bearer <token>`. Its project scope is limited by the creator’s current access."},"sessionCookie":{"type":"apiKey","in":"cookie","name":"better-auth.session_token","description":"The Better Auth email/password session cookie used by the web application."}},"schemas":{}},"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"tags":[{"name":"System","description":"Service health and runtime information."},{"name":"Access","description":"Instance membership and invitations."},{"name":"Projects","description":"Project lifecycle and access."},{"name":"Channels","description":"Project publication destinations."},{"name":"Posts","description":"Source posts and publication creation."},{"name":"Publications","description":"Publication workflow operations."},{"name":"Taxonomy","description":"Project categories and publication tags."},{"name":"Media","description":"Project media assets and uploads."},{"name":"Settings","description":"Instance-level runtime configuration."},{"name":"Audit","description":"Project audit history."},{"name":"Notifications","description":"Signed-in user notification inboxes with optional project context."},{"name":"Analytics","description":"Provider-neutral publication and execution analytics."},{"name":"Provider Analytics","description":"Persisted provider-owned metric observations."},{"name":"Webhooks","description":"Project webhook subscriptions and delivery history."}],"paths":{"/api/assistant/memories":{"post":{"operationId":"saveAssistantMemory","summary":"Save one Assistant preference for the caller","description":"Stores one concise preference (at most 200 characters) for all the caller’s projects (`projectId: null`) or for one project, optionally limited to some of its channels. `language` and `length` keep one entry per scope and channel set: a new one replaces the old. Statements that look like passwords, keys or tokens are refused. Fails with `memory_full` when the scope reached its limit, and `memory_off` while memory is off for the caller.","tags":["Assistant memory"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["projectId","topic","statement"],"properties":{"projectId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9_-]+$"},{"type":"null"}]},"topic":{"type":"string","enum":["language","tone","length","format","audience","channels","scheduling","workflow","other"]},"statement":{"type":"string","minLength":1,"maxLength":1000},"channelIds":{"anyOf":[{"type":"array","items":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9_-]+$"},"maxItems":10},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]},"replaces":{"type":"array","items":{"type":"object","required":["id"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9_-]+$"},"revision":{"type":"integer","minimum":1}}},"maxItems":50}}}},"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["projectId","topic","statement"],"properties":{"projectId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9_-]+$"},{"type":"null"}]},"topic":{"type":"string","enum":["language","tone","length","format","audience","channels","scheduling","workflow","other"]},"statement":{"type":"string","minLength":1,"maxLength":1000},"channelIds":{"anyOf":[{"type":"array","items":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9_-]+$"},"maxItems":10},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]},"replaces":{"type":"array","items":{"type":"object","required":["id"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9_-]+$"},"revision":{"type":"integer","minimum":1}}},"maxItems":50}}}},"multipart/form-data":{"schema":{"type":"object","required":["projectId","topic","statement"],"properties":{"projectId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9_-]+$"},{"type":"null"}]},"topic":{"type":"string","enum":["language","tone","length","format","audience","channels","scheduling","workflow","other"]},"statement":{"type":"string","minLength":1,"maxLength":1000},"channelIds":{"anyOf":[{"type":"array","items":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9_-]+$"},"maxItems":10},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]},"replaces":{"type":"array","items":{"type":"object","required":["id"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9_-]+$"},"revision":{"type":"integer","minimum":1}}},"maxItems":50}}}}}},"responses":{"201":{"description":"Response for status 201","content":{"application/json":{"schema":{"type":"object","required":["memory","replaced"],"properties":{"memory":{"type":"object","required":["id","projectId","projectName","topic","statement","channelIds","channels","expiresAt","basisMessageId","basis","source","sourceRef","revision","createdAt","updatedAt"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9_-]+$"},"projectId":{"anyOf":[{"type":"string"},{"type":"null"}]},"projectName":{"anyOf":[{"type":"string"},{"type":"null"}]},"topic":{"type":"string","enum":["language","tone","length","format","audience","channels","scheduling","workflow","other"]},"statement":{"type":"string"},"channelIds":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"channels":{"anyOf":[{"type":"array","items":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}}},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"integer"},{"type":"null"}]},"basisMessageId":{"anyOf":[{"type":"string"},{"type":"null"}]},"basis":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"type":"string","enum":["assistant","studio","api"]},"sourceRef":{"anyOf":[{"type":"string"},{"type":"null"}]},"revision":{"type":"integer","minimum":1},"createdAt":{"type":"integer"},"updatedAt":{"type":"integer"}}},"replaced":{"type":"array","items":{"type":"object","required":["id","projectId","projectName","topic","statement","channelIds","channels","expiresAt","basisMessageId","basis","source","sourceRef","revision","createdAt","updatedAt"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9_-]+$"},"projectId":{"anyOf":[{"type":"string"},{"type":"null"}]},"projectName":{"anyOf":[{"type":"string"},{"type":"null"}]},"topic":{"type":"string","enum":["language","tone","length","format","audience","channels","scheduling","workflow","other"]},"statement":{"type":"string"},"channelIds":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"channels":{"anyOf":[{"type":"array","items":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}}},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"integer"},{"type":"null"}]},"basisMessageId":{"anyOf":[{"type":"string"},{"type":"null"}]},"basis":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"type":"string","enum":["assistant","studio","api"]},"sourceRef":{"anyOf":[{"type":"string"},{"type":"null"}]},"revision":{"type":"integer","minimum":1},"createdAt":{"type":"integer"},"updatedAt":{"type":"integer"}}}}}}}}},"400":{"description":"Response for status 400","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["memory_off","memory_invalid","memory_credential","memory_project","memory_missing","memory_changed","memory_full","confirmation_required"]},"message":{"type":"string"}}}}}}}},"401":{"description":"Response for status 401","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"confirmation":{"type":"string"},"warnings":{"type":"array","items":{"type":"object","required":["channelId","rule","period","maximum","count"],"properties":{"channelId":{"type":"string"},"rule":{"type":"string","enum":["daily_max","weekly_max"]},"period":{"type":"string"},"maximum":{"type":"integer"},"count":{"type":"integer"}}}},"code":{"type":"string"},"message":{"type":"string"},"publicationIds":{"type":"array","items":{"type":"string"}}}}}}}}},"403":{"description":"Response for status 403","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"confirmation":{"type":"string"},"warnings":{"type":"array","items":{"type":"object","required":["channelId","rule","period","maximum","count"],"properties":{"channelId":{"type":"string"},"rule":{"type":"string","enum":["daily_max","weekly_max"]},"period":{"type":"string"},"maximum":{"type":"integer"},"count":{"type":"integer"}}}},"code":{"type":"string"},"message":{"type":"string"},"publicationIds":{"type":"array","items":{"type":"string"}}}}}}}}},"404":{"description":"Response for status 404","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["memory_off","memory_invalid","memory_credential","memory_project","memory_missing","memory_changed","memory_full","confirmation_required"]},"message":{"type":"string"}}}}}}}},"409":{"description":"Response for status 409","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["memory_off","memory_invalid","memory_credential","memory_project","memory_missing","memory_changed","memory_full","confirmation_required"]},"message":{"type":"string"}}}}}}}},"503":{"description":"Response for status 503","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"confirmation":{"type":"string"},"warnings":{"type":"array","items":{"type":"object","required":["channelId","rule","period","maximum","count"],"properties":{"channelId":{"type":"string"},"rule":{"type":"string","enum":["daily_max","weekly_max"]},"period":{"type":"string"},"maximum":{"type":"integer"},"count":{"type":"integer"}}}},"code":{"type":"string"},"message":{"type":"string"},"publicationIds":{"type":"array","items":{"type":"string"}}}}}}}}}}}}},"servers":[{"url":"https://postdot.example","description":"Replace with your Postdot instance origin."}]}
```
