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

# Actions

Action represents a single request or query your application wants to make in an external application. For example, "Create a task", "Get list of users", or "Send a message".

Here is an example of an action:

```yaml theme={null}
name: Create Task
key: create-task
inputSchema:
  type: object
  properties:
    title:
      type: string
    description:
      type: string
type: api-request-to-external-app
config:
  method: POST
  path: /tasks
  body:
    summary:
      $var: $.input.title
    description:
      $var: $.input.description
```

<br />

## Action Structure

Action has the following properties:

* **`inputSchema`** – [Data Schema](https://.integration.app/docs/references/data-schemas) describing the payload that will be validated when you run the action.
* **`type`** – action type that maps to a [Function Type](/docs/references/functions) that implements the `run` function of this action.
* **`config`** – implementation of the `run` function.
* **`outputSchema`** - defines expected output of the action.
* **`customOutputSchema`** - overrides the default value of `outputSchema`. If customOutputSchema is set, outputSchema will always equal `customOutputSchema`

## Run Function

Action interface provides one function: [Run](/docs/references/functions/function-types/run-action).

The implementation of this function is configured with two properties: `type` and `config`.

The `run` function receives the following arguments:

* `input` - action input provided when running the action.

Action types map to [Function Types](/docs/references/functions) and let you choose how action's `run` function is implemented. If not sure what action type to use, [Javascript](/docs/references/functions/function-types/javascript) is the most versatile type that lets you do anything, and [API Request to External App](/docs/references/functions/function-types/api-request-to-external-app) is commonly used to configure API requests if it's all that action needs to do.

| Type                          | Description                                                                      | Function Type                                                                                        |
| :---------------------------- | :------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------- |
| `run-javascript`              | Runs custom JavaScript (or TypeScript) code                                      | [JavaScript](/docs/references/functions/function-types/javascript)                                   |
| `api-request-to-external-app` | Makes API requests to the external app with authentication applied automatically | [API Request to External App](/docs/references/functions/function-types/api-request-to-external-app) |
| `api-request-to-your-app`     | Makes API requests to your Internal API                                          | [API Request to Your App](/docs/references/functions/function-types/api-request-to-your-app)         |
| `http-request`                | Makes arbitrary HTTP requests to any endpoint                                    | [HTTP Request](/docs/references/functions/function-types/http-request)                               |

<br />

## Using Actions

Action has only one function: `run`. To run an action, you need to provide an input that matches its `inputSchema`. As a result, you will get an output that matches its `outputSchema`.

All the action runs are recorded as [Action Run Logs](/reference/workspace-elements/action-run-logs).

See full API reference here: [Actions API Reference](https://.integration.app/update/reference/workspace-elements/actions).

## API Operations

| Operation                                                                                   | Method | Endpoint                           | Description                                     |
| ------------------------------------------------------------------------------------------- | ------ | ---------------------------------- | ----------------------------------------------- |
| [Act](/reference/workspace-elements/act)                                                    | POST   | `/act`                             | Run an action (canonical run path)              |
| [List all actions](/api-reference/actions/list-actions)                                     | GET    | `/actions`                         | Retrieve all workspace actions                  |
| [Get action by ID](/api-reference/actions/get-action-by-selector)                           | GET    | `/actions/{selector}`              | Get specific action details                     |
| [Create a new action](/api-reference/actions/create-a-new-action)                           | POST   | `/actions`                         | Create a new workspace action                   |
| [Replace action](/api-reference/actions/replace-action-completely)                          | PUT    | `/actions/{selector}`              | Replace action configuration                    |
| [Patch action](/api-reference/actions/update-action-partially)                              | PATCH  | `/actions/{selector}`              | Update action partially                         |
| [Clone action](/api-reference/actions/clone-action)                                         | POST   | `/actions/{selector}/clone`        | Clone an existing action                        |
| [Run action](/reference/workspace-elements/act#legacy-post-actionsselectorrun)              | POST   | `/actions/{selector}/run`          | Execute an action (**deprecated** — use `/act`) |
| [Reset action](/api-reference/actions/reset-action)                                         | POST   | `/actions/{selector}/reset`        | Reset action to default state                   |
| [Export action](/api-reference/actions/export-action-flat-interface)                        | GET    | `/actions/{selector}/export`       | Export action configuration                     |
| [Get action dependencies](/api-reference/actions/get-dependencies-of-action-flat-interface) | GET    | `/actions/{selector}/dependencies` | Get action dependencies                         |
| [Restore action](/api-reference/actions/restore-action-flat-interface)                      | POST   | `/actions/{selector}/restore`      | Restore archived action                         |
| [Refresh actions](/api-reference/actions/refresh-action)                                    | POST   | `/actions/refresh`                 | Refresh action definitions                      |
| [Archive action](/api-reference/actions/archive-action)                                     | DELETE | `/actions/{selector}`              | Archive an action                               |
