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.

PUT/users/custom-analysts/:analystId

Path

analystId — custom model UUID.

Body fields

FieldTypeRequiredDescription
namestring
Required
Updated display name. Sent upstream as modelName.
basestring
Required
Updated base model type (for example leniq-pro). Sent upstream as modelType.
tonestring
Required
Updated response style. One of: professional, friendly, authoritative, consultative, funny.
emojistring
Optional
Updated icon. Defaults to 🤖 when omitted. Sent upstream as modelEmoji.
descriptionstring
Optional
Longer description for the analyst. Omit this field to leave the existing description unchanged on the upstream model.
organisationMemoryobject
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 noteId is present, the API calls update-memory.
  • If noteId is omitted, the API calls add-to-memory.
FieldTypeRequiredDescription
noteIdstring
Optional
Id of an existing memory note to update. When set, the service calls update-memory instead of creating a new note.
noteTitlestring
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.
noteContextstring
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 / filesBase64array
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

JSON
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

JSON
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.