molroomolroo
API Reference

Persona

Create, list, retrieve, and delete sessions — the emotional identity of your AI characters.

Persona

Sessions are created around a persona — the emotional identity of your AI character. You can use a preset or define a custom persona with Big Five traits.


Create Session

POST /v1/persona

Create a new emotion session. Use a preset for quick start, or define a custom persona.

Request Body

Option A: Use a Preset

FieldTypeRequiredDescription
presetstringYesPreset ID (see Presets)

Option B: Custom Persona

FieldTypeRequiredDescription
identityobjectNoCharacter identity definition
identity.namestringNoCharacter name
identity.core_valuesstring[]NoCore values that guide emotional responses
identity.speaking_stylestringNoNatural language description of speaking style
identity.rolestringNoCharacter's role or occupation
identity.languagestringNoLanguage directive for prompt_data generation
personalityobjectYesHEXACO personality traits
personality.OnumberYesOpenness to Experience [0, 1]
personality.CnumberYesConscientiousness [0, 1]
personality.EnumberYesExtraversion [0, 1]
personality.AnumberYesAgreeableness [0, 1]
personality.NnumberYesNeuroticism [0, 1]
personality.HnumberYesHonesty-Humility [0, 1]
personality.facetsobjectNoFine-grained sub-traits (4 per domain, 24 total)
emotion_configobjectNoOverride emotion dynamics (derived from personality if omitted)
goalsstring[]NoCharacter goals for appraisal context

Note: You can combine a preset with overrides — pass preset along with any custom fields and the custom fields take precedence.

Response

FieldTypeDescription
sessionIdstringUnique session identifier
personaobjectThe resolved persona config
configobjectEmotion dynamics config
createdAtstringISO 8601 creation timestamp

Examples

curl -X POST https://api.molroo.io/v1/persona \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "preset": "cheerful_companion" }'
const response = await fetch("https://api.molroo.io/v1/persona", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ preset: "cheerful_companion" }),
});
 
const session = await response.json();
// session.sessionId = "ses_abc123..."

Custom Persona

curl -X POST https://api.molroo.io/v1/persona \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "identity": {
      "name": "Luna",
      "core_values": ["empathy", "curiosity", "honesty"],
      "speaking_style": "warm and thoughtful, uses metaphors",
      "role": "companion"
    },
    "personality": {
      "O": 0.8, "C": 0.6, "E": 0.5,
      "A": 0.9, "N": 0.3, "H": 0.85
    },
    "goals": ["understand the user", "provide emotional support"]
  }'

Errors

CodeStatusDescription
UNAUTHORIZED401Invalid or missing API key
VALIDATION_ERROR400Invalid request body or parameter
INVALID_PRESET400Unknown preset ID
RATE_LIMIT429Too many requests

List Sessions

GET /v1/persona

List all sessions with cursor-based pagination.

Query Parameters

ParameterTypeRequiredDescription
cursorstringNoCursor from previous response
limitnumberNoMax results per page (default: 20)

Response

FieldTypeDescription
sessionsarrayArray of session summaries
cursorstring?Next page cursor (null if last)

Example

curl "https://api.molroo.io/v1/persona?limit=10" \
  -H "Authorization: Bearer YOUR_API_KEY"

Get Session

GET /v1/persona/:id

Retrieve a session by its ID.

Path Parameters

ParameterTypeDescription
idstringThe session ID to retrieve

Example

curl https://api.molroo.io/v1/persona/ses_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY"

Delete Session

DELETE /v1/persona/:id

Permanently delete a session and all associated state.

Path Parameters

ParameterTypeDescription
idstringThe session ID to delete

Response

FieldTypeDescription
deletedbooleantrue if successfully deleted
idstringThe deleted session ID

Example

curl -X DELETE https://api.molroo.io/v1/persona/ses_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY"

Errors

CodeStatusDescription
UNAUTHORIZED401Invalid or missing API key
NOT_FOUND404Session not found

On this page