{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/simple-ai/json-schema/simple-ai-call-details-response-schema.json",
  "title": "CallDetailsResponse",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/simple-ai-openapi.json#/components/schemas/CallDetailsResponse",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "title": "Id",
      "description": "The call's identifier. Same value as `simple_uuid`."
    },
    "simple_uuid": {
      "type": "string",
      "format": "uuid",
      "title": "Simple Uuid"
    },
    "language": {
      "type": "string",
      "title": "Language",
      "description": "Language code for the call, such as `en` or `es`"
    },
    "from_number": {
      "type": "string",
      "title": "From Number"
    },
    "to_number": {
      "type": "string",
      "title": "To Number"
    },
    "status": {
      "type": "string",
      "enum": [
        "enqueued",
        "in_progress",
        "completed",
        "failed",
        "cancelled"
      ],
      "title": "Status",
      "description": "Where the call is in its lifecycle. `completed`, `failed` and `cancelled` are final."
    },
    "transferred": {
      "type": "boolean",
      "title": "Transferred",
      "description": "Indicates if the call was transferred"
    },
    "handoff_metadata": {
      "anyOf": [
        {
          "$ref": "#/$defs/HandoffMetadata"
        },
        {
          "type": "null"
        }
      ],
      "title": "Handoff Metadata",
      "description": "Metadata about the handoff when the call was transferred to an external provider (e.g. Five9). Null if the call was not transferred."
    },
    "direction": {
      "type": "string",
      "enum": [
        "inbound",
        "outbound"
      ],
      "title": "Direction",
      "description": "The direction of the call"
    },
    "tags": {
      "type": "array",
      "title": "Tags",
      "description": "Tags associated with the call",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "color": {
            "type": "string"
          }
        }
      }
    },
    "voice_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Voice ID",
      "description": "The ID of the voice used for the call"
    },
    "agent_speaks_first": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Agent Speaks First",
      "description": "Whether the agent speaks first in the call"
    },
    "agent_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Agent ID",
      "description": "The ID of the agent used for the call. Null when the call is not associated with an agent."
    },
    "agent_branch": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Agent Branch",
      "description": "The ID of the agent version used for the call. Null when the call is not associated with an agent."
    },
    "agent_commit_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Agent Commit ID",
      "description": "The ID of the specific agent version snapshot used for the call. Null when the call is not associated with an agent."
    },
    "agent_branch_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Agent Branch Name",
      "description": "The name of the agent version used for the call. Null when the call is not associated with an agent."
    },
    "started_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Started At"
    },
    "ended_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ended At"
    },
    "duration": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Duration"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At",
      "description": "For native interactions this is the record creation time. For external-channel interactions this is the underlying session's ingestion time. Note: `created_at` sorting and the `created_at_gte`/`created_at_lte` filters order external-channel interactions by their call (leg start) time, not by this ingestion timestamp, so a returned `created_at` value may fall outside the requested filter window."
    },
    "external_identifiers": {
      "anyOf": [
        {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        {
          "type": "null"
        }
      ],
      "title": "External Identifiers",
      "description": "External identifiers associated with the call"
    },
    "params": {
      "anyOf": [
        {
          "type": "object",
          "additionalProperties": true
        },
        {
          "type": "null"
        }
      ],
      "title": "Params",
      "description": "Parameters associated with the call"
    },
    "transcripts": {
      "items": {
        "$ref": "#/$defs/CallTranscriptResponse"
      },
      "type": "array",
      "title": "Transcripts"
    },
    "recording_presigned_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Recording Presigned Url"
    },
    "screen_pop_token": {
      "type": "string",
      "title": "Screen Pop Token",
      "description": "Opens this call's screen pop page at `/screen-pop#<token>`. It expires four hours after the call started."
    },
    "cart": {
      "anyOf": [
        {
          "type": "object",
          "title": "Cart",
          "properties": {
            "value": {
              "title": "Value",
              "description": "The final value of the call parameter the agent stores its cart in, exactly as the agent saved it."
            },
            "checkout": {
              "anyOf": [
                {
                  "type": "object",
                  "title": "Checkout",
                  "description": "Set when the order was placed during the call; null when the cart was never placed.",
                  "properties": {
                    "order_ids": {
                      "anyOf": [
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "title": "Order Ids",
                      "description": "Order ids read from the outputs of the action that placed the order, when the agent's cart settings say where they are."
                    }
                  },
                  "required": [
                    "order_ids"
                  ]
                },
                {
                  "type": "null"
                }
              ],
              "title": "Checkout"
            }
          },
          "required": [
            "value",
            "checkout"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Cart",
      "description": "The call's cart, when the agent version it ran on has a cart configured. Null otherwise."
    },
    "call_prompt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Call Prompt"
    },
    "answered_by": {
      "anyOf": [
        {
          "$ref": "#/$defs/AnsweredByEnum"
        },
        {
          "type": "null"
        }
      ]
    },
    "analyzers": {
      "type": "array",
      "title": "Analyzers",
      "description": "List of analyzers configured for this call",
      "items": {
        "$ref": "#/$defs/AnalyzerResponse"
      }
    },
    "analysis_results": {
      "type": "array",
      "title": "Analysis Results",
      "description": "Results from analyzers that have completed",
      "items": {
        "$ref": "#/$defs/AnalysisResultResponse"
      }
    },
    "summary": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Summary",
      "description": "The summary of the call if available"
    },
    "keyterms": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "title": "Keyterms",
      "description": "Key terms configured for the agent used on the call. Empty when there is no associated agent or no key terms are configured."
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when this call was last updated."
    }
  },
  "type": "object",
  "required": [
    "id",
    "simple_uuid",
    "from_number",
    "to_number",
    "status",
    "started_at",
    "ended_at",
    "duration",
    "created_at",
    "transcripts",
    "call_prompt",
    "answered_by",
    "screen_pop_token",
    "updated_at"
  ],
  "$defs": {
    "AnalysisResultResponse": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "title": "Id",
          "description": "Unique identifier for the analysis result"
        },
        "analyzer_id": {
          "type": "string",
          "format": "uuid",
          "title": "Analyzer Id",
          "description": "Identifier of the analyzer that produced this result"
        },
        "prompt": {
          "type": "string",
          "title": "Prompt",
          "description": "The prompt used for analysis"
        },
        "output_config": {
          "type": "object",
          "title": "Output Config",
          "description": "Configuration for the expected output format"
        },
        "result": {
          "type": "object",
          "title": "Result",
          "description": "The analysis result, structure depends on the output_config"
        }
      },
      "required": [
        "id",
        "analyzer_id",
        "prompt",
        "output_config",
        "result"
      ],
      "title": "AnalysisResultResponse"
    },
    "AnalyzerResponse": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "title": "Id",
          "description": "Unique identifier for the analyzer"
        },
        "prompt": {
          "type": "string",
          "title": "Prompt",
          "description": "The prompt used for analysis"
        },
        "output_config": {
          "type": "object",
          "title": "Output Config",
          "description": "Configuration for the expected output format",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "string",
                "boolean",
                "datetime",
                "object"
              ],
              "description": "The type of output expected"
            },
            "properties": {
              "type": "object",
              "description": "Required when type is 'object'. Defines the structure of the object",
              "additionalProperties": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "string",
                      "boolean",
                      "datetime"
                    ]
                  }
                }
              }
            }
          }
        }
      },
      "required": [
        "id",
        "prompt",
        "output_config"
      ],
      "title": "AnalyzerResponse"
    },
    "AnsweredByEnum": {
      "type": "string",
      "enum": [
        "voicemail",
        "human",
        "no_answer",
        "unknown"
      ],
      "title": "Answered By",
      "description": "Indicates how the call was answered - by a human, voicemail, or if there was no answer"
    },
    "CallTranscriptResponse": {
      "properties": {
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Text"
        },
        "role": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Role"
        },
        "timestamp": {
          "type": "number",
          "title": "Timestamp",
          "description": "When the entry was recorded, as a Unix timestamp in seconds"
        },
        "function_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Function Name"
        },
        "arguments": {
          "anyOf": [
            {
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Arguments"
        }
      },
      "type": "object",
      "required": [
        "text",
        "role",
        "timestamp",
        "function_name",
        "arguments"
      ],
      "title": "CallTranscriptResponse"
    },
    "Five9HandoffMetadata": {
      "type": "object",
      "title": "Five9HandoffMetadata",
      "description": "Details of a transfer to Five9.",
      "properties": {
        "conversation_id": {
          "type": "string",
          "title": "Conversation ID",
          "description": "The Five9 conversation ID. Use this to correlate with Five9's API."
        },
        "tenant_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Tenant Name",
          "description": "The Five9 tenant name used for the transfer."
        },
        "campaign_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Campaign Name",
          "description": "The Five9 campaign the conversation was routed to."
        },
        "transferred_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Transferred At",
          "description": "When the transfer occurred (ISO 8601)."
        }
      }
    },
    "HandoffMetadata": {
      "type": "object",
      "title": "HandoffMetadata",
      "description": "Metadata about a transfer to an external provider.",
      "properties": {
        "five9": {
          "anyOf": [
            {
              "$ref": "#/$defs/Five9HandoffMetadata"
            },
            {
              "type": "null"
            }
          ],
          "title": "Five9",
          "description": "Five9 handoff details. Present when the transfer was to Five9."
        }
      }
    }
  }
}