Tutorial

Automations API

Create, run, and monitor recurring research widgets programmatically using the REST API.

1

Prerequisites

Before using the Automations API you need:

All examples use BASE = https://api.tryelisai.com and authenticate via the X-API-Key header. Replace with your actual API key and company ID.

Policy note: organization internet settings gate web-sourced tools, not organization REST API data source calls. If your environment requires strict no external egress, have admins disable or remove external REST API data sources.

2

Create a widget

Send a POST to /api/automations/widgets with your research configuration:

curl -X POST https://api.tryelisai.com/api/automations/widgets \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "company_id": "YOUR_COMPANY_ID",
    "name": "Revenue Tracker",
    "description": "Track quarterly revenue for top tech companies",
    "questions": [
      "What is the latest quarterly revenue for AAPL, MSFT, GOOGL?"
    ],
    "tracked_entities": ["Apple", "Microsoft", "Alphabet"],
    "tracked_metrics": ["revenue", "growth_rate"],
    "widget_type": "chart",
    "chart_preferences": {"default_chart_type": "bar"},
    "cadence_type": "daily",
    "cadence_hour": 9,
    "cadence_tz": "America/New_York",
    "status": "active"
  }'

The response contains the full widget object with its generated id. Key fields:

  • widget_typesummary, chart, table, or mixed
  • cadence_typeevery_15m, every_30m, hourly, every_4h, every_8h, daily, or weekly
  • status — set to active to start scheduling immediately, or draft to configure later
3

List and filter widgets

Retrieve all widgets for your company. Optionally filter by status:

# All widgets
curl "https://api.tryelisai.com/api/automations/widgets?company_id=YOUR_COMPANY_ID" \
  -H "X-API-Key: YOUR_API_KEY"

# Active only
curl "https://api.tryelisai.com/api/automations/widgets?company_id=YOUR_COMPANY_ID&status=active" \
  -H "X-API-Key: YOUR_API_KEY"

The response returns {"widgets": [...]} with each widget's configuration, status, cadence, and latest run info.

4

Trigger a manual run

Widgets run automatically on their schedule, but you can trigger a run immediately:

curl -X POST https://api.tryelisai.com/api/automations/widgets/WIDGET_ID/runs \
  -H "X-API-Key: YOUR_API_KEY"

The run executes asynchronously in the background. The response returns the run object with status: "running" and a run_id you can use to check progress.

5

Stream real-time events (SSE)

Instead of polling, connect to the Server-Sent Events endpoint to get live updates as the widget executes:

curl -N "https://api.tryelisai.com/api/automations/widgets/WIDGET_ID/events?company_id=YOUR_COMPANY_ID" \
  -H "X-API-Key: YOUR_API_KEY"

Events are delivered as JSON:

data: {"type": "status", "widget_id": "...", "phase": "researching", "detail": "Querying sources..."}
data: {"type": "status", "widget_id": "...", "phase": "analyzing", "detail": "Processing results..."}
data: {"type": "run_complete", "widget_id": "...", "run_id": "...", "status": "completed", "duration_ms": 4200}

Event types: status (progress updates), run_complete (final result),error (failures).

6

Fetch reports

After a run completes, fetch the generated report:

# Get the latest report
curl "https://api.tryelisai.com/api/automations/widgets/WIDGET_ID/reports/latest?company_id=YOUR_COMPANY_ID" \
  -H "X-API-Key: YOUR_API_KEY"

# List all reports (with optional limit)
curl "https://api.tryelisai.com/api/automations/widgets/WIDGET_ID/reports?company_id=YOUR_COMPANY_ID&limit=10" \
  -H "X-API-Key: YOUR_API_KEY"

# Get a specific report
curl "https://api.tryelisai.com/api/automations/widgets/WIDGET_ID/reports/REPORT_ID" \
  -H "X-API-Key: YOUR_API_KEY"

Each report contains presentation_blocks (the rendered content),output_blocks (raw pipeline output), delta_summary (what changed since the last report), and extracted metrics.

7

Download PDF or Excel export

Export any report as a formatted PDF or Excel spreadsheet:

# PDF export
curl -o report.pdf \
  "https://api.tryelisai.com/api/automations/widgets/WIDGET_ID/reports/REPORT_ID/export/pdf?company_id=YOUR_COMPANY_ID" \
  -H "X-API-Key: YOUR_API_KEY"

# Excel export
curl -o report.xlsx \
  "https://api.tryelisai.com/api/automations/widgets/WIDGET_ID/reports/REPORT_ID/export/xlsx?company_id=YOUR_COMPANY_ID" \
  -H "X-API-Key: YOUR_API_KEY"

The PDF includes styled headers, content blocks, and chart images. The Excel file contains structured data rows extracted from the report.

8

Monitor widget health

Check the health status of a widget and send a test alert:

# Health status
curl "https://api.tryelisai.com/api/automations/widgets/WIDGET_ID/health?company_id=YOUR_COMPANY_ID" \
  -H "X-API-Key: YOUR_API_KEY"

# Response:
# {"health": {"status": "healthy", "last_success_at": "2026-03-22T09:00:00Z",
#   "failure_streak": 0, "avg_runtime_ms": 3500, "stale_after_hours": 48}}

# Send test alert email
curl -X POST "https://api.tryelisai.com/api/automations/widgets/WIDGET_ID/test-alert" \
  -H "X-API-Key: YOUR_API_KEY"

Health fields: status (healthy / degraded / stale / errored),failure_streak (consecutive failures), avg_runtime_ms (mean execution time).

9

Use templates

Browse pre-built templates and create a widget from one:

# List templates
curl "https://api.tryelisai.com/api/automations/templates" \
  -H "X-API-Key: YOUR_API_KEY"

# Create widget from template
curl -X POST "https://api.tryelisai.com/api/automations/widgets/from-template" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"company_id": "YOUR_COMPANY_ID", "template_id": "TEMPLATE_ID", "name": "My KPI Tracker"}'

Templates include: Competitor Watch, KPI Tracker,News Monitor, and Executive Brief. The created widget inherits the template's questions, entities, metrics, and output format.

10

Convert a conversation to a widget

Turn an existing chat conversation into a recurring widget:

curl -X POST "https://api.tryelisai.com/api/automations/convert" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"conversation_id": "CONVERSATION_ID"}'

# Response: {"draft": {"name": "...", "questions": [...],
#   "tracked_entities": [...], "tracked_metrics": [...]}}

The endpoint extracts research questions, entities, and metrics from the conversation and returns a widget draft. You can then create a widget from the draft by passing the fields to POST /api/automations/widgets.

Tip:For the full endpoint reference with request/response schemas, see the Docs → Automations section which covers all 20 automations endpoints.