Your first call
Two calls: list your personas, then ask one a question. You need the base URL and API key from Before you start.
export PERSONAAS_BASE_URL="https://alpha.personaas.ai" # your base URL
export PERSONAAS_API_KEY="p-…@org_…" # your key
1. List your personas
curl "$PERSONAAS_BASE_URL/api/v1/personas/" \
-H "x-personaas-key: $PERSONAAS_API_KEY"
Keep the trailing slash. You get the personas assigned to you, each with its tasks:
[
{
"id": 12,
"name": "HR Assistant",
"tasks": [
{ "id": 40, "name": "Leave questions", "sensitive": false }
]
}
]
Note one persona id and one task id from your response. The numbers
12 and 40 below are only examples. Pick a task where sensitive is
false; apps cannot run sensitive tasks yet.
An empty list [] is not an error. It means no persona is assigned to you yet;
ask your Personaas administrator.
2. Ask a question
Asking takes three calls, the same ones the Personaas app makes: create a
conversation, open its stream, send the question. Put your persona id and task
id in the first one. PERSONAAS_ENGINE comes from
Before you start.
Create a conversation:
curl -X POST "$PERSONAAS_BASE_URL/api/v1/activity/" \
-H "x-personaas-key: $PERSONAAS_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "persona_id": 12, "task_id": 40 }'
# → { "activity_id": "0b6f6a0e-…", … }
export ACTIVITY_ID="0b6f6a0e-…" # the activity_id you got back
Open the stream and leave it running. The answer will appear here:
curl -N "$PERSONAAS_BASE_URL/api/v2/activity/$ACTIVITY_ID/stream" \
-H "x-personaas-key: $PERSONAAS_API_KEY"
In a second terminal (set the same variables there), send the question:
curl -X POST "$PERSONAAS_BASE_URL/api/$PERSONAAS_ENGINE/activity/$ACTIVITY_ID/message" \
-H "x-personaas-key: $PERSONAAS_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "input": "How many leave days can I carry over?" }'
Back in the first terminal, the answer arrives in pieces while the persona
writes it, and ends with a WorkflowCompleted event that holds the whole
answer:
event:RunContent
data:{"content":"You can carry ", ...}
event:WorkflowCompleted
data:{"content":"You can carry over up to 10 days…", "status":"completed", ...}
Press Ctrl+C to close the stream. The answer is also stored in the conversation:
curl "$PERSONAAS_BASE_URL/api/v1/activity/$ACTIVITY_ID/messages" \
-H "x-personaas-key: $PERSONAAS_API_KEY"
Keep activity_id: it is the conversation, and you need it for follow-up
questions. In an app, read the events as described in
Stream the answer.
If it did not work
| You got | Likely cause |
|---|---|
401 | The key is wrong, expired, missing its @org_… part, or from another Personaas address |
404 | The persona id or task id is not one from your own list |
400 mentioning an encryption key | The task is marked sensitive. Pick another task |
503 when sending | Engine v3 has no free runner. Send the same message once on v1; see Engines |
| Nothing arrives on the stream | The stream was opened after the answer finished, or it was not open. Read the messages instead, and next time open the stream before sending |
More in Troubleshooting.
Next
- Continue a conversation: follow-up questions and history.
- Send and receive files.
- API reference: every endpoint in one table.
- Build with a coding agent: let a coding agent build on the API.