---
title: "POST /executions"
method: POST
path: "/executions"
---

# POST /executions

`POST /executions`

Execute code in a session. This is only supported for code-interpreter session pools.

## Query parameters

- `api-version` string, required
- `identifier` string, required

## Headers

- `operation-id` string

## Request body

- SessionCodeExecutionRequest — The request to execute code.
  - `codeInputType` 'Inline' | 'InlineBase64' | 'InlineText' — Code input type.
  - `executionType` 'Synchronous' | 'Asynchronous' — Execution Type
  - `code` string — The string of the code to execute, based on CodeInputType.
  - `timeoutInSeconds` integer, required — Execution timeout in seconds.
  - `outputStreamsMaxLength` integer — The maximum length of the output streams. Default value is 4096.
  - `useEmptyKernel` boolean — Whether to use empty kernel for this execution. Default is false.
  - `returnJupyterFormatExecutionResult` boolean — Whether to formats primitive Python results (bool, int, float, string, None) as JSON strings or null. Default to false.
  - `shellCommand` string — Shell command to execute in Bash. Only available for a `Shell` typed session pool. Cannot coexist with `execCommandAndArgs`.
  - `execCommandAndArgs` string[] — The executable and its arguments. Only available for a `Shell` typed session pool. Cannot coexist with `shellCommand`.
  - `stdin` string — The standard input of the shell command execution. Only available for a `Shell` typed session pool.

## Response `200`

The request has succeeded.

- SessionCodeExecutionResource — The session code execution resource.
  - `id` string, required — Session code execution id.
  - `identifier` string, required — The identifier of the session.
  - `executionType` 'Synchronous' | 'Asynchronous' — Execution Type
  - `status` 'NotStarted' | 'Running' | 'Succeeded' | 'Failed' | 'Canceled', required — Enum describing allowed operation states.
  - `error` AzureCoreFoundationsErrorResponse — A response containing error details.
    - `error` AzureCoreFoundationsError, required — The error object.
      - `code` string, required — One of a server-defined set of error codes.
      - `message` string, required — A human-readable representation of the error.
      - `target` string — The target of the error.
      - `details` AzureCoreFoundationsError[] — An array of details about specific errors that led to this reported error.
      - `innererror` AzureCoreFoundationsInnerError — An object containing more specific information about the error. As per Azure REST API guidelines - https://aka.ms/AzureRestApiGuidelines#handling-errors.
        - `code` string — One of a server-defined set of error codes.
        - `innererror` AzureCoreFoundationsInnerError — recursive
  - `result` SessionCodeExecutionResult — The result of the code execution.
    - `stdout` string — The standard output of the code execution.
    - `stderr` string — The standard error of the code execution.
    - `executionResult` unknown
    - `executionTimeInMilliseconds` integer — The execution time of the code in milliseconds.

## Other responses

- `default` — An unexpected error response.

---

[API](https://skmtc.dev/azure/apis/app-dynamicsessions.md) · [All operations](https://skmtc.dev/azure/apis/app-dynamicsessions/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/azure/app-dynamicsessions/revisions/acc255eeaad5/schema)
