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

# Integrate business workflow templates

> Discover accounts payable, expense reimbursement, and financial reporting templates, then upload files, run workflows, and query results with shared APIs.

ADP provides three business workflow templates: accounts payable, expense reimbursement, and financial reporting. Query each template's run-readiness state, then process your documents with the same set of workflow APIs.

## Template catalog

| Template application | Application type | `template_key` | Use case |
| - | - | - | - |
| Accounts payable | Workflow | `finance_payable` | Recognize payment requests, contracts, invoices, goods receipts, settlement documents, and acceptance records to review accounts payable and deliver results. |
| Expense reimbursement | Workflow | `expense_reimbursement` | Recognize reimbursement requests, bills, travel approvals, ride-hailing itineraries, and restaurant receipts, then review them by expense type. |
| Financial reporting | Workflow | `financial_report_extraction` | Split financial reports, extract basic information and the income statement, balance sheet, and cash flow statement, and consolidate the results. |

## Query templates and run readiness

Use [List business workflow templates](/en/api-reference/adp-api/workflows/list-business-workflow-templates):

```http theme={null}
GET /open/agentic_engine/laiye/v1/app/templates?offset=0&size=20
X-API-Key: <your API key>
```

Select a template by `template_key` from `data.list`. The endpoint supports name searches with `search` and pagination with `offset` and `size`.

| Response field | Usage |
| - | - |
| `template_key` | Identifies the business template so you can select the exact solution in the catalog. |
| `application_id` | Stable public application ID used in file upload and run requests. |
| `is_added` | Whether the account associated with the current API key has added the template. |
| `application_status` | State of the corresponding account application: `draft`, `published`, or `null`. |
| `can_run` | Whether the current account can run the template. Submit a run request only when this is `true`. |

<Info>
  Use the live query response to determine availability. If `can_run=false`, add, configure, and publish the corresponding application in the [ADP Console](https://adp-global.laiye.com/?utm_source=apidoc), then query again. An `application_id` or `is_added=true` alone does not mean the template can run.
</Info>

## Prepare documents

Upload local files with the [Upload file](/en/api-reference/adp-api/workflow-files/upload-doc-flow-file) endpoint first. Use `multipart/form-data`, place the file in `chunk`, set `application_id` to the value returned by the template query, and use `application` for `sharing_scope`.

Map `data.download_url` from the upload response to `files[].url`, `data.file_name` to `name`, and `data.content_type` to `mime_type` in the run request. Use one file entry per document. If you already have an accessible public HTTP(S) file URL, you can provide `url`, `name`, and `mime_type` directly.

## Run with the shared APIs

All three templates use the same endpoint paths and request structure. Select the target template application with `application_id`:

| Operation | Endpoint |
| - | - |
| [Run synchronously](/en/api-reference/adp-api/workflows/run-doc-flow-app) | `POST /open/agentic_engine/laiye/v1/app/run` |
| [Create an asynchronous run task](/en/api-reference/adp-api/workflows/create-doc-flow-run-task) | `POST /open/agentic_engine/laiye/v1/app/run/create/task` |
| [Query run results](/en/api-reference/adp-api/workflows/query-doc-flow-run-task) | `GET /open/agentic_engine/laiye/v1/app/run/query/task/{run_id}` |

The following example uses the financial reporting template. Confirm that its `can_run` value is `true`, replace the file details with your actual document, and submit the same JSON body to either the synchronous or asynchronous run endpoint:

```json theme={null}
{
  "application_id": "wftp_app_y6p2m8q4v1c9t3x7n5r0h2k6",
  "files": [
    {
      "url": "https://example.com/annual-report.pdf",
      "name": "annual-report.pdf",
      "mime_type": "application/pdf"
    }
  ]
}
```

The example `application_id` is the stable public ID for the financial reporting template. For accounts payable or expense reimbursement, use the corresponding template's returned `application_id` and your document files.

Each `files` entry requires `url`, `name`, and `mime_type`, and optionally accepts `size` and `metadata`. Set `inputs` according to the published workflow's actual input configuration; omit it when no extra parameters are required. You can omit `release_version_id` to let the service select the published version.

The synchronous endpoint waits for execution to finish. After the asynchronous endpoint returns `data.run_id`, use the query endpoint to retrieve the status and result. Read `data.output` after confirming HTTP success, a successful top-level `code`, and `data.status=succeeded`. For a failed run, inspect `data.error`.


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