Skip to main content
POST
/
v1
/
agent-testing
/
scenarios
/
generate-from-call
Generate Scenario from Call
curl --request POST \
  --url https://api.bland.ai/v1/agent-testing/scenarios/generate-from-call \
  --header 'Content-Type: application/json' \
  --header 'authorization: <authorization>' \
  --data '
{
  "call_id": "<string>",
  "pathway_id": "<string>",
  "persona_id": "<string>"
}
'
{
    "name": "Inbound Appointment Booking - Returning Customer",
    "description": "Simulates a returning customer calling to book a follow-up appointment. The caller provides their name and preferred time slot, and expects confirmation.",
    "category": "HAPPY_PATH",
    "tester_persona_prompt": "You are Sarah Chen, a returning customer. You previously visited for a consultation and want to book a follow-up appointment. You prefer afternoons, ideally next Thursday at 2 PM. Be polite but firm about your preferred time. If that slot is unavailable, accept an alternative within the same week.",
    "tester_persona_name": "Sarah Chen",
    "pathway_id": "pw_abc123",
    "persona_id": null,
    "request_data": {
        "customer_name": "Sarah Chen",
        "account_id": "cust_92841",
        "appointment_type": "follow_up"
    }
}

Headers

authorization
string
required
Your API key for authentication.

Body

call_id
string
required
The ID of the historical call to generate a scenario from. The call transcript will be analyzed by AI to extract a realistic test scenario.
pathway_id
string
The pathway to bind the generated scenario to. Either pathway_id or persona_id is required.
persona_id
string
The persona to bind the generated scenario to. Either pathway_id or persona_id is required.

Response

The response contains the generated scenario data. This data is not yet saved — it is returned so you can review and use it to create a scenario.
Sensitive data such as phone numbers, webhook URLs, and API keys is automatically stripped from the generated request_data.
name
string
An AI-generated name summarizing the scenario.
description
string
An AI-generated description of what the scenario tests based on the call transcript.
category
string
The inferred category for the scenario (e.g., HAPPY_PATH, EDGE_CASE, ANGRY_CALLER).
tester_persona_prompt
string
An AI-generated prompt that instructs the simulated caller to replicate the behavior observed in the original call.
tester_persona_name
string
A name for the simulated caller persona derived from the call.
pathway_id
string
The pathway the scenario is bound to (if provided).
persona_id
string
The persona the scenario is bound to (if provided).
request_data
object
Request data extracted from the call with sensitive fields automatically removed.
{
    "name": "Inbound Appointment Booking - Returning Customer",
    "description": "Simulates a returning customer calling to book a follow-up appointment. The caller provides their name and preferred time slot, and expects confirmation.",
    "category": "HAPPY_PATH",
    "tester_persona_prompt": "You are Sarah Chen, a returning customer. You previously visited for a consultation and want to book a follow-up appointment. You prefer afternoons, ideally next Thursday at 2 PM. Be polite but firm about your preferred time. If that slot is unavailable, accept an alternative within the same week.",
    "tester_persona_name": "Sarah Chen",
    "pathway_id": "pw_abc123",
    "persona_id": null,
    "request_data": {
        "customer_name": "Sarah Chen",
        "account_id": "cust_92841",
        "appointment_type": "follow_up"
    }
}