Update custom analyst
Updates a custom analyst. Put the analyst id in the path and send the new fields in the body. You can also include an organisationMemory object to sync memory after the main analyst update succeeds.
/users/custom-analysts/:analystIdPath
analystId — custom model UUID.
Body fields
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Required | Updated display name. Sent upstream as modelName. |
| base | string | Required | Updated base model type (for example leniq-pro). Sent upstream as modelType. |
| tone | string | Required | Updated response style. One of: professional, friendly, authoritative, consultative, funny. |
| emoji | string | Optional | Updated icon. Defaults to 🤖 when omitted. Sent upstream as modelEmoji. |
| description | string | Optional | Longer description for the analyst. Omit this field to leave the existing description unchanged on the upstream model. |
| organisationMemory | object | Optional | Optional organisation memory to add or update after the analyst is saved. With noteId set, the service calls update-memory; otherwise add-to-memory. On success, the response may include organisationMemorySync. |
organisationMemory object
The nested organisationMemory object decides which follow-up memory route runs:
- If
noteIdis present, the API callsupdate-memory. - If
noteIdis omitted, the API callsadd-to-memory.
| Field | Type | Required | Description |
|---|---|---|---|
| noteId | string | Optional | Id of an existing memory note to update. When set, the service calls update-memory instead of creating a new note. |
| noteTitle | string | Optional | Title for the note. Required together with noteContext when adding a new note (no noteId). May be an empty string when updating an existing note. |
| noteContext | string | Optional | Body text for the note. Required together with noteTitle when adding a new note (no noteId). May be an empty string when updating an existing note. |
| files / filesBase64 | array | Optional | Optional file attachments using the same base64 shape as add-to-memory and update-memory (see File uploads). |
For binary uploads, use multipart parts named organisationMemoryFiles. JSON-only uploads can use organisationMemory.files or organisationMemory.filesBase64 with the same shape shown in File uploads.
Multipart clients should send the normal analyst fields together with nested organisation-memory form fields and one or more organisationMemoryFiles parts.
Response
Successful responses return the upstream custom analyst payload. If organisation memory also syncs successfully, the response includes organisationMemorySync. If the analyst update succeeds but the memory sync fails, the API may return 502.
Example
PUT /users/custom-analysts/<analyst-uuid>
{
"name": "Lease reviewer",
"base": "leniq-pro",
"tone": "professional",
"description": "Focuses on Ontario residential leases."
}Example with organisation memory attachment
PUT /users/custom-analysts/<analyst-uuid>
{
"name": "Lease reviewer",
"base": "leniq-pro",
"tone": "professional",
"organisationMemory": {
"noteId": "<memory-note-uuid>",
"noteTitle": "Scope",
"noteContext": "See uploaded policy.",
"files": [
{
"filename": "policy.pdf",
"contentType": "application/pdf",
"contentBase64": "<base64-here>"
}
]
}
}Code examples
const analystId = "<analyst-uuid>";
const res = await fetch(`${process.env.API_BASE}/users/custom-analysts/${analystId}`, {
method: "PUT",
headers: {
"Content-Type": "application/json",
"X-Api-Key": process.env.LENI_API_KEY!,
},
body: JSON.stringify({
name: "Lease reviewer",
base: "leniq-pro",
tone: "professional",
description: "Focuses on Ontario residential leases.",
}),
});
await res.json();See also overview.