Skip to content
UneeqUneeqUneeq Docs

Create a role-play scenario

POST
/external/v1/organization/{organizationID}/immersive-training/role-play
curl --request POST \
--url "$UNEEQ_API_URL/external/v1/organization/$UNEEQ_ORG_ID/immersive-training/role-play" \
--header "Authorization: Bearer $UNEEQ_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"name": "Renewal price objection",
"scenario_type": "ROLE_PLAY",
"learning_domain_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"persona_config_id": "9b2e4c1a-6f3d-4e8b-a1c2-5d7f8e9a0b1c",
"system_prompt": "You are Dana Whitfield, procurement lead at Northwind Logistics. Your renewal price has risen 12% and you are evaluating a competitor. Push back firmly on the increase, ask for justification and a discount, and only agree to renew if the account manager shows clear value.",
"participant_instructions": "You are the account manager. Keep Dana as a customer while protecting margin.",
"personality_name": "Dana Whitfield",
"personality_role": "Procurement Lead",
"personality_location": "Chicago, USA",
"locales": "en-US",
"is_published": true,
"time_limit_minutes": 15,
"tags": [
"7c9e6679-7425-40de-944b-e07fc1f90ae7"
],
"new_assessments": [
{
"title": "Value articulation",
"description": "Explains the value behind the price increase.",
"criteria": "The learner links the increase to concrete outcomes the customer has received.",
"is_active": true,
"order_position": 0
}
]
}'

Creates a conversational scenario from fields you author yourself. The system_prompt is stored and used verbatim as the digital human’s instructions; nothing is generated from it except a short prompt_summary (one AI model call; if it fails the scenario is still created with an empty summary).

Scenario type: ROLE_PLAY (default) is an org-wide scenario. PRACTICE is a private practice scenario owned by the member named in user_email, who must be an active member of the organization; user_email is required for PRACTICE and rejected otherwise. The organization must have practice mode enabled. Practice scenarios are always published (is_published is ignored) and cannot carry tags, teams or endorsement_threshold.

Assessments: assessments attaches existing assessments from the organization library. new_assessments creates new assessments, adds them to the organization’s shared library and attaches them.

Teams: teams assigns the scenario directly to those teams of the organization.

After the response, speech-recognition hints and runtime configuration for the scenario are prepared in the background. The endpoint is not idempotent.

Assessment weights: this endpoint does not currently check that the weights of active assessments are all-or-none and sum to 100, although the update endpoint does. Send weights that follow that rule: an update that restates the same weights in assessments will be rejected.

organizationID
required
string

ID of the organization the API key belongs to, for example org_HYPCX67vaupjhdTn.

Example

org_HYPCX67vaupjhdTn
Media typeapplication/json

A role-play or practice scenario authored by the caller.

object
name
required

Scenario name.

string
>= 1 characters <= 255 characters
scenario_type

ROLE_PLAY for an org-wide scenario, PRACTICE for a private scenario owned by user_email.

string
default: ROLE_PLAY
Allowed values: ROLE_PLAY PRACTICE
learning_domain_id
required

Learning domain of the organization the scenario belongs to.

string format: uuid
persona_config_id
required

Digital human available to the organization that plays the character.

string format: uuid
user_email

Required for PRACTICE and rejected otherwise. Email of the active member who owns the practice scenario (matched case-insensitively).

string format: email
<= 254 characters
system_prompt
required

Instructions the digital human follows, stored verbatim. Must not be blank.

string
>= 1 characters <= 100000 characters
participant_instructions

Instructions shown to the learner before starting.

string
<= 50000 characters
personality_name

Name of the character, shown to the learner.

string
<= 255 characters
personality_role

Role or job title of the character.

string
<= 255 characters
personality_location

Where the character is based.

string
<= 255 characters
locales

Deprecated and ignored. Every scenario offers every supported language. Still validated, so an unsupported locale is rejected with validation_failed; omit it.

string
<= 50 characters
is_published

Publish to learners immediately. Ignored for PRACTICE, which is always published.

boolean
endorsement_threshold

Score a learner must reach to be endorsed. Omit for no endorsement. Not allowed for PRACTICE.

integer
>= 1 <= 100
time_limit_minutes

Session time limit in minutes. Omit for no limit.

integer
>= 1 <= 120
max_attempts

Maximum attempts per learner. Omit for unlimited.

integer
>= 1 <= 99
tags

Ids of the organization’s tags. Not allowed for PRACTICE.

Array<string>
<= 50 items
teams

Ids of the organization’s teams to assign the scenario to. Not allowed for PRACTICE.

Array<string>
<= 50 items
assessments

Existing assessments of the organization to attach.

Array<object>
<= 50 items

An existing assessment of the organization to attach to a scenario.

object
id
required

Assessment id.

string format: uuid
is_active

Whether the assessment is used to score this scenario.

boolean
weight

Weight in the overall score. If any active assessment has a weight, every active one must, and the weights must sum to exactly 100. The update endpoint enforces this across the active assessments sent in that request (stored attachments are not counted); the create endpoint currently does not.

integer
<= 100
order_position

Position of the assessment within this scenario, 0-based.

integer
0
new_assessments

New assessments to create in the organization’s shared library and attach.

Array<object>
<= 50 items

An assessment to create in the organization’s shared library and attach to the scenario.

object
title
required

Assessment title.

string
>= 1 characters <= 255 characters
description
required

What the assessment measures.

string
>= 1 characters <= 50000 characters
criteria
required

Scoring criteria.

string
>= 1 characters <= 50000 characters
is_active

Whether the assessment is used to score this scenario.

boolean
weight

Weight in the overall score. If any active assessment has a weight, every active one must, and the weights must sum to exactly 100. The update endpoint enforces this across the active assessments sent in that request (stored attachments are not counted); the create endpoint currently does not.

integer
<= 100
order_position

Position of the assessment within this scenario, 0-based.

integer
0
resource_label

Label of a learning-resource link. Send together with resource_url, or neither.

string
<= 100 characters
resource_url

Absolute http or https URL of a learning-resource link. Send together with resource_label, or neither.

string format: uri
<= 2048 characters

Example

{
"name": "Renewal price objection",
"scenario_type": "ROLE_PLAY",
"learning_domain_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"persona_config_id": "9b2e4c1a-6f3d-4e8b-a1c2-5d7f8e9a0b1c",
"system_prompt": "You are Dana Whitfield, procurement lead at Northwind Logistics. Your renewal price has risen 12% and you are evaluating a competitor. Push back firmly on the increase, ask for justification and a discount, and only agree to renew if the account manager shows clear value.",
"participant_instructions": "You are the account manager. Keep Dana as a customer while protecting margin.",
"personality_name": "Dana Whitfield",
"personality_role": "Procurement Lead",
"personality_location": "Chicago, USA",
"locales": "en-US",
"is_published": true,
"time_limit_minutes": 15,
"tags": [
"7c9e6679-7425-40de-944b-e07fc1f90ae7"
],
"new_assessments": [
{
"title": "Value articulation",
"description": "Explains the value behind the price increase.",
"criteria": "The learner links the increase to concrete outcomes the customer has received.",
"is_active": true,
"order_position": 0
}
]
}

The scenario was created.

Media typeapplication/json

A full immersive training scenario.

object
id
required

Scenario id.

string format: uuid
status
required

Reserved; currently always an empty string.

string
name
required

Scenario name.

string
objective
required

Deprecated and always an empty string. A scenario’s former objective now starts its context.

string
context
required

The situation the scenario was written from: the scenario_context for a generated scenario, or the context entered when the scenario was created in the app. A scenario that had a separate objective starts with Training objective: …. Empty when none was given.

string
persona_config
required

The digital human a scenario uses. A short form of the record returned by the digital human list.

object
id
required

Digital human id.

string format: uuid
share_id
required

Identifier of the digital human on the Uneeq platform.

string
avatar_url
required

URL of the digital human’s preview image.

string
has_platform_api_key
required

Always false here. Read it from the digital human list.

boolean
gender
required

Always an empty string here. Read it from the digital human list.

string
Allowed values: ""
is_default_ai_buddy
required

Always false here. Read it from the digital human list.

boolean
custom_animation_tags

Per-digital-human override for emotion and action tag instructions. Present only when set.

string
personality
required

Description of the character’s personality. Empty for Q&A scenarios and authored role plays.

string
personality_name
required

Name of the character the digital human plays. Empty for Q&A scenarios.

string
personality_role
required

Role or job title of the character. Empty for Q&A scenarios.

string
personality_location
required

Where the character is based. Empty for Q&A scenarios.

string
personality_type
required

Personality archetype chosen by the generator. Empty for Q&A scenarios and authored role plays.

string
generated_prompt
required

The system prompt the digital human follows. Empty for Q&A scenarios.

string
prompt_summary
required

Short AI-written summary of the system prompt. Empty when none could be generated, and for Q&A scenarios.

string
summarized_document

AI summary of the supporting documents, when one was made. Absent otherwise.

string
document_description

Description of the supporting documents, when set. Absent otherwise.

string
version
required

Configuration version; starts at 1 and increases with every update.

integer
learning_domain_id
required

Learning domain the scenario belongs to.

string format: uuid
organization_id
required

Organization that owns the scenario.

string
is_published
required

Whether learners can see and start the scenario. Always true for PRACTICE.

boolean
participant_instructions
required

Instructions shown to the learner before starting.

string
training_scenario_id

Legacy field; not currently returned.

string
created_at
required

Creation time.

string format: date-time
created_by
required

Display name of the creator, or the creator’s user id when no name is known. For a practice scenario, the owning member.

string
deleted_at

Deletion time; not returned, since deleted scenarios are not readable.

string format: date-time
updated_at

Last update time. Absent when the scenario was never updated.

string format: date-time
updated_by
required

Display name of the last editor, or their user id when no name is known.

string
locales
required

Deprecated. Every scenario offers every supported language, so this always lists all supported locales, colon-separated (for example en-US:fr-FR:...), whatever was stored or sent.

string
allow_ai_coach
required

Deprecated; always false. Scheduled for removal after 2027-03-15.

boolean
prompt_only_mode
required

Deprecated and always true: every scenario uses generated_prompt verbatim as the digital human’s instructions.

boolean
endorsement_threshold

Score from 1 to 100 a learner must reach to be endorsed. Absent when the scenario has no endorsement.

integer
>= 1 <= 100
time_limit_minutes

Session time limit in minutes. Absent when there is no limit.

integer
>= 1 <= 120
max_attempts

Maximum attempts per learner. Absent means unlimited.

integer
>= 1 <= 99
answer_clear_mode
required

Q&A only (always ALLOWED on other types). DISALLOWED hides the learner’s option to clear a spoken answer before it is scored.

string
Allowed values: ALLOWED DISALLOWED
endorsement_level
required

Endorsement tier the scenario is configured for; STANDARD when it has an endorsement threshold, otherwise NONE.

string
Allowed values: NONE STANDARD
scenario_type
required

Kind of scenario. ROLE_PLAY is a conversation with a digital human, TECHNICAL_ACUMEN is a spoken Q&A, PRACTICE is a member’s private role play.

string
Allowed values: ROLE_PLAY TECHNICAL_ACUMEN PRACTICE
question_ordering

Q&A only. SEQUENTIAL asks questions in order; RANDOM draws them at random. Absent on other types.

string
Allowed values: SEQUENTIAL RANDOM
questions_per_session

Q&A only. Number of questions drawn per session when ordering is RANDOM. Absent means all.

integer
>= 1
tags
required

Tags on the scenario.

Array<object>
object
id
required

Tag ID.

string format: uuid
name
required

Tag name.

string
color
required

Display color, for example a hex code such as #F7F9FB.

string
assessments
required

Assessments attached to the scenario in their per-scenario order, followed by the learning domain’s default assessments that are not attached (shown with is_active false). Empty for Q&A scenarios unless the domain has defaults.

Array<object>

An assessment as attached to a scenario.

object
id

Assessment id.

string format: uuid
title

Assessment title. Absent when empty.

string
description

What the assessment measures. Absent when empty.

string
criteria

Scoring criteria. Absent when empty.

string
is_active
required

Whether the assessment is used to score this scenario.

boolean
default
required

Whether this is a default assessment of the learning domain.

boolean
order_position
required

For an assessment attached to the scenario, its 0-based position within the scenario. For an unattached default assessment of the learning domain, its display order in the organization’s assessment library.

integer
weight

Weight of the assessment in the overall score. Absent when the scenario uses equal weighting.

integer
<= 100
documents
required

Supporting documents attached to the scenario.

Array<object>

A supporting document attached to a scenario.

object
id
required

Document id.

string format: uuid
file_name
required

File name of the document.

string
questions

Q&A only. The current question bank, in order. Absent on other types and when the bank is empty.

Array<object>

One question in a Q&A scenario’s question bank.

object
id

Question id. Changes when the question bank is replaced.

string format: uuid
question
required

The question the digital human asks.

string
answer_criteria
required

What a good answer must contain; the spoken answer is scored against it.

string
weight

Relative weight of the question. Absent when the bank uses equal weighting.

integer
>= 1 <= 100
order_position
required

Position of the question in the bank.

integer
resource_label

Label of a learning-resource link for the question, when set.

string
resource_url

URL of a learning-resource link for the question, when set.

string format: uri
time_limit_seconds

Time allowed to answer, in seconds. Absent means no per-question limit.

integer
>= 10 <= 7200

Example

{
"persona_config": {
"gender": ""
},
"answer_clear_mode": "ALLOWED",
"endorsement_level": "NONE",
"scenario_type": "ROLE_PLAY",
"question_ordering": "SEQUENTIAL"
}

The request was rejected:

  • Malformed JSON, a wrong field type, an unknown field (for example questions, objective or prompt_summary), or an empty body (error_code invalid_request_body).
  • A field failed validation, or system_prompt is blank, or user_email is missing for PRACTICE / present for ROLE_PLAY, or locales names an unsupported locale (error_code validation_failed).
  • Practice mode is not enabled, or a PRACTICE scenario carries tags, teams or endorsement_threshold (no error_code).
  • A new assessment’s resource link is half-filled (no error_code). A resource_url that is not an absolute http(s) URL, or an over-long label or URL, fails field validation (error_code validation_failed).
Media typeapplication/json

The body of an error returned by an endpoint.

object
message
required

Human-readable explanation of what went wrong.

string
error_code

Stable machine-readable cause. Present only for errors that have one.

string

Example generated

{
"message": "example",
"error_code": "example"
}

The Authorization header is missing, or the API key is not valid for this organization. A key check that fails on the server is also reported as 401.

Media typeapplication/json

The body of an error returned before the request reaches an endpoint (authentication and rate limiting).

object
error
required

Human-readable explanation of what went wrong.

string

Example generated

{
"error": "example"
}

One or more teams do not belong to the organization (“one or more teams do not belong to the requested organization”). No error_code is set.

Media typeapplication/json

The body of an error returned by an endpoint.

object
message
required

Human-readable explanation of what went wrong.

string
error_code

Stable machine-readable cause. Present only for errors that have one.

string

Example generated

{
"message": "example",
"error_code": "example"
}

A referenced resource is not available to the organization:

  • user_email is not an active member (error_code user_not_in_org).
  • A tag id does not belong to the organization (error_code validation_failed).
  • The learning domain, the persona or an attached assessment is not in the organization (no error_code).
Media typeapplication/json

The body of an error returned by an endpoint.

object
message
required

Human-readable explanation of what went wrong.

string
error_code

Stable machine-readable cause. Present only for errors that have one.

string

Example generated

{
"message": "example",
"error_code": "example"
}

The request body is larger than 512 KiB (error_code invalid_request_body).

Media typeapplication/json

The body of an error returned by an endpoint.

object
message
required

Human-readable explanation of what went wrong.

string
error_code

Stable machine-readable cause. Present only for errors that have one.

string

Example generated

{
"message": "example",
"error_code": "example"
}

The API key has sent too many requests. Wait for the number of seconds in Retry-After, then retry.

Media typeapplication/json

The body of an error returned before the request reaches an endpoint (authentication and rate limiting).

object
error
required

Human-readable explanation of what went wrong.

string

Example generated

{
"error": "example"
}
Retry-After
integer
>= 1

Seconds to wait before retrying.

The scenario could not be saved (“unable to create immersive training”), or a lookup it depends on failed, for example “unable to look up the requested user”, “unable to look up the organization’s tags”, “unable to get learning domain”, “unable to get persona config” or “unable to assign team to training scenario”. No error_code is set.

Media typeapplication/json

The body of an error returned by an endpoint.

object
message
required

Human-readable explanation of what went wrong.

string
error_code

Stable machine-readable cause. Present only for errors that have one.

string

Example generated

{
"message": "example",
"error_code": "example"
}