API Reference
The Ensoul API provides programmatic access to create domains, generate personas, conduct conversations, run aggregate queries, and manage simulations.
API access requires authentication via API key or OAuth. See the SDKs page for official client libraries.
The hosted API base URL is https://api.ensoul-ai.com. All endpoint paths below are versioned under /v1 (for example, https://api.ensoul-ai.com/v1/domains).
Authentication
Ensoul supports two authentication methods:
Google OAuth (UI)
API Keys (Programmatic)
Using API Keys
Pass your API key in the X-API-Key header (OAuth users send a JWT in the Authorization: Bearer header instead):
curl -X GET "https://api.ensoul-ai.com/v1/domains" \-H "X-API-Key: your_api_key_here"
Security
Domains
Manage personality domains — the foundation for all persona generation.
/v1/domainsList all domains accessible to your account.
/v1/domainsCreate a new domain (use Studio wizard for guided creation).
/v1/domains/:idGet a specific domain by ID with full configuration.
/v1/domains/generateAI-generate a complete domain from a text description.
Personas
Generate and manage personas within a domain.
/v1/personasList personas with pagination and filters (region, archetype, country, city).
/v1/personasCreate a persona (pass the target domain in the request body).
/v1/personas/batchCreate multiple personas at once with controlled distribution.
/v1/personas/:idGet a specific persona with full trait profile.
/v1/personas/:id/personalityGet a persona's full personality vector.
Chat
1:1 conversations with individual personas. Every response is generated through real-time inference.
/v1/personas/:id/chatSend a message to a persona and receive a response.
{"message": "What do you think about remote work?","conversation_id": "optional-conversation-uuid"}
/v1/personas/:id/chat/streamStream a persona's response token-by-token via Server-Sent Events.
/v1/chat/sessionsList chat sessions.
/v1/chat/sessions/:idGet a specific chat session with message history.
Aggregate Queries
Query multiple personas at once for population-level insights.
/v1/aggregate/streamStream aggregate query results across multiple personas.
/v1/aggregate/stream/groupedStream grouped aggregate results (by archetype or tier).
/v1/aggregate/countGet the count of personas matching query filters.
Simulations
Run multi-step simulations where personas interact and evolve over time.
/v1/simulationsList all simulations.
/v1/simulationsCreate a new simulation.
/v1/simulations/:idGet simulation details and status.
/v1/simulations/:id/startStart a simulation.
/v1/simulations/:id/pausePause a running simulation.
/v1/simulations/:id/speedAdjust simulation speed.
/v1/simulations/:id/streamStream real-time simulation events (SSE).
/v1/simulations/:id/historyGet simulation interaction history.
/v1/simulations/:id/checkpointsList simulation checkpoints.
/v1/simulations/:id/checkpoints/:cpId/restoreRestore simulation to a checkpoint.
Persona Memories
Manage persona long-term memories and batch memory generation.
/v1/memory/:personaIdList memories for a persona.
/v1/memory/:personaId/generateGenerate memories for a persona (using bloom modes).
/v1/memory/:personaId/batchBatch create memories.
/v1/memory/:personaId/:memoryIdDelete a specific memory.
/v1/domains/:id/memories/generate-batchBatch generate memories for all personas in a domain.
/v1/domains/:id/memories/bloom-jobsList bloom (memory generation) jobs.
/v1/domains/:id/memories/bloom-jobs/:jobId/cancelCancel a running bloom job.
Frameworks & Validation
Manage personality frameworks and run validation experiments.
/v1/frameworksList available personality frameworks.
/v1/frameworks/:idGet framework details including traits and grounding.
/v1/frameworks/:id/traits/:traitName/groundingGet/update trait grounding text.
/v1/frameworks/:id/auto-tuneAI-generate improved trait grounding.
/v1/validationsList validation runs.
/v1/validationsStart a new validation experiment.
/v1/validations/:idGet validation results.
/v1/validations/:id/tuning-reportGet auto-tune report for a validation.
Error Handling
The API uses standard HTTP status codes and returns detailed error information:
{"error": "Validation Error","message": "Request validation failed","details": [{ "field": "message", "message": "field required", "type": "missing" }],"request_id": "req_a1b2c3d4"}
Status Codes
| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created |
| 400 | Bad Request — Invalid parameters |
| 401 | Unauthorized — Invalid or missing credentials |
| 403 | Forbidden — Insufficient permissions |
| 404 | Not Found — Resource doesn't exist |
| 429 | Rate Limited — Too many requests |
| 500 | Server Error — Something went wrong |
Rate Limits
Rate limits depend on your plan:
| Plan | Requests/min | Personas/month |
|---|---|---|
| Free Demo | 10 | 100 |
| Custom (contact us) | Higher | Up to unlimited |