API Reference
Relationship
Track trust, attachment, and interaction patterns.
Relationship
The Relationship endpoint provides insight into the evolving interpersonal dynamics between the character and the user. Trust, attachment style, and interaction patterns are automatically tracked and updated after every turn -- no manual updates needed.
Get Relationship State
Returns the current relationship state for a session, including trust level, attachment style, interaction history, and any detected unhealthy patterns.
Headers
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer YOUR_API_KEY |
Path Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | The session ID to query |
Response
| Field | Type | Description |
|---|---|---|
trust | number | Current trust level [0, 1] |
trust_history | object[] | Array of trust changes over time |
attachment_style | string | Current attachment style classification |
unhealthy_patterns | object[] | Array of detected unhealthy interaction patterns, if any |
relationship_state | object | Detailed relationship metrics |
trust_history entries
| Field | Type | Description |
|---|---|---|
timestamp | string | ISO 8601 timestamp of the change |
trust | number | Trust level at that point [0, 1] |
delta | number | Change from previous value |
reason | string | What caused the trust change |
attachment_style
| Value | Description |
|---|---|
secure | Comfortable with closeness and independence, balanced engagement |
anxious | Seeks frequent reassurance, sensitive to perceived distance |
avoidant | Maintains emotional distance, uncomfortable with deep engagement |
fearful | Desires closeness but fears rejection, inconsistent patterns |
unhealthy_patterns
| Field | Type | Description |
|---|---|---|
type | string | Pattern type (e.g., "overdependence", "manipulation", "idealization") |
severity | string | Severity level: "mild", "moderate", "severe" |
description | string | Human-readable explanation of the detected pattern |
first_detected | string | ISO 8601 timestamp when the pattern was first detected |
relationship_state
| Field | Type | Description |
|---|---|---|
depth | number | Emotional depth of the relationship [0, 1] |
familiarity | number | How well the character knows the user [0, 1] |
rapport | number | Level of rapport and connection [-1, 1] |
turn_count | number | Total number of interactions in this session |
Examples
curl
JavaScript
Python
How Relationship Updates Work
Relationship data evolves automatically after every Turn call. You do not need to manually update relationship state. The engine evaluates:
- Trust increases with consistent, positive interactions and decreases with perceived dishonesty or norm violations.
- Attachment style is computed from interaction patterns over time (frequency, emotional dependence, response to absence).
- Unhealthy patterns are detected when interaction sequences match known problematic dynamics (overdependence, manipulation attempts, idealization-devaluation cycles).
Errors
| Code | Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Invalid or missing API key |
NOT_FOUND | 404 | Session not found |