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

# Run Task



## OpenAPI

````yaml https://app.usequanta.com/openapi/quanta-services-api/openapi.json post /admin_api/tasks/{occurrence_qid}/run
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://app.usequanta.com
    description: Production
security:
  - HTTPBearer: []
paths:
  /admin_api/tasks/{occurrence_qid}/run:
    post:
      tags:
        - tasks
        - quanta-services-api
      summary: Run Task
      operationId: runTask
      parameters:
        - name: occurrence_qid
          in: path
          required: true
          schema:
            type: string
            title: Occurrence Qid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RunTaskRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRunResponse'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    RunTaskRequest:
      properties:
        client_request_id:
          type: string
          maxLength: 200
          minLength: 1
          title: Client Request Id
        instruction:
          anyOf:
            - type: string
            - type: 'null'
          title: Instruction
        reason:
          anyOf:
            - type: string
              maxLength: 500
              minLength: 1
            - type: 'null'
          title: Reason
        excluded_document_hashes:
          items:
            type: string
          type: array
          title: Excluded Document Hashes
        input_contexts:
          items:
            $ref: '#/components/schemas/TaskInputContext'
          type: array
          maxItems: 50
          title: Input Contexts
        removed_input_context_keys:
          items:
            type: string
          type: array
          maxItems: 50
          title: Removed Input Context Keys
      additionalProperties: false
      type: object
      required:
        - client_request_id
      title: RunTaskRequest
    TaskRunResponse:
      properties:
        run_qid:
          type: string
          title: Run Qid
        replayed:
          type: boolean
          title: Replayed
      type: object
      required:
        - run_qid
        - replayed
      title: TaskRunResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TaskInputContext:
      properties:
        decision_key:
          type: string
          maxLength: 200
          title: Decision Key
        label:
          type: string
          maxLength: 500
          title: Label
        context:
          type: string
          maxLength: 5000
          title: Context
          default: ''
        related_records:
          items:
            $ref: '#/components/schemas/TaskInputRelatedRecord'
          type: array
          maxItems: 50
          title: Related Records
      additionalProperties: false
      type: object
      required:
        - decision_key
        - label
      title: TaskInputContext
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    TaskInputRelatedRecord:
      properties:
        qid:
          type: string
          maxLength: 200
          title: Qid
        kind:
          type: string
          maxLength: 100
          title: Kind
        label:
          anyOf:
            - type: string
              maxLength: 500
            - type: 'null'
          title: Label
      additionalProperties: false
      type: object
      required:
        - qid
        - kind
      title: TaskInputRelatedRecord
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Quanta Services API scoped bearer token. Supported only on Services API
        routes.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.