> ## 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.

# Assign scenario to user

> Assign a scenario to a user as a task or homework assignment.
The user will receive notification of the assignment and can track their progress.




## OpenAPI

````yaml /api-reference/openapi.yaml post /scenarios/{scenario_id}/assignments
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:
  /scenarios/{scenario_id}/assignments:
    post:
      tags:
        - Scenarios
      summary: Assign scenario to user
      description: >
        Assign a scenario to a user as a task or homework assignment.

        The user will receive notification of the assignment and can track their
        progress.
      operationId: assignScenario
      parameters:
        - name: scenario_id
          in: path
          required: true
          description: Scenario identifier
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - user_email
                - due_date
              properties:
                user_email:
                  type: string
                  format: email
                  description: Email of the user to assign the scenario to
                due_date:
                  type: string
                  format: date-time
                  description: When the assignment is due (ISO 8601 format)
                assigner_email:
                  type: string
                  format: email
                  description: >-
                    Email of the user creating the assignment (optional, used in
                    notification emails)
                attempt_min:
                  type: integer
                  minimum: 1
                  description: Minimum number of attempts required
                attempt_max:
                  type: integer
                  minimum: 1
                  description: Maximum number of attempts allowed
                rank_min:
                  type: string
                  enum:
                    - gold
                    - silver
                    - bronze
                  description: Minimum rank required to complete
                custom_message:
                  type: string
                  description: Custom message to include with the assignment
            example:
              user_email: jane@acme.com
              due_date: '2024-03-15T17:00:00Z'
              assigner_email: manager@acme.com
              attempt_min: 1
              attempt_max: 5
              rank_min: silver
              custom_message: Please complete this discovery call practice by Friday
      responses:
        '200':
          description: Assignment created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Assignment'
              example:
                id: a1s2s3i4g5n6
                user:
                  id: u1a2b3c4d5e6
                  email: jane@acme.com
                  first_name: Jane
                  last_name: Smith
                scenario:
                  id: s1c2e3n4a5r6
                  name: Discovery Call
                  slug: discovery-call
                status: not_started
                due_date: '2024-03-15T17:00:00Z'
                best_score: null
                best_rank: null
                attempt_count: 0
                attempt_min: 1
                attempt_max: 5
                rank_min: silver
                program: null
                created_at: '2024-03-01T10:00:00Z'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    Assignment:
      type: object
      description: A scenario assignment given to a user as a practice task.
      properties:
        id:
          type: string
          description: Unique assignment identifier
        user:
          $ref: '#/components/schemas/User'
        scenario:
          $ref: '#/components/schemas/ScenarioRef'
        status:
          type: string
          enum:
            - not_started
            - in_progress
            - completed
            - past_due
            - did_not_pass
          description: Current assignment status
        due_date:
          type: string
          format: date-time
          nullable: true
          description: When the assignment is due
        best_score:
          type: number
          nullable: true
          description: Highest score achieved on this assignment
        best_rank:
          type: string
          nullable: true
          enum:
            - gold
            - silver
            - bronze
            - unranked
          description: Rank from the best scoring attempt
        attempt_count:
          type: integer
          description: Number of completed attempts
        attempt_min:
          type: integer
          nullable: true
          description: Minimum attempts required
        attempt_max:
          type: integer
          nullable: true
          description: Maximum attempts allowed
        rank_min:
          type: string
          nullable: true
          enum:
            - gold
            - silver
            - bronze
            - unranked
          description: Minimum rank required to pass
        program:
          type: object
          nullable: true
          description: Program this assignment belongs to (null if standalone)
          properties:
            id:
              type: string
            name:
              type: string
        created_at:
          type: string
          format: date-time
    User:
      type: object
      properties:
        id:
          type: string
          description: Unique user identifier
        email:
          type: string
          format: email
          description: User's email address
        first_name:
          type: string
          description: User's first name
        last_name:
          type: string
          description: User's last name
    ScenarioRef:
      type: object
      description: A compact scenario reference for embedding in other responses.
      properties:
        id:
          type: string
          description: Unique scenario identifier
        name:
          type: string
          description: Scenario name
        slug:
          type: string
          description: URL-friendly scenario identifier
    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:
    BadRequest:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationErrorDetail'
          example:
            error:
              type: invalid_request
              code: invalid_pagination
              message: Invalid pagination parameters
    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
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationErrorDetail'
          example:
            error:
              type: not_found
              message: 'Scenario not found: abc123'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |
        API key created in Settings > API.

        Format: `exec_live_` followed by 40 alphanumeric characters.

````