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

# Execute code against test cases



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/code/execute
openapi: 3.1.0
info:
  title: intervyo.ai REST API
  version: 1.0.0
  description: >-
    Programmatic access to participants, sessions, roles, rounds, interviewers,
    and code execution.


    **Authentication.** Pass your API key in the `x-api-key` header (`x-api-key:
    iv_live_...`). Keys are created in the team dashboard under **Developer →
    API Keys**. Session (cookie) auth also works from the dashboard; for those
    calls pass `accountSlug` as a query parameter.
servers:
  - url: https://www.intervyo.ai
    description: Production
security:
  - apiKey: []
tags:
  - name: Participants
    description: >-
      Participants (candidates, applicants, trainees) are the people being
      evaluated. Create them first, then schedule sessions.
  - name: Sessions
    description: >-
      A session is one AI interview instance for one participant. Create a
      participant first, then schedule a session — the invite email is sent
      automatically.
  - name: Roles
    description: >-
      Templates define what the AI should assess — the role, skills, objective,
      and pass bar. Every session and stage belongs to a template.
  - name: Rounds
    description: >-
      Stages are the individual interview steps within a template — e.g. Phone
      Screen → Technical → Final. Each stage can have a different AI agent,
      duration, and pass threshold.
  - name: Interviewers
    description: >-
      Interviewers define the AI persona, evaluation dimensions, scoring logic,
      and tone. Assign an Interviewer to a Round to customise how the AI
      conducts that interview.
  - name: Code Execution
    description: >-
      Run candidate code against test cases. Currently supports python,
      javascript, and typescript via the OneCompiler runner. This endpoint is
      also exposed as the execute_code MCP tool — same engine, different
      transport.
  - name: Remote MCP Server
    description: >-
      Expose problem generation and code execution to any MCP-compatible client
      (Claude Desktop, Claude Code, Cursor). Speaks JSON-RPC 2.0 over HTTP.
      Requires an API key — session cookies are NOT accepted on this surface.
      Usage is metered against your plan (mcp_problem_generations and
      mcp_code_executions).
paths:
  /api/v1/code/execute:
    post:
      tags:
        - Code Execution
      summary: Execute code against test cases
      operationId: post_api_v1_code_execute
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                code:
                  type: string
                  description: Full source code to run.
                language:
                  type: string
                  description: python | javascript | typescript (others return 422).
                functionName:
                  type: string
                  description: >-
                    Canonical snake_case identifier — used if extraction from
                    source fails.
                functionNames:
                  type: object
                  additionalProperties: true
                  description: >-
                    Per-language map, e.g. { python: "two_sum", javascript:
                    "twoSum" }.
                pythonFunctionName:
                  type: string
                  description: Legacy scalar fallback for python.
                jsFunctionName:
                  type: string
                  description: Legacy scalar fallback for javascript / typescript.
                testCases:
                  type: array
                  items:
                    type: object
                  description: >-
                    Each item: { args: {...}, expected: any }. At least one
                    required.
              required:
                - code
                - language
                - functionName
                - testCases
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
              example:
                results:
                  - input:
                      nums:
                        - 2
                        - 7
                        - 11
                        - 15
                      target: 9
                    expected:
                      - 0
                      - 1
                    actual:
                      - 0
                      - 1
                    passed: true
                    runtime: 412ms
        '400':
          description: Bad Request — Validation error (invalid JSON or schema)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '408':
          description: Request Timeout — Execution timed out after 15 seconds
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            Unprocessable Entity — Batched execution not supported for this
            language
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Bad Gateway — OneCompiler upstream error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security: []
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
          description: Human-readable error message
        issues:
          type: array
          items:
            type: object
          description: Field-level validation issues (present on 400 responses)
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key with the `iv_live_` prefix. Create one under Developer → API
        Keys.

````