Create custom analyst
Creates a custom analyst. Identity follows your API key, so you do not send a user object in the body. Most requests are plain JSON, but organisation memory attachments can also be sent with multipart parts named organisationMemoryFiles. See Custom analysts overview.
/users/custom-analystsBody fields
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Required | Display name shown in your library. Sent upstream as modelName. |
| base | string | Required | Which built-in model this analyst is based on (for example leniq-pro). Sent upstream as modelType. |
| tone | string | Required | How the analyst should respond. One of: professional, friendly, authoritative, consultative, funny. Sent upstream as modelTone. |
| emoji | string | Optional | Icon shown in the UI. Defaults to 🤖 when omitted. Sent upstream as modelEmoji. |
| organisationMemory | object | Optional | Optional organisation memory to add after the analyst is created. On success, the response may include organisationMemorySync with the add-to-memory result. If memory sync fails after the analyst was created, you may receive 502. |
organisationMemory object
Send organisationMemory as a nested JSON object. Validation keeps the nested object intact, so do not stringify it.
| Field | Type | Required | Description |
|---|---|---|---|
| noteTitle | string | Required | Title of the organisation memory note. Required when organisationMemory is included on create. |
| noteContext | string | Required | Body text of the organisation memory note. Required when organisationMemory is included on create. |
| noteId | never | Optional | Do not send on create. Use noteId only on update routes when you want to change an existing memory note. |
| files / filesBase64 | array | Optional | Optional file attachments using the same base64 shape as add-to-memory (see File uploads). You may also upload via multipart using parts named organisationMemoryFiles. |
If you include attachments for organisation memory, use the same base64 object shape described in File uploads, or send binary multipart parts named organisationMemoryFiles.
For multipart clients, send the normal analyst fields together with nested organisation-memory form fields and one or more organisationMemoryFiles parts.
Response
Returns HTTP 201 Created with the created analyst payload (including an id you can use in Run models). If organisationMemory is included and its sync succeeds, the response also includes organisationMemorySync. If the analyst is created but the follow-up memory sync fails, the API may return 502.
Example
POST /users/custom-analysts
{
"name": "Lease reviewer",
"base": "leniq-pro",
"tone": "professional",
"emoji": "📄"
}Example with organisation memory
POST /users/custom-analysts
{
"name": "Lease reviewer",
"base": "leniq-pro",
"tone": "professional",
"organisationMemory": {
"noteTitle": "Scope",
"noteContext": "Focus on Ontario residential leases."
}
}Code examples
const res = await fetch(`${process.env.API_BASE}/users/custom-analysts`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Api-Key": process.env.LENI_API_KEY!,
},
body: JSON.stringify({
name: "Lease reviewer",
base: "leniq-pro",
tone: "professional",
emoji: "📄",
}),
});
const data = await res.json();