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

# Update task status

> Transition a task to a terminal state. Only `status` is mutable in v1.
Allowed transitions: `pending → {completed, dismissed, cancelled}`.
Tasks in any terminal state return 409 (no further transitions).
`dismiss_reason` is required when `status: dismissed`.




## OpenAPI

````yaml https://app.hockeystack.com/api/revenue-agents/v1/openapi.json patch /tasks/{taskId}
openapi: 3.1.0
info:
  title: HockeyStack Revenue Agents API
  version: v1
  description: |
    Headless HTTP API for HockeyStack Revenue Agents.

    Auth: Bearer ApiToken (`hsr_live_<hex>`) in the Authorization header.
  contact:
    name: HockeyStack Support
    email: support@hockeystack.com
servers:
  - url: https://app.hockeystack.com/api/revenue-agents/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Service
    description: Health checks and token introspection.
  - name: Agents
    description: Deal- and company-agent lifecycle.
  - name: Conversations
    description: >
      Send messages to a deal or company agent. Two transports:


      - **REST blocking (default):** request returns when the agent finishes.
      Response shape: `{ conversation_id, messages: [...] }`.

      - **SSE streaming:** opt in via `Accept: text/event-stream` header or `{
      stream: true }` body field. Events emitted:
        - `text_delta { content }` — incremental assistant tokens
        - `tool_use { id, tool_name }` — agent is calling a tool
        - `tool_result { id }` — tool finished (return value not exposed in v1)
        - `done { conversation_id, messages }` — final state, same shape as REST response
        - `error { code, category, message }` — failure
  - name: Tasks
    description: |
      Agent-generated and manually-created tasks. Public status enum:
      `pending | completed | dismissed | cancelled`. Additional internal
      states are not exposed.
  - name: Credits
    description: |
      Workspace credit usage and limit state. There is no pre-paid balance pool
      to draw down — the model is a per-month usage counter against an included
      bundle plus an optional on-demand cap. Use these endpoints to detect
      approaching spend caps before hitting a 503.
paths:
  /tasks/{taskId}:
    parameters:
      - $ref: '#/components/parameters/TaskId'
    patch:
      tags:
        - Tasks
      summary: Update task status
      description: |
        Transition a task to a terminal state. Only `status` is mutable in v1.
        Allowed transitions: `pending → {completed, dismissed, cancelled}`.
        Tasks in any terminal state return 409 (no further transitions).
        `dismiss_reason` is required when `status: dismissed`.
      operationId: patchTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchTaskBody'
      responses:
        '200':
          description: Updated task.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Task'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: Task is in a terminal state and cannot transition.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Missing required field for this transition (e.g. dismiss_reason).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/Unavailable'
components:
  parameters:
    TaskId:
      name: taskId
      in: path
      required: true
      description: Task UUID.
      schema:
        type: string
        pattern: >-
          ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
  schemas:
    PatchTaskBody:
      type: object
      required:
        - status
      properties:
        status:
          type: string
          enum:
            - completed
            - dismissed
            - cancelled
        dismiss_reason:
          type: string
          maxLength: 2000
          description: Required when status is `dismissed`. Otherwise ignored.
    Task:
      type: object
      required:
        - task_id
        - status
      properties:
        task_id:
          type: string
          format: uuid
        task_type:
          type:
            - string
            - 'null'
          description: |
            Task type. Canonical values: `call`, `email`, `linkedin`. Other
            non-canonical values may appear on older rows; `draft` is only
            populated for canonical types.
        task_title:
          type:
            - string
            - 'null'
        status:
          type: string
          enum:
            - pending
            - completed
            - dismissed
            - cancelled
        priority:
          type:
            - string
            - 'null'
          enum:
            - urgent
            - high
            - medium
            - low
            - null
        assignee_id:
          type:
            - string
            - 'null'
        agent_id:
          type:
            - string
            - 'null'
          description: >-
            ID of the agent that generated this task. Null for manually created
            tasks.
        targets:
          type: object
          description: Entities this task is about. All fields optional.
          properties:
            contact:
              oneOf:
                - type: 'null'
                - type: object
                  description: |
                    Denormalized contact snapshot at task creation time. The
                    task target is the contact identity (email + linkedin_url),
                    not a stable contact ID — contacts have no globally stable
                    identifier in the public API.
                  properties:
                    email:
                      type:
                        - string
                        - 'null'
                    linkedin_url:
                      type:
                        - string
                        - 'null'
                    phone_number:
                      type:
                        - string
                        - 'null'
                    name:
                      type:
                        - string
                        - 'null'
                    title:
                      type:
                        - string
                        - 'null'
            deal_id:
              type:
                - string
                - 'null'
            company_id:
              type:
                - string
                - 'null'
            meeting_id:
              type:
                - string
                - 'null'
        draft:
          oneOf:
            - type: 'null'
            - type: object
              description: Type-specific draft content. Shape varies by task_type.
              properties:
                talking_points:
                  type: array
                  items:
                    type: string
                  description: Present when task_type is `call`.
                subject:
                  type:
                    - string
                    - 'null'
                  description: Present when task_type is `email`.
                body:
                  type:
                    - string
                    - 'null'
                  description: Present when task_type is `email`.
                message:
                  type:
                    - string
                    - 'null'
                  description: Present when task_type is `linkedin`.
        reason:
          type:
            - string
            - 'null'
        due_date:
          type:
            - string
            - 'null'
          format: date-time
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
        completed_at:
          type:
            - string
            - 'null'
          format: date-time
        dismissed_at:
          type:
            - string
            - 'null'
          format: date-time
        dismiss_reason:
          type:
            - string
            - 'null'
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - category
            - message
            - request_id
          properties:
            code:
              type: string
              description: Stable error code. Never renamed or removed within /v1.
            category:
              type: string
              enum:
                - permanent
                - transient
                - rate_limited
              description: |
                `permanent` — fix the request.
                `transient` — retry with backoff.
                `rate_limited` — retry after the Retry-After header.
            message:
              type: string
              description: Human-readable English message. Wording may change.
            request_id:
              type: string
              description: Trace ID for support tickets. Same as X-Request-Id header.
            details:
              type: object
              description: Code-specific structured data.
  responses:
    BadRequest:
      description: Validation failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            tokenMissing:
              value:
                error:
                  code: auth.token_missing
                  category: permanent
                  message: 'Missing Authorization: Bearer <token> header.'
                  request_id: req_abc
            tokenInvalid:
              value:
                error:
                  code: auth.token_invalid
                  category: permanent
                  message: API token is invalid, expired, or revoked.
                  request_id: req_abc
    NotFound:
      description: Resource (deal, agent, conversation) does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Per-token or per-IP rate limit exceeded.
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
        X-RateLimit-Pool:
          $ref: '#/components/headers/RateLimitPool'
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/RateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/RateLimitReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unavailable:
      description: An upstream dependency is unavailable.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  headers:
    RetryAfter:
      description: Seconds until retry is allowed.
      schema:
        type: integer
    RateLimitPool:
      description: Pool that consumed a point for this request (`read` or `write`).
      schema:
        type: string
        enum:
          - read
          - write
    RateLimitLimit:
      description: Maximum requests allowed in the current window for this pool.
      schema:
        type: integer
    RateLimitRemaining:
      description: Requests remaining in the current window.
      schema:
        type: integer
    RateLimitReset:
      description: Unix timestamp when the bucket refills.
      schema:
        type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: hsr_live

````