Sessions

Sessions group related inboxes, waits, and extractions together. Use them to track multi-step workflows and replay execution.

When to Use Sessions

Sessions are optional but recommended for complex automation with multiple steps, inboxes, or extractions.

Creating a Session

Create a session to start tracking a workflow. Sessions are optional but recommended for complex automation.

bash
curl -X POST https://agentinbox.in/api/v1/sessions \
-H "Authorization: Bearer $AgentInbox_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "user-signup-flow"}'

Listing Sessions

List all sessions with pagination and filtering by status.

typescript
const sessions = await client.sessions.list({ limit: 10 });
for (const s of sessions.data) {
console.log(s.name, s.status);
}

Getting a Session

Retrieve a session by ID to see its associated inboxes, waits, and current status.

bash
curl https://agentinbox.in/api/v1/sessions/sess_789 \
-H "Authorization: Bearer $AgentInbox_API_KEY"
GET/api/v1/sessions/{sessionId}

Retrieve a session with its timeline and associated resources

Parameters

NameTypeRequiredDescription
sessionIdstringRequiredThe unique session identifier.

Responses

HTTP 200
{
"id": "sess_789",
"name": "user-signup-flow",
"status": "active",
"inboxes": ["inb_123", "inb_456"],
"waits": ["wait_abc"],
"extractions": ["ext_def"],
"createdAt": "2024-06-12T10:00:00Z",
"updatedAt": "2024-06-12T10:30:00Z"
}

Completing a Session

Mark a session as completed when your workflow finishes. This updates the status and finalizes the timeline.

bash
curl -X POST https://agentinbox.in/api/v1/sessions/sess_789/complete \
-H "Authorization: Bearer $AgentInbox_API_KEY"

Timeline

Every session maintains a timeline of events. View the timeline to debug or audit your workflow.

Fetching timeline
const timeline = await client.sessions.timeline("sess_789");
for (const event of timeline.events) {
console.log(event.timestamp, event.type, event.description);
}

Timeline Events

session.created

Session was created

inbox.created

Inbox added to session

email.received

Email arrived in session inbox

wait.completed

Wait finished successfully

extraction.completed

Data extracted from email

session.completed

Session marked as done

Execution Replay

Replay a session's execution to debug failures or retry workflows. See the Execution Replay guide for details.

Replaying a session
const replay = await client.sessions.replay("sess_789");
console.log(replay.steps);

Next Steps