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

# The WorkflowRun object

The WorkflowRun object is the core object of the WorkflowRun API.
It represents a single run of a workflow and contains all the information about the run, including the output data, the workflow that was run, and the status of the run.

<Expandable title="properties" defaultOpen>
  <ResponseField name="object" type="string">
    The type of the object, in this case it will always be "workflow\_run".
  </ResponseField>

  {" "}

  <ResponseField name="id" type="string">
    An ID corresponding to a specific File x Workflow combination representing the
    specific WorkflowRun for a File.
  </ResponseField>

  {" "}

  <ResponseField name="name" type="string">
    The name of the WorkflowRun. Autogenerated by Extend using fileName if not
    provided at creation time.
  </ResponseField>

  {" "}

  <ResponseField name="batchId" type="string">
    The batch ID of the WorkflowRun. If that WorkflowRun was created from a batch
    of files, all runs in that batch will have the same batch ID.
  </ResponseField>

  {" "}

  <ResponseField name="status" type="string">
    The status of a WorkflowRun. The options are "PENDING" (if the WorkflowRun is
    waiting to start execution), "PROCESSING" (if the WorkflowRun is currently running), "FAILED" (if the WorkflowRun failed), "NEEDS\_REVIEW" (if the
    WorkflowRun needs to be reviewed manually in the UI), "REVIEWED" (if the
    WorkflowRun has been manually reviewed and corrected), "PROCESSED" (if the
    WorkflowRun is fully processed.)
  </ResponseField>

  {" "}

  <ResponseField name="url" type="string">
    Unique URL that can be used to route to the WorkflowRun review experience in
    Extend.
  </ResponseField>

  {" "}

  <ResponseField name="metadata" type="any">
    The metadata that was passed in when running the Workflow.
  </ResponseField>

  {" "}

  <ResponseField name="initialRunAt" type="string">
    The time (in UTC) at which the workflow was initially run.
  </ResponseField>

  {" "}

  <ResponseField name="failureMessage" type="string">
    An optional field that will only be present if applicable. This will be the
    error message if the WorkflowRun failed.
  </ResponseField>

  {" "}

  <ResponseField name="reviewedBy" type="string">
    An optional field that will only be present if applicable. This will be the
    user ID of the person who reviewed the WorkflowRun.
  </ResponseField>

  {" "}

  <ResponseField name="reviewedAt" type="string">
    An optional field that will only be present if applicable. The time (in UTC)
    at which the WorkflowRun review step was completed.
  </ResponseField>

  {" "}

  <ResponseField name="startTime" type="string">
    The start time (in UTC) of the WorkflowRun.
  </ResponseField>

  {" "}

  <ResponseField name="endTime" type="string">
    An optional field that will only be present if applicable. The end time (in
    UTC) of the WorkflowRun.
  </ResponseField>

  <ResponseField name="files" type="File[]">
    The files that were processed in this WorkflowRun.

    See the [File object](/api-reference/objects/file) for more details.
  </ResponseField>

  <ResponseField name="outputs" type="DocumentProcessorRun[]">
    An array of DocumentProcessorRun objects corresponding to Extraction, Classification, and Instruct QA steps.
    This will contain the initial output, reviewed output, and final output of the DocumentProcessorRun.

    <Expandable title="properties">
      <ResponseField name="object" type="string">
        Type of the object, always 'document\_processor\_run'.
      </ResponseField>

      <ResponseField name="id" type="string">
        The unique identifier for the document processor run.
      </ResponseField>

      <ResponseField name="edited" type="boolean">
        Whether the document processor run has been edited.
      </ResponseField>

      <ResponseField name="edits" type="object">
        A hash of the edits (original + edited values + operator notes, if any) made to the document processor run. Values conform to the value types of the fields.
      </ResponseField>

      <ResponseField name="type" type="string">
        The type of the document processor run. Either `EXTRACT`, `CLASSIFY`, `SPLITTER`, or `INSTRUCT_QA`.
      </ResponseField>

      <ResponseField name="config" type="object">
        The config of the document processor run. The shape of output depends on the document processor `type`.
        Details for each can be found in the [Output and Config types page](/api-reference/guides/output_types).
      </ResponseField>

      <ResponseField name="initialOutput" type="object">
        The initial raw output from the document processor. This is always set.
        The shape of output depends on the document processor `type`.
        Details for each can be found in the [Output and Config types page](/api-reference/guides/output_types).
      </ResponseField>

      <ResponseField name="reviewedOutput" type="object" optional>
        An optional field that shows the output after review, if applicable.
        The shape of output depends on the document processor `type`.
        Details for each can be found in the [Output and Config types page](/api-reference/guides/output_types).
      </ResponseField>

      <ResponseField name="output" type="object">
        The final output, either reviewed or initial. You can rely on this to be always set as the final output (initial or post review when reviewed).
        The shape of output depends on the document processor `type`.
        Details for each can be found in the [Output and Config types page](/api-reference/guides/output_types).
      </ResponseField>
    </Expandable>
  </ResponseField>

  <ResponseField name="workflow" type="Workflow">
    The details about the Workflow that was used in this WorkflowRun.

    <Expandable title="properties">
      <ResponseField name="object" type="string">
        The type of response, in this case it will always be "workflow".
      </ResponseField>

      <ResponseField name="id" type="string">
        The unique identifier of the Workflow.
      </ResponseField>

      <ResponseField name="name" type="string">
        The name of the Workflow.
      </ResponseField>

      <ResponseField name="version" type="string">
        The version of the Workflow.
      </ResponseField>
    </Expandable>
  </ResponseField>

  <ResponseField name="stepRuns" type="WorkflowStepRun[]">
    An array of WorkflowStepRun objects.
    Each WorkflowStepRun represents a single run of a WorkflowStep and contains details about the step and the run's output.

    **Note:** This field currently supports [External Data Validation](/product-reference/external_validation) and Rule Validation step types.
    Document processor run outputs are included in the `outputs` field.

    <Expandable title="properties">
      <ResponseField name="object" type="string">
        The type of response, in this case it will always be "workflow\_step\_run".
      </ResponseField>

      <ResponseField name="id" type="string">
        The unique identifier of the WorkflowStepRun.
      </ResponseField>

      <ResponseField name="status" type="enum">
        The status of the WorkflowStepRun.

        One of: `PENDING`, `PROCESSING`, `PROCESSED`, `FAILED`
      </ResponseField>

      <ResponseField name="output" type="object">
        The output of the WorkflowStepRun.
        The shape of the output depends on the type of the WorkflowStep in the `step` field below.

        `EXTERNAL_DATA_VALIDATION`

        <Expandable title="properties">
          The output will be the same object that was returned by the external endpoint configured for this step.
        </Expandable>

        `RULE_VALIDATION`

        <Expandable title="properties">
          <ResponseField name="valid" type="boolean">
            Indicates whether the entire validation step passed. This field will only be `true` if every validation rule passed.
          </ResponseField>

          <ResponseField name="rules" type="object[]">
            <Expandable title="properties" defaultOpen="true">
              <ResponseField name="name" type="string">
                The name of the validation rule.
              </ResponseField>

              <ResponseField name="valid" type="boolean">
                Indicates whether this validation rule passed or not.
                This field will be `true` only if the formula evaluates to `true`.
                If the rule's formula is array valued, then this field will only be `true` if the formula evaluates to `true` for every item in the array.
              </ResponseField>

              <ResponseField name="validArray" type="string[]">
                Only present if the validation rule's formula is array valued. This field contains the formula's evaluated result for every item in the array.
              </ResponseField>

              <ResponseField name="failureReason" type="enum">
                If the validation rule is not valid, then this describes why the rule failed.

                `RULE_FAILED`: The formula evaluated to `false` or `null`.

                `PARSE_ERROR`: The formula could not be parsed.

                `VALUE_ERROR`: An error occurred while evaluating the formula.
              </ResponseField>

              <ResponseField name="error" type="string">
                If the `failureReason` is `PARSE_ERROR` or `VALUE_ERROR`, then this field contains the error's details.
              </ResponseField>
            </Expandable>
          </ResponseField>
        </Expandable>
      </ResponseField>

      <ResponseField name="step" type="WorkflowStep">
        A WorkflowStep object.

        <Expandable title="properties">
          <ResponseField name="object" type="string">
            The type of response, in this case it will always be "workflow\_step".
          </ResponseField>

          <ResponseField name="id" type="string">
            The unique identifier of the WorkflowStep.
          </ResponseField>

          <ResponseField name="name" type="string">
            The name of the WorkflowStep.
          </ResponseField>

          <ResponseField name="type" type="enum">
            The name of the WorkflowStep.
            One of: `EXTERNAL_DATA_VALIDATION`, `RULE_VALIDATION`
          </ResponseField>
        </Expandable>
      </ResponseField>
    </Expandable>
  </ResponseField>
</Expandable>

<ResponseExample>
  ```json Example WorkflowRun theme={null}
  {
    "object": "workflow_run",
    "id": "workflow_run_1234",
    "status": "PROCESSED",
    "metadata": {
      "internal_id": "id_1234"
    },
    "initialRunAt": "2023-01-01T09:41:00.000Z",
    "reviewedBy": "user_1234",
    "reviewedAt": "2023-01-10T05:39:14.500Z",
    "startTime": "2023-01-01T09:41:00.000Z",
    "endTime": "2023-01-10T05:39:24.500Z",
    "outputs": [
      {
        "object": "document_processor_run",
        "id": "dpr_1234",
        "edited": true,
        "type": "EXTRACT",
        "initialOutput": {
          // Output object - see “Processor output types” for details
        },
        "reviewedOutput": {
          // Output object - see “Processor output types” for details
        },
        "output": {
          // Output object - see “Processor output types” for details
        }
      }
    ],
    "stepRuns": [
      {
        "object": "workflow_step_run",
        "id": "step_run_5UUwMs8baKLE5yFS8-0yK",
        "status": "PROCESSED",
        "output": {
          "externalConfidence": 0.8,
          "requiresHumanReview": true
        },
        "step": {
          "object": "workflow_step",
          "id": "step_abolADNNmLcOlTtuxDvle",
          "name": "externalDataValidation1",
          "type": "EXTERNAL_DATA_VALIDATION"
        }
      },
      {
        "object": "workflow_step_run",
        "id": "step_run_OjueNCarlQNpkYfnFkD-A",
        "status": "PROCESSED",
        "output": {
          "valid": false,
          "rules": [
            {
              "name": "invoice_number_present",
              "valid": true
            },
            {
              "name": "line_item_amount",
              "valid": true,
              "validArray": [
                true,
                true
              ]
            },
            {
              "name": "vendor_number_present",
              "valid": false,
              "failureReason": "RULE_FAILED"
            }
          ]
        },
        "step": {
          "object": "workflow_step",
          "id": "step_Q1POO8orTTWgX7CmLLvJZ",
          "name": "validation1",
          "type": "RULE_VALIDATION"
        }
      }
    ],
    "workflow": {
      "object": "workflow",
      "id": "workflow_1234",
      "version": "1",
      "name": "test_workflow"
    }
  }
  ```
</ResponseExample>
