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

# Actions

> Build action parameters and JavaScript execution

# Actions

In step 4, click **Add Action** to define what your node does.

Each action has:

* Enable/disable toggle
* **Parameters** tab
* **Execute (JS)** tab
* **Sample output (json)** tab

## Parameter validation

Validate required fields early and return clear errors.

```js theme={null}
//can only access: parameters, log(), fetch()

if(!parameters.name) throw new Error('Name is required')
if(!parameters.age) throw new Error('Age is required')
if(parameters.age < 18) throw new Error("Too young")
```

## API call example

```js theme={null}
const url = "https://jsonplaceholder.typicode.com/posts";  //Endpoint for testing
const data = {
    name: parameters.name,
    age: parameters.age,
};

const response = await fetch(url, {
    method: "POST",
    headers: {
        "Content-Type": "application/json"
    },
    body: JSON.stringify(data)
});

return response;
```

## Return format

The action response is already an object or an array of objects.
Do not parse it again with `response.json()`.

## Debugging

Use the right panel:

* **Outputs** to inspect returned data
* **Errors** to view thrown validation messages
* **Logs** to trace execution

<Note>
  Keep output JSON stable. Downstream workflow mappings rely on this structure.
</Note>
