Emend
Schemas

Interaction Models

Data structures for user interactions — publishing, searching, retrieving, and deleting interactions.

ToolUsedmodel

Tracks a tool the agent used during an interaction. Multiple tools can be used per interaction.

PropType
tool_namerequiredstring
tool_dataobject
statusstring
RetrievedLearningmodel

A learning (profile, user playbook, or agent playbook) the caller retrieved from Emend and injected into the agent context before the agent responded. Attach every injected learning—not only the ones that visibly changed the answer—so evaluated sessions receive detailed per-learning relevance and impact analysis. These stable identities also provide attribution data for future optimization of retrieved learnings. See Retrieved-learning evaluation.

PropType
kindrequired"profile" | "user_playbook" | "agent_playbook"
learning_idrequiredstring
Citationmodel

A learning the agent claims actually influenced its response — the narrower counterpart to RetrievedLearning, which records everything injected whether it helped or not. Attach citations on the Assistant turn so retrieval attribution can distinguish learnings that shaped the answer from learnings that were merely present.

PropType
kindrequired"profile" | "user_playbook" | "agent_playbook" | "playbook"
real_idrequiredstring
tagstring
titlestring
Interactionmodel

Represents information about a user interaction stored in the system.

PropType
interaction_idinteger
user_idrequiredstring
request_idrequiredstring
created_atinteger
rolestring
contentstring
shadow_contentstring
expert_contentstring
user_actionUserActionType
user_action_descriptionstring
interacted_image_urlstring
tools_usedlist[ToolUsed]
citationslist[Citation]
retrieved_learningslist[RetrievedLearning]
InteractionDatamodel

Model for user-provided interaction information (also called InteractionRequest).

Warning
Every interaction must carry something. An interaction with no content, shadow_content, expert_content, interacted_image_url, image_encoding, tools_used, citations, retrieved_learnings, and a user_action of none carries no information and can never produce a learning, so it is dropped from the batch. Your other interactions publish normally, so a single empty placeholder turn never fails the request. Whitespace-only text does not count as content. The response's warnings records how many interactions were skipped and at which indices. A publish where every interaction is empty returns a 422: there is nothing to learn from.
POST /api/publish_interaction
// POST /api/publish_interaction{"user_id": "user_123", "session_id": "session_abc", "interaction_data_list": [{"role": "User"}, {"role": "Agent"}]} // 422 Unprocessable Entity// every interaction is empty: at least one must set "content" (or any of: ...)

Two further rules return a 422, because they are contradictions rather than absences: a user_action other than none requires a user_action_description, and interacted_image_url and image_encoding cannot both be set. The message names the offending interaction_data_list index. All of these apply on both the synchronous and the default asynchronous publish path.

Unrecognised field names are ignored, but reported. Every field below is optional with a default, so a misspelled key binds to nothing and its value is discarded — a mis-keyed content produces an interaction that is then dropped as empty. As long as one interaction survives, the request still succeeds; if the mis-keying empties every interaction, you get the 422 above, and its message names the offending field. On success, the response's warnings names the unrecognised fields and the interaction_data_list index each appeared on, including nested paths such as tools_used[0].stat. Read that list; a correctly-shaped payload produces no payload warnings.

Two qualifications. The list is bounded — at most 5 names per interaction and 20 entries overall, each with a +N more suffix — so on a large broken batch treat it as a sample rather than an inventory. And per-interaction user_id and session_id are stripped without a warning, because callers routinely repeat those request-level fields on every interaction; their absence from the list is not evidence that they bound.

Still build your payload from an allowlist of the fields below rather than passing an internal record through — the warning tells you a field was dropped, it does not stop the drop.

PropType
created_atinteger
rolestring
contentstring
shadow_contentstring
expert_contentstring
user_actionUserActionType
user_action_descriptionstring
interacted_image_urlstring
image_encodingstring
tools_usedlist[ToolUsed]
citationslist[Citation]
retrieved_learningslist[RetrievedLearning]
PublishUserInteractionRequestrequest model

Request model for publishing user interactions.

PropType
user_idrequiredstring
interaction_data_listrequiredarray[InteractionData]
sourcestring
agent_versionstring
session_idrequiredstring
skip_aggregationboolean
force_extractionboolean
evaluation_onlyboolean
override_learning_stallboolean
retrieval_experiment_idstring
retrieval_experiment_arm"treatment" | "holdout"
PublishUserInteractionResponseresponse model

Response model for interaction publication requests. Diagnostic fields (endpoint_url, storage_type, storage_label, profiles_added, profiles_updated, playbooks_added, playbooks_updated) are populated only when the publish was made with wait_for_response=True. request_id is returned on both paths.

PropType
successrequiredboolean
messagestring
warningsarray[string]
request_idstring
endpoint_urlstring
storage_typestring
storage_labelstring
profiles_addedinteger
profiles_updatedinteger
playbooks_addedinteger
playbooks_updatedinteger
SearchInteractionRequestrequest model

Request model for searching user interactions.

PropType
user_idrequiredstring
request_idstring
querystring
start_timedatetime
end_timedatetime
top_kinteger
most_recent_kinteger
thresholdfloat
search_modeSearchMode
SearchInteractionResponseresponse model

Response model for interaction search requests.

PropType
successrequiredboolean
interactionsrequiredarray[Interaction]
msgstring
GetInteractionsRequestrequest model

Request model for getting user interactions.

PropType
user_idrequiredstring
start_timedatetime
end_timedatetime
top_kinteger
GetInteractionsResponseresponse model

Response model for getting user interactions.

PropType
successrequiredboolean
interactionsrequiredarray[Interaction]
msgstring
DeleteUserInteractionRequestrequest model

Request model for deleting a user interaction.

PropType
user_idrequiredstring
interaction_idrequiredinteger
DeleteUserInteractionResponseresponse model

Response model for interaction deletion requests.

PropType
successrequiredboolean
messagestring