# Workflow Tasks in an API Flow

### Video

{% embed url="<https://www.youtube.com/watch?v=_4OZ0vb6b1U>" %}

An API flow orchestration allows the usage of various workflow tasks. These include tasks like *Send Mail,* *System File Actions,* *Run Exe Programs,* *Run Flow* tasks, FTP tasks, etc, which can be utilized per the API action.

Inside the toolbox, the *Workflow Tasks* tab lists all the available tasks that can be used when designing an API flow.

![](/files/lA7iQiP9NLleSJUrWOlK)

For our use case, we have designed an API flow for the ‘Get Product by name’ endpoint.

![](/files/VEWA1oHLmXq1SgeLxzeR)

As you can see in the flow above, two *Send Mail* workflow tasks have been used. Once a request is received with the product name, it is sent as input to the *Database Lookup* object to fetch a matching record. It is then passed through a *Route Transformation* which routes the data to send a confirmation mail for a successful match or a ‘Not Found’ mail notification otherwise.

The user will either receive a mail that says the item is available or a mail that states that the item is unavailable, and the API will return the respective responses.

{% hint style="info" %}
**Note:** If no data mappings are available to orchestrate the flow, as in this case when using a *Send Mail* object, the user can make use of Anchor Maps to control the flow.
{% endhint %}

To learn more about how Anchor Maps are used, please refer to the respective document here.

Similarly, here is another way we have used workflow tasks within an API flow,

![](/files/nJaRQ8W2w2JfoopcGrKe)

Instead of using the *DB Lookup* and *Route Transformation* object, the entire process has been replaced with a *Run Dataflow* object that can run any ETL pipeline.

The dataflow that will be triggered in the API is doing the same work as the previous API flow. However, it is now less cluttered.

This concludes the functionality of Workflow tasks in an API flow.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.astera.com/api-flow/api-publishing/develop/workflow-tasks-in-an-api-flow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
