Skip to content

Klaris Agent API

Every route of the API. All addresses start with https://app.klarislabs.com/api/agent/v1 (on-premises: your own Klaris address), and every request needs Authorization: Bearer <key> with the scope shown.

The machine-readable description is at klaris-agent.openapi.json, for code generators and tools such as Postman.

Note

This page is made from the API's own code each time the docs are built.

Responses

Create Response

POST /responses · key scope responses

Ask the agent something for one person. Leave out conversation to start a new one. With stream: true you get server-sent events; otherwise the finished response. To answer approval requests, send approval_response items as the input, on their own. Each key may start up to 60 responses a minute; past that you get 429 rate_limited.

Body

Field Type Notes
user string required Your id for the person this is for. Conversations are kept per person. · not empty; up to 255 characters
user_email string up to 320 characters
user_name string up to 200 characters
input string or list of ApprovalAnswer or InputMessage required
conversation string conv_… to continue; leave out to start a new one.
stream boolean default false
use_case string Your label for what this is for, used to group cost. · default "chat"
metadata object

Get Response

GET /responses/{response_id} · key scope responses

A response as it stands now: its status, output and cost. user is the person it was for.

Parameter In Type Notes
response_id path string required
user query string required not empty; up to 255 characters

Cancel Response

POST /responses/{response_id}/cancel · key scope responses

Stop a response that is still running. It stops within a few seconds; fetch it again to see cancelled. A finished one is returned as it is. user is the person it was for.

Parameter In Type Notes
response_id path string required
user query string required not empty; up to 255 characters

Conversations

Create Conversation

POST /conversations · key scope conversations

Start an empty conversation for a person. Optional: POST /responses starts one for you.

Body

Field Type Notes
user string required Your id for the person this is for. Conversations are kept per person. · not empty; up to 255 characters
user_email string up to 320 characters
user_name string up to 200 characters
metadata object

List Conversations

GET /conversations · key scope conversations

One person's conversations, newest first.

Parameter In Type Notes
user query string required not empty; up to 255 characters
limit query integer at least 1; at most 100; default 20

Get Conversation

GET /conversations/{conversation_id} · key scope conversations

One conversation, if it belongs to this person.

Parameter In Type Notes
conversation_id path string required
user query string required not empty; up to 255 characters

Delete Conversation

DELETE /conversations/{conversation_id} · key scope conversations

Delete a conversation and the memories the agent saved in it.

Parameter In Type Notes
conversation_id path string required
user query string required not empty; up to 255 characters

List Items

GET /conversations/{conversation_id}/items · key scope conversations

Everything said and done in a conversation, oldest first: messages, tool calls and their results, and approval requests.

Parameter In Type Notes
conversation_id path string required
user query string required not empty; up to 255 characters

Memories

List Memories

GET /memories · key scope memories

What the agent remembers about one person, oldest first.

Parameter In Type Notes
user query string required not empty; up to 255 characters

Create Memory

POST /memories · key scope memories

Add something for the agent to remember about a person. The same text twice is kept once. Health details, passwords, keys and account numbers are refused.

Body

Field Type Notes
user string required Your id for the person this is for. Conversations are kept per person. · not empty; up to 255 characters
user_email string up to 320 characters
user_name string up to 200 characters
text string required One short fact or preference, such as "Prefers short summaries". · not empty; up to 300 characters

Change Memory

PATCH /memories/{memory_id} · key scope memories

Change what a memory says.

Parameter In Type Notes
memory_id path string required

Body

Field Type Notes
user string required not empty; up to 255 characters
text string required not empty; up to 300 characters

Delete Memory

DELETE /memories/{memory_id} · key scope memories

Forget a memory.

Parameter In Type Notes
memory_id path string required
user query string required not empty; up to 255 characters

Connections

Connection Types

GET /connections/types · key scope connections

The kinds of connection you can add, the fields each needs, and what the agent can do with it.

List Connections

GET /connections · key scope connections

The workspace's company connections, and with user, that person's own ones too. Logins are never sent back.

Parameter In Type Notes
user query string Also list this person's own connections. · up to 255 characters

Create Connection

POST /connections · key scope connections

Add a company connection, such as a Cloud SQL database. Secrets are stored encrypted. Check it afterwards: the agent only uses working connections.

Body

Field Type Notes
type string required See GET /connections/types. · up to 40 characters
name string required not empty; up to 120 characters
values object The type's fields, secrets included.

POST /connections/connect_link · key scope connections

A one-time Google sign-in address (10 minutes) for a person to connect their own account. Open it in the person's browser. After signing in they go to return_url (or a Klaris page) with connected=<type>&ok=1, or ok=0&reason=cancelled|google_error|not_working.

Body

Field Type Notes
user string required Your id for the person this is for. Conversations are kept per person. · not empty; up to 255 characters
user_email string up to 320 characters
user_name string up to 200 characters
type string required A personal type, such as gmail. · up to 40 characters
return_url string Where to send the person after signing in, with connected=<type>&ok=1 (or ok=0&reason=…) added. Must be one of the workspace's allowed return addresses (Settings → API Keys). Leave out to land on a Klaris page saying it worked. · up to 2000 characters

Update Connection

PATCH /connections/{connection_id} · key scope connections

Rename a connection or change its fields. Send only what changes. A personal connection needs its owner's user.

Parameter In Type Notes
connection_id path string required
user query string For a personal connection: its owner. · up to 255 characters

Body

Field Type Notes
name string up to 120 characters
values object Only what changes. An empty secret removes it.

Delete Connection

DELETE /connections/{connection_id} · key scope connections

Remove a connection. A person's own connection needs that person's user.

Parameter In Type Notes
connection_id path string required
user query string up to 255 characters

Check Connection

POST /connections/{connection_id}/check · key scope connections

Try the connection now and save the result. The agent only uses connections that passed. A personal connection needs its owner's user.

Parameter In Type Notes
connection_id path string required
user query string For a personal connection: its owner. · up to 255 characters

Usage

Get Usage

GET /usage · key scope usage

The workspace's AI cost for a period. feature=klaris_agent keeps it to the agent API.

Parameter In Type Notes
start query date-time
end query date-time
group_by query feature · use_case · person · key · day · model · conversation default "use_case"
feature query string

Files and tables

Table Rows

GET /tables/{table_id}/rows · key scope conversations

More rows of a table the agent saved (a display's table_id), past the preview the display carries. Answers 410 once the full result has been cleared (90 days without use).

Parameter In Type Notes
table_id path string required
user query string required not empty; up to 255 characters
offset query integer at least 0; default 0
limit query integer at least 1; at most 500; default 50

Download File

GET /files/{file_id}/content · key scope conversations

A file the agent made in one of this person's conversations (from a file display), as a download.

Parameter In Type Notes
file_id path string required
user query string required not empty; up to 255 characters

Request shapes

ApprovalAnswer

The person's answer to an approval request (apr_…), sent as the next input.

Field Type Notes
type "approval_response" required
approval_request_id string required
approve boolean required
reason string up to 2000 characters
Field Type Notes
user string required Your id for the person this is for. Conversations are kept per person. · not empty; up to 255 characters
user_email string up to 320 characters
user_name string up to 200 characters
type string required A personal type, such as gmail. · up to 40 characters
return_url string Where to send the person after signing in, with connected=<type>&ok=1 (or ok=0&reason=…) added. Must be one of the workspace's allowed return addresses (Settings → API Keys). Leave out to land on a Klaris page saying it worked. · up to 2000 characters

ConnectionCreate

Field Type Notes
type string required See GET /connections/types. · up to 40 characters
name string required not empty; up to 120 characters
values object The type's fields, secrets included.

ConnectionUpdate

Field Type Notes
name string up to 120 characters
values object Only what changes. An empty secret removes it.

ConversationCreate

Field Type Notes
user string required Your id for the person this is for. Conversations are kept per person. · not empty; up to 255 characters
user_email string up to 320 characters
user_name string up to 200 characters
metadata object

InputMessage

Field Type Notes
role "user" required
content string or list of InputText required

InputText

Field Type Notes
type input_text · text default "input_text"
text string required

MemoryChange

Field Type Notes
user string required not empty; up to 255 characters
text string required not empty; up to 300 characters

MemoryCreate

Field Type Notes
user string required Your id for the person this is for. Conversations are kept per person. · not empty; up to 255 characters
user_email string up to 320 characters
user_name string up to 200 characters
text string required One short fact or preference, such as "Prefers short summaries". · not empty; up to 300 characters

ResponseCreate

Field Type Notes
user string required Your id for the person this is for. Conversations are kept per person. · not empty; up to 255 characters
user_email string up to 320 characters
user_name string up to 200 characters
input string or list of ApprovalAnswer or InputMessage required
conversation string conv_… to continue; leave out to start a new one.
stream boolean default false
use_case string Your label for what this is for, used to group cost. · default "chat"
metadata object