> ## Documentation Index
> Fetch the complete documentation index at: https://docs.exec.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Scenario job

> Creates an asynchronous scenario creation job.
Returns immediately with a job ID that can be polled for status.

The AI agent processes the job in the background, typically completing
within 5 minutes. Use the GET endpoint to poll for completion,
or provide a `callback_url` to receive a webhook when the job finishes.

**Remix mode**: Provide `scenario_slug` to create a variation of an existing
scenario. The AI will use the source scenario as a starting point and apply
your prompt as modifications.




## OpenAPI

````yaml /api-reference/openapi.yaml post /scenario-studio/jobs
openapi: 3.0.3
info:
  title: Exec API
  version: '1.0'
  description: >
    REST API for programmatic access to your Exec workspace.


    Use the Exec API to read workspace data, list members, retrieve group
    information,

    and create interactive scenario creation sessions.


    ## Authentication

    All requests require a valid API key passed in the Authorization header:

    ```

    Authorization: Bearer exec_live_...

    ```


    Create API keys in your workspace settings under **Settings > API**.
servers:
  - url: https://api.exec.com/rest/v1
    description: Production
security:
  - bearerAuth: []
paths:
  /scenario-studio/jobs:
    post:
      tags:
        - Scenario Studio
      summary: Create Scenario job
      description: >
        Creates an asynchronous scenario creation job.

        Returns immediately with a job ID that can be polled for status.


        The AI agent processes the job in the background, typically completing

        within 5 minutes. Use the GET endpoint to poll for completion,

        or provide a `callback_url` to receive a webhook when the job finishes.


        **Remix mode**: Provide `scenario_slug` to create a variation of an
        existing

        scenario. The AI will use the source scenario as a starting point and
        apply

        your prompt as modifications.
      operationId: createScenarioJob
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - user_email
                - prompt
              properties:
                user_email:
                  type: string
                  format: email
                  description: >-
                    Email of the user to create the scenario for (must be a
                    workspace member)
                prompt:
                  type: string
                  maxLength: 10000
                  description: >-
                    Instructions for the AI agent describing what scenario to
                    create
                context:
                  type: string
                  maxLength: 50000
                  description: >
                    Additional context in Markdown format (e.g., CRM data,
                    meeting notes, product info).

                    This is provided to the AI agent as background information.
                scenario_slug:
                  type: string
                  description: >
                    Slug of an existing scenario to remix/iterate on.

                    The AI will use this as a starting point and apply your
                    prompt as modifications.
                request_id:
                  type: string
                  description: >
                    Client-provided idempotency key. If a job with this ID
                    already exists,

                    returns the existing job instead of creating a new one.
                callback_url:
                  type: string
                  format: uri
                  description: URL to receive a webhook POST when the job completes
                callback_headers:
                  type: object
                  additionalProperties:
                    type: string
                  description: >-
                    Custom headers to include in the callback request (e.g.,
                    authorization)
            example:
              user_email: jane@acme.com
              prompt: >-
                Create a discovery call scenario with a skeptical IT director
                who is concerned about integration complexity
              context: |
                ## Prospect Information
                - Company: TechCorp Inc.
                - Industry: Financial Services
                - Size: 500 employees
                - Current pain point: Manual data entry across systems
              request_id: salesforce-opp-12345
              callback_url: https://hooks.acme.com/exec-scenarios
              callback_headers:
                Authorization: Bearer webhook-secret-token
      responses:
        '200':
          description: >-
            Existing job returned (idempotent duplicate — a job with this
            request_id already exists)
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ScenarioJob'
                  - type: object
                    properties:
                      is_new:
                        type: boolean
                        description: >-
                          Always false when an existing job is returned via
                          request_id
              example:
                id: j1o2b3i4d5x6
                status: completed
                scenario:
                  id: s1c2e3n4a5r6
                  slug: discovery-call-skeptical-it-director
                  name: Discovery Call with IT Director
                error: null
                created_at: '2024-03-01T10:00:00Z'
                started_at: '2024-03-01T10:00:05Z'
                completed_at: '2024-03-01T10:02:30Z'
                duration_seconds: 145
                is_new: false
        '201':
          description: Job created successfully
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ScenarioJob'
                  - type: object
                    properties:
                      is_new:
                        type: boolean
                        description: >-
                          True if a new job was created, false if an existing
                          job was returned via request_id
              example:
                id: j1o2b3i4d5x6
                status: queued
                scenario: null
                error: null
                created_at: '2024-03-01T10:00:00Z'
                started_at: null
                completed_at: null
                duration_seconds: null
                is_new: true
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorDetail'
              examples:
                missing_field:
                  summary: Missing required field
                  value:
                    error:
                      type: invalid_request
                      message: prompt is required
                field_too_long:
                  summary: Field exceeds max length
                  value:
                    error:
                      type: invalid_request
                      code: prompt_too_long
                      message: prompt must be 10000 characters or fewer
                user_not_found:
                  summary: User not in workspace
                  value:
                    error:
                      type: invalid_request
                      code: user_not_found
                      message: 'No user found with email: unknown@example.com'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: Scenario not found (when using scenario_slug for remix)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorDetail'
              example:
                error:
                  type: not_found
                  message: 'Scenario not found: invalid-slug'
components:
  schemas:
    ScenarioJob:
      type: object
      properties:
        id:
          type: string
          description: Job identifier
        status:
          type: string
          enum:
            - queued
            - processing
            - completed
            - failed
            - cancelled
          description: Current job status
        scenario:
          type: object
          nullable: true
          description: Created scenario details (only present when status is "completed")
          properties:
            id:
              type: string
              description: Scenario ID
            name:
              type: string
              description: Scenario name
            url:
              type: string
              format: uri
              description: Direct link to the scenario
        error:
          type: object
          nullable: true
          description: Error details (only present when status is "failed")
          properties:
            code:
              type: string
              description: Error code (e.g. GENERATION_ERROR, CONTENT_POLICY_VIOLATION)
            message:
              type: string
              description: Human-readable error message
        created_at:
          type: string
          format: date-time
          description: When the job was created
        started_at:
          type: string
          format: date-time
          nullable: true
          description: When the job started processing
        completed_at:
          type: string
          format: date-time
          nullable: true
          description: When the job finished (success, failure, or cancelled)
        duration_seconds:
          type: number
          nullable: true
          description: Processing duration in seconds (only present when job has completed)
    ValidationErrorDetail:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              description: Error category (e.g., "invalid_request")
            code:
              type: string
              description: Specific error code (e.g., "user_not_found")
            message:
              type: string
              description: Human-readable error message
  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationErrorDetail'
          example:
            error:
              type: authentication_error
              code: invalid_api_key
              message: Invalid or inactive API key
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |
        API key created in Settings > API.

        Format: `exec_live_` followed by 40 alphanumeric characters.

````