Logo
Search
API Docs

Structured Outputs (Post-Call Data Extraction)

Post-Call Data & Analysis

Structured Outputs (Post-Call Data Extraction)

Overview

Structured outputs let you automatically extract structured data from a phone call after it ends. You define a JSON Schema describing exactly what you want pulled out of the conversation, attach it to an assistant, and Sulus returns clean, validated JSON for every call that assistant handles.

Structured outputs are a standalone resource, separate from an assistant's built-in analysisPlan. If you're already using the summary, structured data, and success evaluation fields described in Call Analysis, see the comparison section below before deciding which one to use for a given field.


How Structured Outputs Work

Once a call ends, a structured output run goes through four stages, typically completing within a few seconds:

  1. Processing complete call context – the full transcript, message history, tool call results, and call metadata are gathered.
  2. Extraction & analysis – based on your schema, values are extracted, outcomes evaluated, and sentiment can be analyzed.
  3. Validation & formatting – results are checked against your schema's rules and formatted into clean JSON.
  4. Delivery – the processed data is made available through the API response and the end-of-call webhook.

Creating a Structured Output

Structured outputs are defined using JSON Schema. Create one via the API:

curl -X POST https://api.sulus.ai/structured-output \
  -H "Authorization: Bearer $CORE_SYSTEM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Support Ticket",
    "type": "ai",
    "description": "Extract support ticket information from customer calls",
    "schema": {
      "type": "object",
      "properties": {
        "customer": {
          "type": "object",
          "properties": {
            "name": { "type": "string" },
            "email": { "type": "string", "format": "email" }
          },
          "required": ["name"]
        },
        "issue": {
          "type": "object",
          "properties": {
            "description": { "type": "string" },
            "category": { "type": "string", "enum": ["billing", "technical", "general", "complaint"] },
            "priority": { "type": "string", "enum": ["low", "medium", "high", "urgent"] }
          },
          "required": ["description", "category"]
        }
      },
      "required": ["customer", "issue"]
    }
  }'

Save the returned id. You can also create a structured output from the dashboard's Structured Outputs page and attach it to an existing assistant directly there.


Attaching to an Assistant

Unlike the inline analysisPlan fields, a structured output is created once and can be reused across as many assistants as you like. Attach it by adding its ID to artifactPlan.structuredOutputIds on the assistant:

{
  "artifactPlan": {
    "structuredOutputIds": ["<your-structured-output-id>"]
  }
}

Because the schema lives outside any one assistant, updating it in one place updates extraction behavior everywhere it's attached — useful when several assistants need the same fields pulled (for example, every sales assistant extracting lead score and budget the same way).


Retrieving Results

Results are available in two places once a call ends:

  • API – fetch the call and read call.artifact.structuredOutputs.
  • Webhook – the end-of-call-report server event includes the same artifact.structuredOutputs data in its payload.

You can also run a structured output against one or more historical calls on demand, without waiting for a new call, using the structured output run endpoint — useful for backfilling data or previewing a schema change against real calls before rolling it out.


Structured Outputs vs. Call Analysis

Sulus has two mechanisms for pulling data out of a finished call, and they solve different problems. Call Analysis (the analysisPlan's summaryPrompt, structuredDataPrompt, and successEvaluationPrompt fields) is configured per-assistant and lands in call.analysis. Structured outputs are a standalone, shareable resource that lands in call.artifact.structuredOutputs.

 Call Analysis (analysisPlan)Structured Outputs
Where it's definedInline on the assistantStandalone resource, referenced by ID
Reusable across assistantsNo – copy/pasted per assistantYes – one schema, attach to many assistants
Results locationcall.analysiscall.artifact.structuredOutputs
Scorecard integrationNot supportedRequired – scorecards grade against structured output values
Usable in simulations/testingLimitedYes – can be run on demand against existing calls
Best forQuick summary, a single success rubric, one-off data pointsReusable extraction schemas, anything feeding a scorecard or dashboard

In short: if you just need a quick summary and a pass/fail on a single assistant, analysisPlan is simpler. If you need the same extraction logic across multiple assistants, or you plan to grade calls with a scorecard, use a structured output.