Mabl Database Query Execution API

The DatabaseQueryExecution API from Mabl — 3 operation(s) for databasequeryexecution.

Business capability
Software Quality Engineering BC-4200.50

Operations 4

POST /database/queryExecution Execute a database query #
GET /database/queryExecution/{id} Get database query execution details by ID #
PATCH /database/queryExecution/{id} Update the DatabaseQueryExecution #
POST /database/query/generated Create database query with assertions and variables #

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/mabl:mabl-databasequeryexecution-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. See our Privacy Policy and Terms.

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

OpenAPI Specification

mabl-databasequeryexecution-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: mabl Database Query Execution API
  description: APIs for interacting with mabl services
  version: 0.599.3.1792436330
  x-readme-id: 62c896636916ce01d2ff4f5a
servers:
- url: /
security:
- basicAuth: []
- bearerAuth: []
tags:
- name: DatabaseQueryExecution
paths:
  /database/queryExecution:
    post:
      tags:
      - DatabaseQueryExecution
      summary: Execute a database query
      description: Execute a database query and return the created entity
      operationId: runDatabaseQuery
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatabaseQueryExecution'
        required: true
      responses:
        '202':
          description: Database query executed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatabaseQueryExecution'
        '400':
          $ref: '#/components/responses/ErrorResponse400'
        '401':
          $ref: '#/components/responses/ErrorResponse401'
        '403':
          $ref: '#/components/responses/ErrorResponse403'
        default:
          $ref: '#/components/responses/ErrorResponse'
      x-mabl-action: Run::DatabaseQuery
  /database/queryExecution/{id}:
    get:
      tags:
      - DatabaseQueryExecution
      summary: Get database query execution details by ID
      description: Get database query execution details and results URI
      operationId: getQueryExecution
      parameters:
      - name: id
        in: path
        required: true
        style: simple
        explode: false
        schema:
          type: string
      responses:
        '200':
          description: Database execution details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatabaseQueryExecution'
        '401':
          $ref: '#/components/responses/ErrorResponse401'
        '403':
          $ref: '#/components/responses/ErrorResponse403'
        '404':
          $ref: '#/components/responses/ErrorResponse404'
        default:
          $ref: '#/components/responses/ErrorResponse'
      x-mabl-action: Read::DatabaseQuery
    patch:
      tags:
      - DatabaseQueryExecution
      summary: Update the DatabaseQueryExecution
      operationId: updateQueryExecution
      parameters:
      - name: id
        in: path
        description: Database query execution ID
        required: true
        style: simple
        explode: false
        schema:
          type: string
      - name: If-Match
        in: header
        description: If-Match header according to http/1.1 spec section 14.24
        required: false
        style: simple
        explode: false
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatabaseQueryExecution'
        required: true
      responses:
        '200':
          description: The updated query execution details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatabaseQueryExecution'
        '400':
          $ref: '#/components/responses/ErrorResponse400'
        '401':
          $ref: '#/components/responses/ErrorResponse401'
        '403':
          $ref: '#/components/responses/ErrorResponse403'
        '404':
          $ref: '#/components/responses/ErrorResponse404'
        default:
          $ref: '#/components/responses/ErrorResponse'
      x-mabl-action: Edit::DatabaseQuery
  /database/query/generated:
    post:
      tags:
      - DatabaseQueryExecution
      summary: Create database query with assertions and variables
      operationId: generateDatabaseQuery
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateQueryRequest'
        required: true
      responses:
        '200':
          description: The generated DatabaseQueryExecution entity for the requested execution
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateQueryResult'
        '400':
          $ref: '#/components/responses/ErrorResponse400'
        '401':
          $ref: '#/components/responses/ErrorResponse401'
        '403':
          $ref: '#/components/responses/ErrorResponse403'
        default:
          $ref: '#/components/responses/ErrorResponse'
      x-mabl-action: Run::AiGeneration
components:
  schemas:
    GenerateCodeResult:
      type: object
      properties:
        body:
          type: string
          description: The code generated by the AI model
        description:
          type: string
          description: An optional extended description field for the generated result
        prompt_id:
          type: string
          description: The id of the prompt request
        session_id:
          type: string
          description: The session id for the prompt
        success:
          type: boolean
          description: Indicates if the code generation was successful
        title:
          type: string
          description: A brief description of the generated code result
        user_id:
          type: string
          description: The id of the user asking for the prompt
        workspace_id:
          type: string
          description: The workspace id
      description: Code generator result
    DatabaseQueryExecution:
      type: object
      properties:
        id:
          type: string
          description: DatabaseQueryExecution ID
        workspace_id:
          type: string
          description: Workspace ID
        database_connection_id:
          type: string
          description: Database connection ID
        environment_id:
          type: string
          description: Environment ID
        execution_command:
          $ref: '#/components/schemas/DatabaseExecutionCommand'
        snippet_id:
          type: string
          description: ID of reusable SQL query to execute
        query:
          type: string
          description: Base64 encoded SQL query to execute
        query_parameters:
          type: array
          description: Runtime query parameters to apply
          items:
            $ref: '#/components/schemas/DatabaseQueryParameter'
        status:
          type: string
          description: Current status of query execution
          enum:
          - scheduled
          - running
          - complete
          - failure
        results_metadata:
          $ref: '#/components/schemas/DatabaseQueryResultMetadata'
        results_uri:
          type: string
          description: GCS storage bucket location of the query results
        test_context_id:
          type: string
          description: The test run id if the query is being executed during a cloud run or the user's id for a local run
        test_run_id:
          type: string
          description: 'The test run executing this query, when there is one. A run that opted into use_personal_link_agent routes the query through the calling user''s personal Link tunnels, as it does the run''s other traffic.

            '
        created_time:
          type: integer
          format: int64
        created_by_id:
          type: string
        last_updated_time:
          type: integer
          format: int64
        last_updated_by_id:
          type: string
        completed_time:
          type: integer
          format: int64
      x-implements-interface:
      - ActivityTrackingBaseEntity
      - HasId
      - HasWorkspaceId
    DatabaseQueryResultMetadata:
      type: object
      properties:
        status:
          type: string
          description: Query results status
          enum:
          - success
          - failed
          - error
        duration:
          type: integer
          description: Duration of query in milliseconds
        message:
          type: string
          description: Message returned from database on a successful query, if any
        error_message:
          type: string
          description: Error message returned from database query, if any
        row_count:
          type: integer
          description: Row count in result set
        column_count:
          type: integer
          description: Columns count in result set
        rows_affected:
          type: integer
          description: Count of rows affacted count by query
        additional_properties:
          type: object
          description: Key value map for additional properties
    SnippetTypeEnum:
      type: string
      enum:
      - css
      - javascript
      - xpath
      - sql
      - postman
    GuardrailApprovalKind:
      type: string
      description: Who decides a guardrail approval. SELF is decided by the person the agent acts for; WORKSPACE, for an agent acting for an API key, by a workspace owner or editor.
      enum:
      - SELF
      - WORKSPACE
    GeneratedQueryParameter:
      type: object
      properties:
        name:
          type: string
          description: Parameter name
        value:
          type: string
          description: Parameter value
      description: Parameter passed to the DatabaseQueryExecution as an argument
    TestTypeEnum:
      type: string
      description: Type of test
      enum:
      - api
      - browser
      - performance
      - mobile
      - desktop
      x-mabl-scope: public
    GenerateQueryResult:
      allOf:
      - $ref: '#/components/schemas/GenerateCodeResult'
      - type: object
        properties:
          query:
            type: string
            description: Generated SQL query
          nosql_operation:
            type: object
            description: Generated operation details for non-SQL query operations
          parameters:
            type: array
            description: Parameters for the generated query
            items:
              $ref: '#/components/schemas/GeneratedQueryParameter'
        description: Query generator result
    DatabaseExecutionCommand:
      type: string
      description: Command to run against database
      enum:
      - get_schema
      - test_connection
    GenerateCodeRequest:
      required:
      - workspace_id
      type: object
      properties:
        workspace_id:
          type: string
          description: The ID of the workspace that is requesting the code generation
        snippet_type:
          $ref: '#/components/schemas/SnippetTypeEnum'
        test_type:
          $ref: '#/components/schemas/TestTypeEnum'
        name:
          type: string
          description: The name of the snippet
        prompt:
          type: string
          description: Client provided prompt for code snippet generation
        additional_context:
          type: string
          description: Additional context for the code generation request
        parameters:
          type: array
          description: Snippet parameters supplied to the snippet
          items:
            $ref: '#/components/schemas/SnippetParameter'
        current_snippet:
          type: string
          description: The current snippet body for the code generation request
        session_id:
          type: string
          description: The session id for the prompt
        override:
          $ref: '#/components/schemas/GenAiOverrideOptions'
      description: Codegen request configurations
      x-implements-interface:
      - HasWorkspaceId
    GuardrailApprovalRef:
      type: object
      properties:
        id:
          type: string
          description: The approval's id.
        state:
          description: Where the approval stands.
          allOf:
          - $ref: '#/components/schemas/GuardrailApprovalState'
        kind:
          description: Who decides the approval.
          allOf:
          - $ref: '#/components/schemas/GuardrailApprovalKind'
        request_expires_time:
          type: integer
          description: When the approval expires if nobody decides it, in epoch milliseconds.
          format: int64
        url:
          type: string
          description: The mabl app page where a person reviews the approval.
      description: 'An approval a guardrail policy asks for. While it is PENDING, stop: give the person the url, tell them the request is waiting for approval, and do not repeat the request or poll in a loop. Once a person tells you it is APPROVED, repeat the identical request with the header X-Mabl-Approval set to id. DENIED means a person said no, so do not work around it.'
    SnippetParameter:
      required:
      - id
      - name
      type: object
      properties:
        id:
          type: string
          description: The ID of the parameter
        name:
          type: string
          description: The name of the parameter
        description:
          type: string
          description: The description of the parameter
        default_value:
          type: string
          description: The default value of the parameter
      description: A parameter passed to the snippet as an argument
    ErrorResponseGeneric:
      type: object
      properties:
        id:
          type: string
          x-mabl-scope: public
        code:
          maximum: 599
          minimum: 100
          type: integer
          format: int32
          x-mabl-scope: public
        message:
          type: string
          x-mabl-scope: public
        error_code:
          type: string
          description: Machine-readable reason for the error, present only when the API names one. Values are guardrail_blocked (a guardrail policy refused an agent request), approval_required (a guardrail policy requires a person to approve the request first).
        guardrail:
          description: The guardrail policy that refused the request; present only when error_code is guardrail_blocked or approval_required.
          allOf:
          - $ref: '#/components/schemas/GuardrailRefusal'
    GenAiOverrideOptions:
      type: object
      properties:
        model_id:
          type: string
          description: The model ID to use instead of the default model used by the endpoint
          readOnly: true
        meta_prompt:
          type: string
          description: The meta-prompt to use instead of the default used by the endpoint
          readOnly: true
        temperature:
          type: number
          description: The temperature to use instead of the default used by the endpoint
          format: float
          readOnly: true
    DatabaseType:
      type: string
      enum:
      - mariadb
      - mongodb
      - mssql
      - mysql
      - oracle
      - postgres
    GenerateQueryRequest:
      allOf:
      - $ref: '#/components/schemas/GenerateCodeRequest'
      - type: object
        properties:
          database_schema_query_execution_id:
            type: string
            description: ID of query result with the database schema
          database_type:
            $ref: '#/components/schemas/DatabaseType'
        description: Extension of GenerateCodeRequest for generating database queries
    GuardrailRefusal:
      type: object
      properties:
        id:
          type: string
          description: The id of the guardrail policy that decided the refusal.
        reason:
          type: string
          description: Why the policy refuses the request, written for the person the agent acts for.
        decision_id:
          type: string
          description: The id of this decision in the guardrail decision log.
        action:
          type: string
          description: The action the request was evaluated as, written Verb::Resource (for example Delete::Test), as declared by the operation's x-mabl-action extension.
        policy_source:
          type: string
          description: 'Who set the deciding policy: workspace for a rule the workspace''s owners wrote, account for a rule set for the workspace''s account, mabl_agent_type for the agent type''s ceiling, and mabl_default for mabl''s own defaults.'
        approval:
          description: The approval for this request; present when error_code is approval_required and the approval could be recorded. Without it the request cannot be approved.
          allOf:
          - $ref: '#/components/schemas/GuardrailApprovalRef'
      description: The guardrail policy that refused an agent request.
    GuardrailApprovalState:
      type: string
      description: Where a guardrail approval stands. PENDING awaits a decision and expires undecided after 24 hours; APPROVED lets the agent repeat the request, as often as it does, for 20 minutes; DENIED refuses the same request for 20 minutes after the decision, after which asking again opens a new approval; CANCELLED means a person withdrew it while pending or revoked it while approved. EXPIRED and CANCELLED are final.
      enum:
      - PENDING
      - APPROVED
      - DENIED
      - EXPIRED
      - CANCELLED
    DatabaseQueryParameter:
      type: object
      properties:
        id:
          type: string
          description: Parameter ID
        type:
          $ref: '#/components/schemas/DatabaseQueryParameterType'
        value:
          type: string
          description: String value of provided parameter
      description: Parameter passed to database query execution as an argument
    DatabaseQueryParameterType:
      type: string
      description: Parameter datatype. Defaults to string if not provided. (optional)
      enum:
      - String
      - Number
      - Boolean
  responses:
    ErrorResponse400:
      description: Invalid or missing parameter
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponseGeneric'
    ErrorResponse403:
      description: User not authorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponseGeneric'
    ErrorResponse:
      description: Unknown error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponseGeneric'
    ErrorResponse401:
      description: User not authenticated
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponseGeneric'
    ErrorResponse404:
      description: Entity not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponseGeneric'
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
    bearerAuth:
      type: apiKey
      name: Authorization
      in: header