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

# Execute Task

> Create and start a scraping task from an AgentTools template.

<Info>
  The request body, generated cURL example, and response schema are shown in the API panel. Use this page for execution rules that are easy to miss.
</Info>

Create and start a scraping task from a template returned by `searchTemplates`.

<Steps>
  <Step title="Choose a template">
    Pass `templateName` from `searchTemplates`.
  </Step>

  <Step title="Serialize parameters">
    Send `parameters` as a JSON object serialized as a string.
  </Step>

  <Step title="Follow server guidance">
    Use `retryGuidance`, `suggestedNextCall`, `workflow`, and `toolHint` instead of fixed polling intervals.
  </Step>
</Steps>

```text theme={null}
searchTemplates -> executeTask -> exportData
```

<CardGroup cols={2}>
  <Card title="Required header" icon="user">
    `x-external-user-id` is required for user-scoped execution.
  </Card>

  <Card title="Row limit" icon="list-ordered">
    `targetMaxRows` is optional and accepts values from `0` to `1000000`.
  </Card>
</CardGroup>

<Warning>
  Source-backed fields must use option keys. MultiInput and multiselect-like fields must use arrays, even for one item.
</Warning>

<AccordionGroup>
  <Accordion title="Request body fields">
    `templateName` is required.

    `taskName` is optional.

    `parameters` is optional, but must be a serialized JSON object when provided.

    `targetMaxRows` is optional.
  </Accordion>

  <Accordion title="Status values">
    `accepted`: the task was accepted for execution.

    `ready`: data may be ready to export.

    `awaiting_source_selection`: a source-backed field needs a valid option key.

    `invalid`, `start_failed`, and `failed`: check `recoverySuggestion`, `blockingIssues`, `missingParamNames`, and `invalidSourceSelections`.
  </Accordion>

  <Accordion title="Important response fields">
    `taskId` identifies the task to export or inspect.

    `lotNo` identifies the batch or run. Pass it to `exportData` when returned.

    `recoverySuggestion`, `blockingIssues`, `missingParamNames`, and `invalidSourceSelections` help the client repair invalid calls.
  </Accordion>
</AccordionGroup>
