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

# Execute Tool

> Executes a tool against its configured third-party API using the supplied placeholder values. Auth credentials are resolved automatically; specify authId to select specific credentials when multiple exist. Returns the raw response from the external API including status code, headers, and body.



## OpenAPI

````yaml post /v1/integrations/{integrationId}/tools/{toolId}/execute
openapi: 3.0.1
info:
  title: SigmaMind APIs
  description: OpenAPI documentation SigmaMind Agent Builder APIs
  version: '1.0'
servers:
  - url: https://api.sigmamind.ai
    description: SigmaMind AI Agent Builder APIs
security:
  - apiKeyAuth: []
tags:
  - name: Chats
    description: >-
      Endpoints for creating and managing text-based chat sessions with an
      agent. A session is started by specifying an agent and an opening message.
      Returns a chatId used in all subsequent get, update, completion, and
      end-session calls.
  - name: Calls
    description: >-
      Endpoints for creating and managing outbound phone calls. A call is
      initiated by specifying an agent, caller number, and destination number —
      dynamic variables can be included to personalise the agent's behaviour.
      Returns a callId used in all subsequent get and delete operations.
  - name: Phone Numbers
    description: >-
      Endpoints for managing phone numbers used in outbound and inbound calls.
      Supports purchasing a new number through SigmaMind or importing an
      existing number via SIP trunking (BYO). Each number can be assigned
      separate inbound and outbound agents.
  - name: Campaigns
    description: >-
      Endpoints for creating and managing outbound call campaigns. A campaign
      dials a CSV-uploaded contact list using a selected agent and caller
      number, with support for immediate or scheduled launch. Returns a
      campaignId used in all subsequent get, update, and delete operations.
  - name: Agents
    description: >-
      Endpoints for creating and managing single prompt agents. An agent is
      configured with a system prompt, voice settings, and optional tools.
      Returns an agentId used in all subsequent update, call, and simulation
      operations.
  - name: Integrations
    description: >-
      Endpoints for creating and managing third-party integrations (e.g.
      Shopify, Cal.com). An integration links your account to an external
      service and acts as the parent resource for auth credentials and API
      tools. Returns an integrationId used in all subsequent auth and tool
      operations.
  - name: Integration Auth
    description: >-
      Endpoints for managing authentication credentials for a third-party
      integration. Supports API Key, Basic, and Bearer token credential types —
      scoped to an integration and injected automatically by tools when
      executing. Returns an authId used in all subsequent get, update, and
      delete operations.
  - name: Integration Tools
    description: >-
      Endpoints for creating and managing API tools backed by a third-party
      integration. Each tool defines an HTTP endpoint, method, and parameter
      schema — scoped to an integration and using its stored auth credentials
      when executing. Returns a toolId used in all subsequent get, update,
      delete, and execute operations.
  - name: Webhooks
    description: >-
      Endpoints for registering and managing webhooks. A webhook delivers
      real-time event notifications via HTTP POST when selected events occur on
      a specific agent — each webhook is scoped to one agent and one or more
      event types. Payloads are signed with an HMAC secret — verify the
      signature on your server to confirm authenticity.
  - name: Test Cases
    description: >-
      Endpoints for creating and managing simulation test cases for an agent. A
      test case defines a conversation scenario — including user persona, goals,
      and expected behaviour — used to generate a synthetic conversation with
      the agent. Returns a testCaseId used in all subsequent get, update,
      delete, and batch-run operations.
  - name: Batch Runs
    description: >-
      Endpoints for creating and managing batch runs of simulation test cases. A
      batch run executes multiple test cases in parallel against a selected
      agent and aggregates the results for review. Returns a batchId used in all
      subsequent get and list test-run operations.
  - name: Test Runs
    description: >-
      Endpoints for retrieving test run results within a batch. Each test run
      represents a single test case execution within a batch run, identified by
      a jobId. Use batchId and agentId to scope results to the correct batch.
  - name: API Keys
    description: >-
      Endpoints for creating and managing API keys used to authenticate public
      API requests. Each key must be included in the X-API-Key request header.
      Returns a keyId used in all subsequent get, revoke, and delete operations.
  - name: QA Rules
    description: >-
      Endpoints for creating and managing quality assurance rules applied to
      agent conversations. A QA rule defines evaluation criteria used to
      automatically assess conversation quality. Returns a qaRuleId used in all
      subsequent get, update,  and delete operations.
  - name: QA Issues
    description: >-
      Endpoints for retrieving and managing quality assurance issues flagged
      across agent conversations. A QA issue is created with status 'Fail' when
      a conversation violates one or more QA rules — capturing the offending
      rule reference. It is created with status 'Success' when the conversation
      passes the evaluation criteria of QA rule(s). Returns a qaIssueId used in
      all subsequent get operations.
paths:
  /v1/integrations/{integrationId}/tools/{toolId}/execute:
    post:
      tags:
        - Integration Tools
      summary: Execute Tool
      description: >-
        Executes a tool against its configured third-party API using the
        supplied placeholder values. Auth credentials are resolved
        automatically; specify authId to select specific credentials when
        multiple exist. Returns the raw response from the external API including
        status code, headers, and body.
      operationId: executeIntegrationTool
      parameters:
        - name: integrationId
          in: path
          description: Unique identifier of the integration to which the tool belongs.
          required: true
          schema:
            type: string
          example: intg_AuUKK371Spr5
        - name: toolId
          in: path
          description: Unique identifier of the tool to execute.
          required: true
          schema:
            type: string
          example: tool_X9pLm2Wq8Rt3
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecuteToolRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecuteToolResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Bad Request
                    message: Invalid request parameters
                    path: /v1/integrations/{integrationId}/tools
                    status: 400
                    timestamp: '2026-05-05T10:06:45.801Z'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Unauthorized
                    message: X-API-Key is missing or invalid
                    path: /v1/integrations/{integrationId}/tools
                    status: 401
                    timestamp: '2026-05-05T10:06:45.801Z'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Forbidden
                    message: Access denied for this resource
                    path: /v1/integrations/{integrationId}/tools
                    status: 403
                    timestamp: '2026-05-05T10:06:45.801Z'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Not Found
                    message: The requested resource was not found
                    path: /v1/integrations/{integrationId}/tools
                    status: 404
                    timestamp: '2026-05-05T10:06:45.801Z'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Internal Server Error
                    message: Unexpected server error
                    path: /v1/integrations/{integrationId}/tools
                    status: 500
                    timestamp: '2026-05-05T10:06:45.801Z'
components:
  schemas:
    ExecuteToolRequest:
      type: object
      properties:
        placeholders:
          type: object
          description: >-
            A map of placeholder names to values used to resolve {{placeholder}}
            tokens in the tool's endpoint URL, query parameters, and request
            body at runtime. Each placeholder used in the request must have a
            corresponding entry in this map. Example: for endpoint
            '/customers/{{customerId}}.json', provide {"customerId": "7654321"}.
          example:
            customerId: '7654321'
        authId:
          maxLength: 64
          minLength: 0
          type: string
          description: 'The authId of the credential set to use for this execution. '
          example: auth_P3kNz7Yv1Qm9
      description: >-
        Request body to execute a tool against its configured third-party API.
        Supply values for every {{variable}} placeholder declared in the tool's
        endpoint, queryParams, and bodyParams. The tool's stored auth
        credentials are resolved automatically — you do not need to pass
        credentials here.
    ExecuteToolResponse:
      type: object
      properties:
        toolId:
          type: string
          description: Unique identifier of the tool that was executed.
          example: tool_X9pLm2Wq8Rt3
        integrationId:
          type: string
          description: Unique identifier of the integration this tool belongs to.
          example: intg_AuUKK371Spr5
        url:
          type: string
          description: >-
            The fully resolved URL that was called, with all {{variable}}
            placeholders substituted.
          example: >-
            https://my-store.myshopify.com/admin/api/2024-01/customers/7654321.json
        method:
          type: string
          description: The HTTP method used for the request.
          example: GET
        statusCode:
          type: integer
          description: HTTP status code returned by the third-party API.
          format: int32
          example: 200
        success:
          type: boolean
          description: Whether the third-party API returned a 2xx success response.
          example: true
        responseBody:
          $ref: '#/components/schemas/JsonNode'
        responseHeaders:
          type: object
          description: Response headers returned by the third-party API.
          example:
            Content-Type: application/json; charset=utf-8
        errorMessage:
          type: string
          description: >-
            Error message when success is false — contains the raw error body or
            exception message.
          example: '404 Not Found: {"errors": "Customer not found"}'
        durationMs:
          type: integer
          description: How long the third-party API took to respond, in milliseconds.
          format: int64
          example: 342
        executedAt:
          type: string
          description: Timestamp when the execution was triggered.
          format: date-time
          example: '2024-04-20T10:00:00.000Z'
      description: Result of executing a tool against its configured third-party API.
    Error:
      type: object
      properties:
        timestamp:
          type: string
          description: Error timestamp in ISO format
          format: date-time
        status:
          type: integer
          description: HTTP status code
          example: 400
        error:
          type: string
          description: Error type or HTTP status message
          example: Bad Request
        message:
          type: string
          description: Detailed error message
          example: Email is required
        path:
          type: string
          description: Request path where error occurred
          example: /v1/users
        validationErrors:
          type: object
          description: Field validation errors (if any)
          example: |-
            {
              "email": "Email is required",
              "name": "Name is too short"
            }
      description: Standard error response
    JsonNode:
      type: object
      description: >-
        Dynamic key-value pairs that were passed to the agent at call start for
        personalisation. Keys correspond to variable names defined in the
        agent's configuration (e.g., 'customer_name', 'account_id'). Null or
        empty if no dynamic variables were provided when the call was created.
      example:
        customer_name: Michael
        account_id: ACC-001
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      description: >-
        Authenticate every request by passing your API key in the `X-API-Key`
        header. To get your key, go to Dashboard → API Keys and create or copy
        your Production API key.
      name: X-API-Key
      in: header

````