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

# Resume workflow after async task

> Registers an asynchronous task's result ID to resume a workflow run upon its completion. This endpoint requires an ExecuteStepRequestContext with `workflowRunId` and `stepAddr`.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/samplehc/openapi.documented.yml post /api/v2/workflow-runs/resume-when-complete
openapi: 3.0.3
info:
  title: Sample Healthcare API
  description: API for Sample Healthcare
  version: 1.0.0
servers: []
security: []
paths:
  /api/v2/workflow-runs/resume-when-complete:
    post:
      tags:
        - Workflow-run
      summary: Resume workflow after async task
      description: >-
        Registers an asynchronous task's result ID to resume a workflow run upon
        its completion. This endpoint requires an ExecuteStepRequestContext with
        `workflowRunId` and `stepAddr`.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                asyncResultId:
                  type: string
                  description: >-
                    The unique identifier of the asynchronous result to monitor
                    before resuming.
                priority:
                  type: string
                  enum:
                    - interactive
                    - background
                  default: background
                  description: >-
                    Queue priority for the resume request. Use 'interactive' to
                    resume sooner for user-visible workflows. Defaults to
                    'background'.
              required:
                - asyncResultId
              additionalProperties: false
        required: true
      responses:
        '202':
          description: Request accepted, processing to resume workflow has been initiated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: >-
                      A message indicating the request has been accepted for
                      processing.
                required:
                  - message
                additionalProperties: false
        '400':
          description: >-
            Bad request, e.g., missing required context parameters, invalid
            asyncResultId, or malformed body.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '500':
          description: Internal server error, e.g., failed to add to the queue.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from samplehc import SampleHealthcare

            client = SampleHealthcare(
                api_key=os.environ.get("SAMPLEHC_API_KEY"),  # This is the default and can be omitted
            )
            response = client.v2.workflow_runs.resume_when_complete(
                async_result_id="asyncResultId",
            )
            print(response.message)

````