Microsoft Azure Spark Session API

The SparkSession API from Microsoft Azure, for sparksession.

GitHub OpenAPI

Operations 9

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /sessions List Spark sessions in a Spark pool · Microsoft Azure Get Sessions #
Ask an LLM
“Which Spark sessions are currently running in my Synapse Spark pool?”
“Can I page through Spark sessions and get detailed info for each?”
Tell an agent
List the Spark sessions running in my Spark pool.
List {size} Spark sessions starting from {from}, with detailed info {detailed}.
POST /sessions Start a new interactive Spark session · Microsoft Azure Post Sessions #
Ask an LLM
“How do I start an interactive Spark session in my Synapse pool?”
“Can I set executor memory, cores and the number of executors when opening a Spark session?”
Tell an agent
Create a Spark session named {name}.
Start Spark session {name} with {numExecutors} executors of {executorMemory} memory each.
GET /sessions/{sessionId} Get one Spark session's status · Microsoft Azure Get Sessions Sessionid #
Ask an LLM
“Is my Spark session idle, busy or dead?”
“Can I look up a single Spark session by its ID?”
Tell an agent
Get Spark session {sessionId}.
Show detailed state of Spark session {sessionId} (detailed={detailed}).
DELETE /sessions/{sessionId} Cancel a running Spark session · Microsoft Azure Delete Sessions Sessionid #
Ask an LLM
“How do I shut down a Spark session I no longer need?”
“Can I kill an interactive Spark session to free up the pool?”
Tell an agent destructive · confirm first
Cancel Spark session {sessionId}.
End interactive Spark session {sessionId} and release its resources.
PUT /sessions/{sessionId}/reset-timeout Keep a Spark session alive · Microsoft Azure Put Sessions Sessionid Reset Timeout #
Ask an LLM
“How can I stop my idle Spark session from timing out?”
“Is there a keep-alive call that resets a Spark session's timeout?”
Tell an agent
Reset the timeout of Spark session {sessionId}.
Send a keep-alive to Spark session {sessionId}.
GET /sessions/{sessionId}/statements List statements run in a Spark session · Microsoft Azure Get Sessions Sessionid Statements #
Ask an LLM
“What code statements have been run in my Spark session so far?”
“Can I see the outputs of every statement in a Spark session?”
Tell an agent
List the statements in Spark session {sessionId}.
Show all statement results for session {sessionId}.
POST /sessions/{sessionId}/statements Run code in a Spark session · Microsoft Azure Post Sessions Sessionid Statements #
Ask an LLM
“How do I execute a snippet of PySpark or Scala code in an open Spark session?”
“Which code kinds can I submit as a Spark statement?”
Tell an agent
Run this code {code} in Spark session {sessionId}.
Submit {code} as a {kind} statement to session {sessionId}.
GET /sessions/{sessionId}/statements/{statementId} Get the result of a Spark statement · Microsoft Azure Get Sessions Sessionid Statements Statementid #
Ask an LLM
“Has my Spark statement finished and what did it output?”
“Can I check the progress of one statement in a Spark session?”
Tell an agent
Get statement {statementId} in Spark session {sessionId}.
Show the output of statement {statementId} from session {sessionId}.
POST /sessions/{sessionId}/statements/{statementId}/cancel Kill a running Spark statement · Microsoft Azure Post Sessions Sessionid Statements Statementid Cancel #
Ask an LLM
“Can I stop a long-running statement without ending the whole Spark session?”
“What kills one statement inside a Spark session?”
Tell an agent destructive · confirm first
Cancel statement {statementId} in Spark session {sessionId}.
Kill the running statement {statementId} but keep session {sessionId} open.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/microsoft-azure:microsoft-azure-sparksession-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

microsoft-azure-sparksession-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  version: 2019-11-01-preview
  title: Microsoft Azure SparkClient Spark Session API
  x-ms-code-generation-settings:
    useDateTimeOffset: true
tags:
- name: SparkSession
paths:
  /sessions:
    get:
      tags:
      - SparkSession
      description: List all spark sessions which are running under a particular spark pool.
      operationId: microsoftAzureSparksessionGetsparksessions
      x-ms-examples:
        List all spark session jobs:
          $ref: ./examples/SparkFrontend_SparkSession_List.json
      parameters:
      - name: from
        in: query
        description: Optional param specifying which index the list should begin from.
        required: false
        schema:
          type: integer
          format: int32
      - name: size
        in: query
        description: "Optional param specifying the size of the returned list.\n            By default it is 20 and that is the maximum."
        required: false
        schema:
          type: integer
          format: int32
      - name: detailed
        in: query
        description: Optional query param specifying whether detailed response is returned beyond plain livy.
        required: false
        schema:
          type: boolean
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SparkSessionCollection'
      summary: Microsoft Azure Get Sessions
    post:
      tags:
      - SparkSession
      description: Create new spark session.
      operationId: microsoftAzureSparksessionCreatesparksession
      x-ms-examples:
        Create new spark session.:
          $ref: ./examples/SparkFrontend_SparkSession_Create.json
      parameters:
      - name: detailed
        in: query
        description: Optional query param specifying whether detailed response is returned beyond plain livy.
        required: false
        schema:
          type: boolean
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SparkSession'
      summary: Microsoft Azure Post Sessions
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SparkSessionOptions'
        description: Livy compatible batch job request payload.
        required: true
  /sessions/{sessionId}:
    get:
      tags:
      - SparkSession
      description: Gets a single spark session.
      operationId: microsoftAzureSparksessionGetsparksession
      x-ms-examples:
        Gets a single spark session.:
          $ref: ./examples/SparkFrontend_SparkSession_Get.json
      parameters:
      - name: sessionId
        in: path
        description: Identifier for the session.
        required: true
        schema:
          type: integer
          format: int32
      - name: detailed
        in: query
        description: Optional query param specifying whether detailed response is returned beyond plain livy.
        required: false
        schema:
          type: boolean
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SparkSession'
      summary: Microsoft Azure Get Sessions Sessionid
    delete:
      tags:
      - SparkSession
      description: Cancels a running spark session.
      operationId: microsoftAzureSparksessionCancelsparksession
      x-ms-examples:
        Cancels a running spark session.:
          $ref: ./examples/SparkFrontend_SparkSession_Delete.json
      parameters:
      - name: sessionId
        in: path
        description: Identifier for the session.
        required: true
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: Success
      summary: Microsoft Azure Delete Sessions Sessionid
  /sessions/{sessionId}/reset-timeout:
    put:
      tags:
      - SparkSession
      description: Sends a keep alive call to the current session to reset the session timeout.
      operationId: microsoftAzureSparksessionResetsparksessiontimeout
      x-ms-examples:
        Reset the session timeout.:
          $ref: ./examples/SparkFrontend_SparkSession_ResetTimeout.json
      parameters:
      - name: sessionId
        in: path
        description: Identifier for the session.
        required: true
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: Success
      summary: Microsoft Azure Put Sessions Sessionid Reset Timeout
  /sessions/{sessionId}/statements:
    get:
      tags:
      - SparkSession
      description: Gets a list of statements within a spark session.
      operationId: microsoftAzureSparksessionGetsparkstatements
      x-ms-examples:
        Gets a list of statements within a spark session.:
          $ref: ./examples/SparkFrontend_SparkSession_ListStatements.json
      parameters:
      - name: sessionId
        in: path
        description: Identifier for the session.
        required: true
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SparkStatementCollection'
      summary: Microsoft Azure Get Sessions Sessionid Statements
    post:
      tags:
      - SparkSession
      description: Create statement within a spark session.
      operationId: microsoftAzureSparksessionCreatesparkstatement
      x-ms-examples:
        Create statement within a spark session.:
          $ref: ./examples/SparkFrontend_SparkSession_CreateStatement.json
      parameters:
      - name: sessionId
        in: path
        description: Identifier for the session.
        required: true
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SparkStatement'
      summary: Microsoft Azure Post Sessions Sessionid Statements
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SparkStatementOptions'
        description: Livy compatible batch job request payload.
        required: true
  /sessions/{sessionId}/statements/{statementId}:
    get:
      tags:
      - SparkSession
      description: Gets a single statement within a spark session.
      operationId: microsoftAzureSparksessionGetsparkstatement
      x-ms-examples:
        Gets a single statement within a spark session.:
          $ref: ./examples/SparkFrontend_SparkSession_GetStatement.json
      parameters:
      - name: sessionId
        in: path
        description: Identifier for the session.
        required: true
        schema:
          type: integer
          format: int32
      - name: statementId
        in: path
        description: Identifier for the statement.
        required: true
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SparkStatement'
      summary: Microsoft Azure Get Sessions Sessionid Statements Statementid
  /sessions/{sessionId}/statements/{statementId}/cancel:
    post:
      tags:
      - SparkSession
      description: Kill a statement within a session.
      operationId: microsoftAzureSparksessionCancelsparkstatement
      x-ms-examples:
        Kill a statement within a session.:
          $ref: ./examples/SparkFrontend_SparkSession_DeleteStatement.json
      parameters:
      - name: sessionId
        in: path
        description: Identifier for the session.
        required: true
        schema:
          type: integer
          format: int32
      - name: statementId
        in: path
        description: Identifier for the statement.
        required: true
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SparkStatementCancellationResult'
      summary: Microsoft Azure Post Sessions Sessionid Statements Statementid Cancel
components:
  schemas:
    SparkStatement:
      type: object
      properties:
        id:
          format: int32
          type: integer
        code:
          type: string
        state:
          type: string
        output:
          $ref: '#/components/schemas/SparkStatementOutput'
      required:
      - id
    SparkStatementOptions:
      type: object
      properties:
        code:
          type: string
        kind:
          enum:
          - spark
          - pyspark
          - dotnetspark
          - sql
          x-ms-enum:
            name: SparkStatementLanguageType
            modelAsString: true
            values:
            - name: Spark
              value: spark
            - name: PySpark
              value: pyspark
            - name: DotNetSpark
              value: dotnetspark
            - name: Sql
              value: sql
          type: string
    SparkServiceError:
      type: object
      properties:
        message:
          type: string
        errorCode:
          type: string
        source:
          enum:
          - System
          - User
          - Unknown
          - Dependency
          x-ms-enum:
            name: SparkErrorSource
            modelAsString: true
          type: string
    SparkStatementCollection:
      type: object
      properties:
        total_statements:
          x-ms-client-name: total
          format: int32
          type: integer
        statements:
          uniqueItems: false
          type: array
          items:
            $ref: '#/components/schemas/SparkStatement'
      required:
      - total_statements
    SparkSessionState:
      type: object
      properties:
        notStartedAt:
          format: date-time
          type:
          - string
          - 'null'
        startingAt:
          format: date-time
          type:
          - string
          - 'null'
        idleAt:
          format: date-time
          type:
          - string
          - 'null'
        deadAt:
          format: date-time
          type:
          - string
          - 'null'
        shuttingDownAt:
          format: date-time
          type:
          - string
          - 'null'
        killedAt:
          x-ms-client-name: terminatedAt
          format: date-time
          type:
          - string
          - 'null'
        recoveringAt:
          format: date-time
          type:
          - string
          - 'null'
        busyAt:
          format: date-time
          type:
          - string
          - 'null'
        errorAt:
          format: date-time
          type:
          - string
          - 'null'
        currentState:
          type: string
        jobCreationRequest:
          $ref: '#/components/schemas/SparkRequest'
    SparkSession:
      type: object
      properties:
        livyInfo:
          $ref: '#/components/schemas/SparkSessionState'
        name:
          type: string
        workspaceName:
          type: string
        sparkPoolName:
          type: string
        submitterName:
          type: string
        submitterId:
          type: string
        artifactId:
          type: string
        jobType:
          enum:
          - SparkBatch
          - SparkSession
          x-ms-enum:
            name: SparkJobType
            modelAsString: true
          type: string
        result:
          enum:
          - Uncertain
          - Succeeded
          - Failed
          - Cancelled
          x-ms-enum:
            name: SparkSessionResultType
            modelAsString: true
          type: string
        schedulerInfo:
          x-ms-client-name: scheduler
          $ref: '#/components/schemas/SparkScheduler'
        pluginInfo:
          x-ms-client-name: plugin
          $ref: '#/components/schemas/SparkServicePlugin'
        errorInfo:
          x-ms-client-name: errors
          uniqueItems: false
          type: array
          items:
            $ref: '#/components/schemas/SparkServiceError'
        tags:
          type: object
          additionalProperties:
            type: string
        id:
          format: int32
          type: integer
        appId:
          type:
          - string
          - 'null'
        appInfo:
          type:
          - object
          - 'null'
          additionalProperties:
            type: string
        state:
          type: string
        log:
          x-ms-client-name: logLines
          uniqueItems: false
          type:
          - array
          - 'null'
          items:
            type: string
      required:
      - id
    SparkStatementCancellationResult:
      type: object
      properties:
        msg:
          type: string
          x-ms-client-name: message
          description: The msg property from the Livy API. The value is always "canceled".
    SparkStatementOutput:
      type: object
      properties:
        status:
          type: string
        execution_count:
          format: int32
          type: integer
        data:
          type: object
        ename:
          x-ms-client-name: errorName
          type:
          - string
          - 'null'
        evalue:
          x-ms-client-name: errorValue
          type:
          - string
          - 'null'
        traceback:
          uniqueItems: false
          type:
          - array
          - 'null'
          items:
            type: string
      required:
      - execution_count
    SparkSessionCollection:
      type: object
      properties:
        from:
          format: int32
          type: integer
        total:
          format: int32
          type: integer
        sessions:
          uniqueItems: false
          type: array
          items:
            $ref: '#/components/schemas/SparkSession'
      required:
      - from
      - total
    SparkServicePlugin:
      type: object
      properties:
        preparationStartedAt:
          format: date-time
          type:
          - string
          - 'null'
        resourceAcquisitionStartedAt:
          format: date-time
          type:
          - string
          - 'null'
        submissionStartedAt:
          format: date-time
          type:
          - string
          - 'null'
        monitoringStartedAt:
          format: date-time
          type:
          - string
          - 'null'
        cleanupStartedAt:
          format: date-time
          type:
          - string
          - 'null'
        currentState:
          enum:
          - Preparation
          - ResourceAcquisition
          - Queued
          - Submission
          - Monitoring
          - Cleanup
          - Ended
          x-ms-enum:
            name: PluginCurrentState
            modelAsString: true
          type: string
    SparkSessionOptions:
      type: object
      properties:
        tags:
          type: object
          additionalProperties:
            type: string
        artifactId:
          type: string
        name:
          type: string
        file:
          type: string
        className:
          type: string
        args:
          x-ms-client-name: arguments
          uniqueItems: false
          type: array
          items:
            type: string
        jars:
          uniqueItems: false
          type: array
          items:
            type: string
        pyFiles:
          x-ms-client-name: pythonFiles
          uniqueItems: false
          type: array
          items:
            type: string
        files:
          uniqueItems: false
          type: array
          items:
            type: string
        archives:
          uniqueItems: false
          type: array
          items:
            type: string
        conf:
          x-ms-client-name: configuration
          type: object
          additionalProperties:
            type: string
        driverMemory:
          type: string
        driverCores:
          format: int32
          type: integer
        executorMemory:
          type: string
        executorCores:
          format: int32
          type: integer
        numExecutors:
          x-ms-client-name: executorCount
          format: int32
          type: integer
      required:
      - name
    SparkScheduler:
      type: object
      properties:
        submittedAt:
          format: date-time
          type:
          - string
          - 'null'
        scheduledAt:
          format: date-time
          type:
          - string
          - 'null'
        endedAt:
          format: date-time
          type:
          - string
          - 'null'
        cancellationRequestedAt:
          format: date-time
          type:
          - string
          - 'null'
        currentState:
          enum:
          - Queued
          - Scheduled
          - Ended
          x-ms-enum:
            name: SchedulerCurrentState
            modelAsString: true
          type: string
    SparkRequest:
      type: object
      properties:
        name:
          type: string
        file:
          type: string
        className:
          type: string
        args:
          x-ms-client-name: arguments
          uniqueItems: false
          type: array
          items:
            type: string
        jars:
          uniqueItems: false
          type: array
          items:
            type: string
        pyFiles:
          x-ms-client-name: pythonFiles
          uniqueItems: false
          type: array
          items:
            type: string
        files:
          uniqueItems: false
          type: array
          items:
            type: string
        archives:
          uniqueItems: false
          type: array
          items:
            type: string
        conf:
          x-ms-client-name: configuration
          type: object
          additionalProperties:
            type: string
        driverMemory:
          type: string
        driverCores:
          format: int32
          type: integer
        executorMemory:
          type: string
        executorCores:
          format: int32
          type: integer
        numExecutors:
          x-ms-client-name: executorCount
          format: int32
          type: integer
x-ms-parameterized-host:
  hostTemplate: '{endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}'
  useSchemePrefix: false
  parameters:
  - $ref: '#/components/parameters/Endpoint'
  - $ref: '#/components/parameters/LivyApiVersion'
  - $ref: '#/components/parameters/SparkPoolName'