# Calling the API to start a workflow, is there a way to add and consume parameters?

**URL:** <https://community.dynatrace.com/t/calling-the-api-to-start-a-workflow-is-there-a-way-to-add-and-consume-parameters/45939>\
**Category:** Automations\
**Tags:** workflows\
**Created:** [June 5, 2024, 9:31pm UTC](https://community.dynatrace.com/t/calling-the-api-to-start-a-workflow-is-there-a-way-to-add-and-consume-parameters/45939 "2024-06-05T21:31:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![henk\_stobbe](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/henk_stobbe/32/30434_2.png) [@henk\_stobbe](https://community.dynatrace.com/u/henk_stobbe)\
**Post date:** [June 5, 2024, 9:31pm UTC](https://community.dynatrace.com/t/calling-the-api-to-start-a-workflow-is-there-a-way-to-add-and-consume-parameters/45939/1 "2024-06-05T21:31:43Z")

</div>

Hello,

Maybe I am overlooking, but how can I add parameters to the API to start a workflow?

And how do I consume these parameters in js?

KR Henk

---

<div class="post-metadata">

**Author:** ![sinisa\_zubic](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/sinisa_zubic/32/32498_2.png) [@sinisa\_zubic](https://community.dynatrace.com/u/sinisa_zubic)\
**Post date:** [June 6, 2024, 9:21am UTC](https://community.dynatrace.com/t/calling-the-api-to-start-a-workflow-is-there-a-way-to-add-and-consume-parameters/45939/2 "2024-06-06T09:21:12Z")

</div>

Hi&nbsp;[@henk\_stobbe](https://community.dynatrace.com/user/11427)

as [mentioned in help](https://docs.dynatrace.com/docs/shortlink/workflows-running#run-a-workflow-with-inputs), have you checked out swagger about how to add parameters to the workflow execution?

 ![sinisa_zubic_0-1717665604529.png](https://global.discourse-cdn.com/dynatrace/original/3X/4/4/4440ba11bd18a6382b78b573830faa0ae6a25119.png)

To access the input parameters, please have a look at this is the code snippet:

```markup
// optional import of sdk modules
import { execution } from '@dynatrace-sdk/automation-utils';

export default async function ({ execution_id }) {
  // your code goes here
  // e.g. get the current execution
  const ex = await execution(execution_id);
  console.log('Automated script execution on behalf of', ex.trigger);
  console.log(ex.input);
  console.log(ex.params);
  return { triggeredBy: ex.trigger };
}

```

The parameters in that case will be logged to console.

Best,  
Sini

---

<div class="post-metadata">

**Author:** ![henk\_stobbe](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/henk_stobbe/32/30434_2.png) [@henk\_stobbe](https://community.dynatrace.com/u/henk_stobbe)\
**Post date:** [June 6, 2024, 9:40am UTC](https://community.dynatrace.com/t/calling-the-api-to-start-a-workflow-is-there-a-way-to-add-and-consume-parameters/45939/3 "2024-06-06T09:40:21Z")

</div>

Hi Sini,

Thanks for your reply,&nbsp; I am very happy,

KR Henk

---

<div class="post-metadata">

**Author:** ![ChristopherHejl](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/christopherhejl/32/20735_2.png) [@ChristopherHejl](https://community.dynatrace.com/u/ChristopherHejl)\
**Post date:** [June 10, 2024, 7:56am UTC](https://community.dynatrace.com/t/calling-the-api-to-start-a-workflow-is-there-a-way-to-add-and-consume-parameters/45939/4 "2024-06-10T07:56:05Z")

</div>

I’d like to add that you can also access workflow inputs in any action without javascript using expressions as well&nbsp;[Jinja expressions for Workflows — Dynatrace Docs](https://docs.dynatrace.com/docs/shortlink/automation-workflow-expression-reference#execution)

```python
# access the current execution object
{{ execution() }}

# access ID of current execution
Execution ID {{ execution().id }}

# access input of current execution
Execution input {{ execution().input | default('no input defined') }}

```
